Page 1 of 1

put dynare *.mod in a loop

PostPosted: Sat Apr 09, 2011 3:34 am
by xuenanli
Dear all,

I need to put the "dynare *.mod" operation inside a loop. In each loop, I solve the model with different parameter values and simulate a panel of artificial data using the solution. Since nothing is changed in each loop except the parameters and I calculate the steady state with my own m-file, I am thinking to do the following to save computational time: compile the mod file once at the beginning to generate the corresponding m file. Afterwards, within each loop, I change the parameter values directly in M_.params and just run the m file in the loop. Can you let me know whether this procedure will give me the correct solutions?

Thank you for your help!
Erica

Re: put dynare *.mod in a loop

PostPosted: Tue Apr 19, 2011 9:51 am
by SébastienVillemot
This might work, but you will probably need to look at some Dynare internals to make sure everything is working as expected.

I am actually not sure that there is much to gain from this procedure: the preprocessor is quite efficient and runs in a negligible time.

Re: put dynare *.mod in a loop

PostPosted: Tue May 17, 2011 2:56 pm
by xuenanli
Thanks a lot for your help! I will compare the results from both methods. You are probably right. I will check on the time saved to see whether it is worthwhile.
Best,
Erica

Re: put dynare *.mod in a loop

PostPosted: Thu Mar 08, 2012 5:14 pm
by aghaly
Hi everybody,
i'm currently doing a similar stuff. Actually I run a mod file inside which I have a loop over a parameter "sigma" and similate the model for each value of this parameter. I'm particularly interested in the standard deviations of the endogenous variables.

How could you get these moments at the same time with the corresponding parameter "sigma" ?

Many thanks in advance.