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.