# Different Results under Different OS using dynare\_simul

**URL:** https://forum.dynare.org/t/different-results-under-different-os-using-dynare-simul/13288
**Category:** Dynare++
**Created:** [19 February 2019 22:00 UTC](https://forum.dynare.org/t/different-results-under-different-os-using-dynare-simul/13288 "2019-02-19T22:00:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jasontx](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/f1d935/32.png) [@jasontx](https://forum.dynare.org/u/jasontx)
#### Post date: [19 February 2019 22:00 UTC](https://forum.dynare.org/t/different-results-under-different-os-using-dynare-simul/13288/1 "2019-02-19T22:00:47Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)
#### Post date: [22 February 2019 10:27 UTC](https://forum.dynare.org/t/different-results-under-different-os-using-dynare-simul/13288/2 "2019-02-22T10:27:28Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jasontx](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/f1d935/32.png) [@jasontx](https://forum.dynare.org/u/jasontx)
#### Post date: [22 February 2019 13:10 UTC](https://forum.dynare.org/t/different-results-under-different-os-using-dynare-simul/13288/3 "2019-02-22T13:10:47Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)
#### Post date: [22 February 2019 13:27 UTC](https://forum.dynare.org/t/different-results-under-different-os-using-dynare-simul/13288/4 "2019-02-22T13:27:01Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![sebastien](https://forum.dynare.org/user_avatar/forum.dynare.org/sebastien/32/19973_2.png) [@sebastien](https://forum.dynare.org/u/sebastien)
#### Post date: [25 February 2019 17:51 UTC](https://forum.dynare.org/t/different-results-under-different-os-using-dynare-simul/13288/5 "2019-02-25T17:51:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sebastien](https://forum.dynare.org/user_avatar/forum.dynare.org/sebastien/32/19973_2.png) [@sebastien](https://forum.dynare.org/u/sebastien)
#### Post date: [8 March 2019 17:36 UTC](https://forum.dynare.org/t/different-results-under-different-os-using-dynare-simul/13288/6 "2019-03-08T17:36:37Z")

</div>

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:

```auto
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?
