You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an easy way to simulate the variables after solving?
For example after I solve a simple consumption problem I would like to use the program output to plot for one path of shocks:
income over time
consumption over time
wealth level over time
etc
The text was updated successfully, but these errors were encountered:
You can use the package Interpolations to interpolate the values in result:
using Interpolations
functionsimulate(m::AchdouHanLasryLionsMollModel, stategrid, result_ip)
T =100
yT, aT, cT =zeros(T), zeros(T), zeros(T)
y, a =1.0, 1.0for t in1:T
y += m.κy * (m.ybar - y) + m.σy *rand(Normal())
a += result_ip[:μa](y, a)
yT[t] = y
aT[t] = a
cT[t] = result_ip[:c](y, a)
endreturn yT, aT, cT
end
m =AchdouHanLasryLionsMollModel()
stategrid =initialize_stategrid(m)
y0 =initialize_y(m, stategrid)
y, result, distance =pdesolve(m, stategrid, y0)
result_ip =Dict(x =>interpolate(tuple(values(stategrid)...), result[x], Gridded(Linear())) for x inkeys(result))
yT, aT, cT =simulate(m, stategrid, result_ip)
Is there an easy way to simulate the variables after solving?
For example after I solve a simple consumption problem I would like to use the program output to plot for one path of shocks:
income over time
consumption over time
wealth level over time
etc
The text was updated successfully, but these errors were encountered: