Different Results under Different OS using dynare_simul

Hi All,

I was using dynare++(4.5.7) to solve a model to 3rd order and then run some simulations. The way I did it is the following:

  1. Compute the policy functions using dynare++;
  2. Generate some shocks from Matlab using a fixed random seed.
  3. Run simulation using dynare_simul(‘model.mat’, shocks);

Here’s the puzzle: I’ve run exactly the same code on 4 different systems and the simulation results(in particular, mean of variables) I’m getting are quite far from each other. The systems are: mac os Mojave 10.14.3, Windows 10, Linux(Manjaro) and Linux(Ubuntu 18.04). Among them Windows 10 and Majaro give similar results(but not reasonable given my model) and others are quite different. All systems run Matlab R2018b.

I have checked that the policy functions are the same, as well as the shocks, and the dynare_simul() function looks exactly identical to me. Any idea on what’s causing this problem?

P.S. I’ve also run the same code in dynare, the simulated moments are consistent from each other(and makes far more sense, too) across operating systems, but are different from any of the results I’m getting from dynare++.

This is really bugging me because I don’t know which set of results to trust. Any help is greatly appreciated!

Edit: The problem seems to be with centralizing. If I add the --no-centralize flag, all puzzle goes away. There might be a bug somewhere I guess.

Which Dynare++ version are you using? @sebastien might want to have a look at your code.

The latest one, 4.5.7. I can certainly share the code, just let me know how.

Have you compared the policy functions from the different systems? Are they the same? Put differently, does the issue come from dynare_simul of the model solution. That the --no-centralize flag makes the problem go away suggests that it is the latter. Could you maybe upload the results of Dynare++ from your different machines?

Sure I’ll have a look.

@jasontx You can post your mod file here, or send it by private email if you don’t want to disclose it publicly.

I agree with @jpfeifer that we need to isolate more precisely the component that is causing the discrepancies that you observe.

First, could you retry your comparison exercise, but making sure that the shocks drawn are the same across machines? This means that you should generate shocks.csv once and for all, and then use it on all the machines (instead of drawing new random shocks). Maybe the random number generators don’t give the same results across machines (even though you fixed the seed).

Second, I suggest that we focus on the dynare++ standalone executable. Since it is able to compute empirical means by itself, we could temporarily get rid of the MATLAB code and compare only the Dynare++ output. For example, I ran experiments such as:

dynare++ --per 1000 --burn 100 --sim 100 --seed 1 cc_total.mod

and compared the value of dyn_mean in the generated cc_total.mat file, when varying the value of --seed.

On the same machine, I got significant discrepancies in the empirical means, just by varying the seed, with and without the --no-centralize option. Maybe that just means that I should increase the number or the length of simulations, but it takes quite a lot of computational time and I can’t do it right now.

Could you possibly investigate a little in this direction, and report your findings?

1 Like