Hey all -
I was looking at the stochastic simulation of a model with starting values different from the steady state. To that end, I have used the initval-block and the periods option in the stoch_simul command and played around with the drop option to make sure my initial values don’t drop because of that. However, Dynare starts always from the steady state, unlike what is stated on dynare.org/manual/index_23.html#Stochastic-solution-and-simulation and on dynare.org/manual/index_17.html#Initial-and-terminal-conditions.
I therefore opened stoch_simul.m and went to line 126 where simult is called – as “simult(oo_.dr.ys,oo_.dr);” This triggers in line 57 simult_.m, which in principle allows for arbitrary starting values, but since simult.m and stoch_simul apparently do not, simult_ has to work with the steady state values oo_.dr.ys. *
Any thoughts? I know how to use the decision rule to simulate from my starting values, but if it’s not me but Dynare, it would be nice to update either the code or the manual so that others don’t waste their time, too.
As a follow up, also the documentation of the 3rd order approximation is off. Whereas dynare.org/manual/index_23.html#Third-order-approximation implies that, for example, oo_.dr.g_2 would be of size n_x times n_z^2, where n_z=oo_.dr.npred + M_.exo_nbr. However, in line with the Dynare++ tutorial dynare.org/documentation-and-support/dynarepp/dynare-tutorial.pdf/view on p. 24, the matrix is in effect of size n_z*(n_z+1)/2. Similarly, the dimension of oo_.dr.g_3 is off (it is not n_x times n_z^3 but also exploits the symmetries).
The documentation is not very clear on this point. The histval block should be used in this case rather than the initval block. Unfortunately, this is broken in the current version of dynare. As you saw in the codes, the simulations are systematically initialized with the deterministic steady state… We will fix this bug as soon as possible. Meanwhile, you have to call simult_.m (this can be done in the mod file) with arbitrary initial conditions.
thanks a lot for the clarification!
For the 3rd order approximation, it seems that Ian has posted code to do the simulation manually using the stored decision rule (though dynare_simul_ probably does the same) [Manipulating the decision rules).
Could you explain more about how to call simult_.m (this can be done in the mod file) with arbitrary initial conditions? I want to know how to get the stochastic simulation of a model with starting values different from the steady state, before the new version of Dynare can be released.
Thank you so much.
I got some idea from Thorsten’s post to simulate from my starting values that are different than steady state values, but I am not sure whether I am correct. Please give me any comment. Thank you.
To prevent simult_.m from working with the steady state values oo_.dr.ys., I replace line 40, “y_(:,1) = y0;”, in simult_.m with other arbitrary initial conditions. For example, if n=5 and I’d like to set my starting values as [0; 0; 0; 1; 0], in simult_.m, I replace “y_(:,1) = y0;” with
y_(:,1) = zeros(size(y0,1),1);
y_(4,1) = 1;