Page 1 of 1

N stochastic simulations for a number of periods T

PostPosted: Mon Dec 23, 2013 12:33 pm
by Lara
Dear all,
I am trying to construct a matrix of stochastic simulations for a macroeconomic variable using a log-linearized model in dynare. In particular, I use stoch_simul(order=1,irf=20, periods=200), i.e. I do not set any seed. I expect the simulated variable to differ each time I run the model, because I assume that each time the stochastic shocks would be extracted randomly from their distribution. However, I consistently get exactly the same simulated variable (despite not having set the seed). Am I missing something?
How can I get a set of N different stochastic simulations for the variable for a certain number of periods T?
Thanks in advance. Your help is much appreciated.
Best,
Lara

Re: N stochastic simulations for a number of periods T

PostPosted: Fri Dec 27, 2013 10:50 am
by jpfeifer
You can do this by using the simul_replic option of stoch_simul. You can use the attached file to read the simulation saved to the harddisk into a three dimensional array. The reason for the same shocks is that Dynare resets the seed on every run. You could also change the seed. See the manual.

EDIT: The file has moved to my homepage, because it is easier to keep it current there: https://sites.google.com/site/pfeiferecon/dynare

Re: N stochastic simulations for a number of periods T

PostPosted: Fri Dec 27, 2013 6:29 pm
by Lara
Dear Johannes,
thanks for your reply.
I would be grateful if you could clarify a couple of things. I used stoch_simul(order=1,simul_replic=200,periods=200). I saved the m.file you attached in the folder where my .mod file is located. My mod file is named Lara.mod. In the Matlab command window I have written get_simul_replications('Lara.m',options_), but I got the following error messagge: ??? Attempt to reference field of non-structure array.. What do I do wrong? How do I have to call the function? In other words, how do I access the simulations of my model?
Many thanks.
Lara

Re: N stochastic simulations for a number of periods T

PostPosted: Fri Dec 27, 2013 6:31 pm
by jpfeifer
You need to call it with
Code: Select all
simulation_array=get_simul_replications(M_,options_);

Re: N stochastic simulations for a number of periods T

PostPosted: Mon Dec 30, 2013 10:35 am
by Lara
Dear Johannes,
thanks a lot. Now I can see the simulations.
Best,
Lara