Page 1 of 1

Simulation using Policy functions

PostPosted: Mon Nov 07, 2016 7:14 pm
by lm280299
Hi everyone,

I ask for the following help:

I attempted to understand how the second-order approximation worked in Dynare. I specified a value for periods, provided the initial value close enough to the steady state and typed "steady", so I generated a stochastic simulation starting from the steady state. Then I found the results of policy functions. Following the reference manual, I set down the following lines in Matlab:

periods=1000;
Variablenumber=24;
y_sim=zeros(Variablenumber,periods);
y_sim(:,1)=oo_.dr.ys+0.5*oo_.dr.ghs2+oo_.dr.ghx*zeros(5,1)+oo_.dr.ghu*oo_.exo_simul(1,:)'+0.5*oo_.dr.ghxx*zeros(25,1)+0.5*oo_.dr.ghuu*
kron(oo_.exo_simul(1,:)',oo_.exo_simul(1,:)')+oo_.dr.ghxu*kron(zeros(5,1),oo_.exo_simul(1,:)');

Here zeros(5,1) means that I have 5 endogeneous state variables and that the difference of them compared to the steady state is zero since I simulate from the steady state. But the result of the simulation in the first period differs from the simulation conducted by Dynare, which was correct. I wonder where I made a mistake.

Re: Simulation using Policy functions

PostPosted: Wed Nov 09, 2016 7:10 pm
by jpfeifer
I am not entirely sure what you are doing, but
1.)
Code: Select all
oo_.exo_simul
is supposed to be for perfect foresight simulations.
2.) There is a difference between the declaration order of oo_.dr.ys and the declaration order of the gh-matrices. See simult_.m for the way Dynare conducts simulations.