Put dynare *.mod in a loop

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

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.

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

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.