N stochastic simulations for a number of periods T

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.

N stochastic simulations for a number of periods T

Postby Lara » Mon Dec 23, 2013 12:33 pm

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
Lara
 
Posts: 33
Joined: Tue Jan 19, 2010 7:11 pm

Re: N stochastic simulations for a number of periods T

Postby jpfeifer » Fri Dec 27, 2013 10:50 am

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
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: N stochastic simulations for a number of periods T

Postby Lara » Fri Dec 27, 2013 6:29 pm

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
Lara
 
Posts: 33
Joined: Tue Jan 19, 2010 7:11 pm

Re: N stochastic simulations for a number of periods T

Postby jpfeifer » Fri Dec 27, 2013 6:31 pm

You need to call it with
Code: Select all
simulation_array=get_simul_replications(M_,options_);
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: N stochastic simulations for a number of periods T

Postby Lara » Mon Dec 30, 2013 10:35 am

Dear Johannes,
thanks a lot. Now I can see the simulations.
Best,
Lara
Lara
 
Posts: 33
Joined: Tue Jan 19, 2010 7:11 pm


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 5 guests