Page 1 of 1

How to use dynasave within Stochastic Simulations?

PostPosted: Wed Jan 28, 2009 7:26 pm
by measilva
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.

Re: How to use dynasave within Stochastic Simulations?

PostPosted: Tue Feb 17, 2009 9:35 am
by SébastienVillemot
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

Re: How to use dynasave within Stochastic Simulations?

PostPosted: Tue Feb 17, 2009 2:15 pm
by measilva
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,