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.
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: sites.google.com/site/pfeiferecon/dynare
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?
You need to call it with
thanks a lot. Now I can see the simulations.