stoch_simul transition from on steady to another

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.

stoch_simul transition from on steady to another

Postby petros_varth » Wed Nov 27, 2013 1:08 pm

Hi All,

I would like to simulate my model when the economy starts at one steady-state and travels to another. I think i can understand how to do it with simul in a deterministic environment but i don't to know how to do it with stoch-simul. In other words, i would like stochastic simulations of my endogenous variables when i know their initial values and at the same time these initial values are differ from the steady-state in which i approximate around.


Any suggestion it would be very helpful.

Thanks.

P.
petros_varth
 
Posts: 45
Joined: Wed Sep 30, 2009 5:35 pm

Re: stoch_simul transition from on steady to another

Postby StephaneAdjemian » Wed Nov 27, 2013 4:35 pm

Hi,

If my understanding is correct you do not need to change the steady state... You just just want to set to set an initial condition different from the steady state. You can set the initial condition for all the endogenous variables with the histval block (see section 4.7 in the manual). Then you can use either the stoch_simul command or the extended_path to perform the simulation. I posted examples describing how to implement both approaches here and here. The model is trivial (a linear auto-regressive process) but it will work also with a more general non linear model. Obviously if the model is non linear and the initial condition far away from the steady state, the approximation given by the stoch_simul command will be poor. In such a case you should prefer the extended_path command.

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: stoch_simul transition from on steady to another

Postby petros_varth » Wed Nov 27, 2013 4:48 pm

Many thanks.

I will check these and then i will report if it works for me.

P.
petros_varth
 
Posts: 45
Joined: Wed Sep 30, 2009 5:35 pm

Re: stoch_simul transition from on steady to another

Postby StephaneAdjemian » Wed Nov 27, 2013 4:52 pm

I forgot to mention that the option drop=0 in stoch_simul is important in your case (otherwise you would discard the first part of the transition).
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: stoch_simul transition from on steady to another

Postby petru_k » Thu Nov 28, 2013 12:09 pm

But how could we experiment the transition from a steady state to another in a deterministic case?

Many thanks!
petru_k
 
Posts: 4
Joined: Tue Jun 19, 2007 2:17 pm

Re: stoch_simul transition from on steady to another

Postby StephaneAdjemian » Thu Nov 28, 2013 3:11 pm

I did understand that you wanted to do a stochastic simulation. For the deterministic case you just need to specify the initval and endval blocks before the simul command as it is described here (you just need to remove the shocks block you do not need in this case) and in the manual...

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: stoch_simul transition from on steady to another

Postby petros_varth » Fri Nov 29, 2013 7:35 pm

Dear Stephane,

Thanks, now it works fine. Please let me ask you the following:

Is it sufficient to simulate the model for, say 100 periods, and take the path of the endogenous variable to find a conditional mean.

Or i should use simul_replic? If yes, can you give me a hint on how i can convert the file with the results in binary form to a .mat?

Thanks a lot.

P.
petros_varth
 
Posts: 45
Joined: Wed Sep 30, 2009 5:35 pm

Re: stoch_simul transition from on steady to another

Postby StephaneAdjemian » Fri Nov 29, 2013 9:45 pm

petros_varth wrote:Is it sufficient to simulate the model for, say 100 periods, and take the path of the endogenous variable to find a conditional mean.


The moments will be conditional to the initial condition (the steady state by default). Obviously these moments will depend on the number of periods and because the model is stationary will converge to the unconditional moments as the number of periods tends to plus infinity.

petros_varth wrote:Or i should use simul_replic? If yes, can you give me a hint on how i can convert the file with the results in binary form to a .mat?


By increasing simul_replic you will decrease the variance of your estimate for the conditional moments. I don't understand the last question, which file do you want to convert?

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: stoch_simul transition from on steady to another

Postby petros_varth » Sun Dec 01, 2013 8:25 pm

Dear Stephane,

Please see below:

petros_varth wrote:Is it sufficient to simulate the model for, say 100 periods, and take the path of the endogenous variable to find a conditional mean.


StephaneAdjemian wrote:The moments will be conditional to the initial condition (the steady state by default). Obviously these moments will depend on the number of periods and because the model is stationary will converge to the unconditional moments as the number of periods tends to plus infinity.


Yes, this is fine. I use the command hist_val so the path of the endogenous variables will be conditional on the initial condition given by hist_val. Yes?
Then, the path will converge to its steady-state, given by initval..end; if i increase the number of periods. Yes?

petros_varth wrote:Or i should use simul_replic? If yes, can you give me a hint on how i can convert the file with the results in binary form to a .mat?


StephaneAdjemian wrote:By increasing simul_replic you will decrease the variance of your estimate for the conditional moments. I don't understand the last question, which file do you want to convert?



So, if i want to improve my conditional moments i should increase simul_replic?
In Dynare manual refers the following:

simul_replic = INTEGER
Number of series to simulate when empirical moments are requested (i.e. periods > 0). Note that if this option is greater than 1, the additional series will not be used for computing the empirical moments but will simply be saved in binary form to the file ‘FILENAME_simul’.


If i understand well, this means that Dynare produces "simul_replic" number of paths/series of the endogenous variables which each series contains the path of the endogenous variables from 0 to "periods". Yes?

So, if i use simul_replic a file is created with the series of the endogenous variables in binary form with the name ‘FILENAME_simul’, can you give me a hint how i can convert these data to a .mat?

Thanks a lot.

P.
petros_varth
 
Posts: 45
Joined: Wed Sep 30, 2009 5:35 pm

Re: stoch_simul transition from on steady to another

Postby StephaneAdjemian » Wed Dec 04, 2013 3:53 pm

Yes the moments computed with the generated paths will be conditional on the initial condition specified in the histval block.

The moments computed with the generated paths will converge to the moments of the ergodic distribution as the length of the paths tends to infinity (the generated the paths will not return to the steady state because of the innovations, but the cross section of the generated path will converge to the stochastic steady state, ie ergodic or limit distribution).

By increasing the value of simul_replic you will increase the precision of your estimates of the conditional moments.

I did forget that Dynare does not compute the simulated moments using all the simulated paths (this is kind of weird). To read the produced binary data file you need to read matlab's documentation (you will need the fread function).

I forgot to mention that you can also compute the conditional moments using the reduced form matrices (see the documentation about the first order approximation) dr.ghx and dr.ghu as you would do in a VAR model (or a state-space model). You can look (or modify) the routines display_conditional_variance_decomposition and conditional_variance_decomposition (where as the name suggest we compute the conditional variance decomposition) to get what you want.

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.


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 6 guests