Running Dynare produces different results than a parameter loop

Thank you in advance. Please find at minimal worked example attached.

RunModel.m runs the model CP.mod with different combinations of the instrument chi2_CD and chi2_PD which are taxes on loans for a core and periphery country. Parameters are set using the Set_Parameters.m file into a Params.mat file.

Its set as a loop over the 3 methods to get the variances I have tried:

  1. Looping inefficiently over DYNARE
  2. Looping over stoch_simul
  3. Looping over simult

It creates and saves figures of the variances of consumption, employment and the instrument. You’ll see that all 3 produce different variances. The inefficient loop produces smooth results, the other two are very bumpy.

One thing I tried is using theoretical variances and empirical variances (using periods =1000). The former fails to produce anything for consumption and employment (due to N/A errors) so I can’t use it.

If you could help me at all, that would be fantastic, and much appreciated.

Thanks again,

Tim

Minimal Worked Example.zip (1.8 MB)

  1. Your model has unit roots, so the second moments are not stationary. Using finite simulations will not provide correct moments in any case.
  2. If you use simulations, you need to make sure the seed for the simulations stays the same. When calling Dynare repeatedly that is the case. When calling subfunctions, you need to add
 set_dynare_seed('default');

after setting the parameters.

Thank you, yes I know about our unit root problem, we’re working on that. It was the simulation seed that was causing the problem - I should have thought of that - your fix worked perfectly, thank you.

All the best,

Tim

Dear all,

I’m getting an odd result when looping over parameters in Dynare. My variances (oo_.var) are different if I use the very inefficient loop over “dynare Model.mod” as opposed to running dynare once and then looping over “stoch_simul(var_list_)” or “resol, simult and disp_moments”.

The latter two give the same results, which give a non-monotonic relationship over parameters, whilst looping over the “dynare” command itself gives a nice smooth relationship between parameters and model variances.

Any idea why this might be? The model files are quite involved but happy to post them if needs be.

Thanks in advance and all the best

Tim

I would need to see the codes.