How to use dynasave within Stochastic Simulations?

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.

How to use dynasave within Stochastic Simulations?

Postby measilva » Wed Jan 28, 2009 7:26 pm

Hello everyone,

I was wondering if anyone knows how to use dynasave or any other method to save the results from stochastic simulations.

What I want is to run several simulations (let's say 100 simulations for a sample size of 1055, dropping the first 1000) and compute averaged moments for these simulations (as it is done in the business cycles literature).

I have tried to put dynasave within the following loop, but it doesn't work.

@#for i in 1:100
stoch_simul(periods=1055, drop=1000, nograph) gdp;
dynasave mydata;
@#endfor

Any help would be appreciated. Thanks.
Marcelo
University of North Carolina
measilva
 
Posts: 31
Joined: Wed Mar 05, 2008 3:47 pm
Location: University of North Carolina

Re: How to use dynasave within Stochastic Simulations?

Postby SébastienVillemot » Tue Feb 17, 2009 9:35 am

Hi,

Since you save your data in the same file at each iteration, you will only have the last iteration remaining in the file at the end of the loop.

You could try to save your data in several files, using something like "dynasave mydata@{i}". Or you can save the results of each iteration (found under the "oo_" structure), and build your own data structure.

Sébastien
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France

Re: How to use dynasave within Stochastic Simulations?

Postby measilva » Tue Feb 17, 2009 2:15 pm

Hi Sébastien,

Thanks for your answer.

Regarding my problem what I did was to write a loop as in Matlab and then save the variables at each iteration. It works well.

Thanks again,
Marcelo
University of North Carolina
measilva
 
Posts: 31
Joined: Wed Mar 05, 2008 3:47 pm
Location: University of North Carolina


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 11 guests