Mismatch manual and code? stoch_simul w/ initial conditions

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Mismatch manual and code? stoch_simul w/ initial conditions

Postby Thorsten » Sat Jul 16, 2011 9:55 pm

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 http://www.dynare.org/manual/index_23.html#Stochastic-solution-and-simulation and on http://www.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. [I am using Dynare 4.2.1.]

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.

Best,
Thorsten
Thorsten
 
Posts: 9
Joined: Mon Sep 14, 2009 9:28 pm

Re: Mismatch manual and code? stoch_simul w/ initial conditi

Postby Thorsten » Sun Jul 17, 2011 12:47 am

As a follow up, also the documentation of the 3rd order approximation is off. Whereas http://www.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 http://www.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).

Best,
Thorsten
Thorsten
 
Posts: 9
Joined: Mon Sep 14, 2009 9:28 pm

Re: Mismatch manual and code? stoch_simul w/ initial conditi

Postby StephaneAdjemian » Mon Jul 18, 2011 2:11 pm

Dear Thorsten,

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.

Best,
Stéphane.
Stéphane Adjemian
Université du Maine, GAINS and DynareTeam
https://stepan.adjemian.eu
StephaneAdjemian
 
Posts: 429
Joined: Wed Jan 05, 2005 4:24 pm
Location: Paris, France.

Re: Mismatch manual and code? stoch_simul w/ initial conditi

Postby Thorsten » Mon Jul 18, 2011 8:17 pm

Dear Stephane,

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) http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=2851#p6548.

Best,
Thorsten
Thorsten
 
Posts: 9
Joined: Mon Sep 14, 2009 9:28 pm

Re: Mismatch manual and code? stoch_simul w/ initial conditi

Postby AnitaYang » Tue Oct 04, 2011 1:33 am

Hi Stéphane,

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.
Anita
AnitaYang
 
Posts: 13
Joined: Sun Aug 29, 2010 3:30 am

Re: Mismatch manual and code? stoch_simul w/ initial conditi

Postby AnitaYang » Tue Oct 04, 2011 6:35 pm

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;

---
Anita
AnitaYang
 
Posts: 13
Joined: Sun Aug 29, 2010 3:30 am


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 13 guests