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.
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.
I will check these and then i will report if it works for me.
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).
But how could we experiment the transition from a steady state to another in a deterministic case?
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…
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.
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.
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?
Please see below:
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?
[quote=“StephaneAdjemian”]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.
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.