# Simulation error dynare 5.0

**URL:** <https://forum.dynare.org/t/simulation-error-dynare-5-0/19874>\
**Category:** Dynare++\
**Created:** [24 February 2022 20:00 UTC](https://forum.dynare.org/t/simulation-error-dynare-5-0/19874 "2022-02-24T20:00:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgomezr](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/c4cdca/32.png) [@mgomezr](https://forum.dynare.org/u/mgomezr)\
**Post date:** [24 February 2022 20:00 UTC](https://forum.dynare.org/t/simulation-error-dynare-5-0/19874/1 "2022-02-24T20:00:02Z")

</div>

Hi,

I’ve been trying to replicate Table 3 of Croce (2014) using the code provide by the author, but when I tried to simulate the series with the following code:

```auto
per = 840; %number of simulated months
n = 100; %number of simulations

load Approx_10.mat;

shocks = zeros(2,per)./0; % put NaNs everywhere
r = zeros(28,per,n);

for i=1:n
    r(:,:,i) = dynare_simul('Approx_10.mat',shocks);
end

```

I received the error:

**Error using dynare\_simul\_**  
**dynare\_simul\_ must have at exactly 12 input parameters and 1 output argument.**

**Error in dynare\_simul (line 171)**  
**[err,r]=dynare\_simul\_(order-1,nstat,npred,nboth,nforw,…**

**Error in croce2014table3 (line 20)**  
\*\* r(:,:,i) = dynare\_simul(‘Approx\_10.mat’,shocks);\*\*

I “solve” the problem editing **dynare\_simul.m** in the following way:

```auto
[err,r]=dynare_simul_(order-1,nstat,npred,nboth,nforw,...
    nexog,ystart,shocks,vcov_exo,seed,ss,dr);

if err
    error('Simulation failed')

```

for

```auto
% call dynare_simul_
[r]=dynare_simul_(order-1,nstat,npred,nboth,nforw,...
    nexog,ystart,shocks,vcov_exo,seed,ss,dr);

%if err
   % error('Simulation failed')

```

My questions: is this affecting my results? Are there another way to avoid the problem? Also I’m using dynare 5.0.

[Approx\_10.mod](https://forum.dynare.org/uploads/short-url/tmiC5lQw3tgxXHZZrHokU5hEPau.mod) (4.5 KB)

---

<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:** [25 February 2022 08:28 UTC](https://forum.dynare.org/t/simulation-error-dynare-5-0/19874/2 "2022-02-25T08:28:07Z")

</div>

I would not use Dynare++, but go directly for Dynare 5.0:  
[Approx\_10.mod](https://forum.dynare.org/uploads/short-url/zkzTAA6UC1QSQlzKgleG0sFHdbo.mod) (4.7 KB)

---

<div class="post-metadata">

**Author:** ![mgomezr](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/c4cdca/32.png) [@mgomezr](https://forum.dynare.org/u/mgomezr)\
**Post date:** [25 February 2022 18:20 UTC](https://forum.dynare.org/t/simulation-error-dynare-5-0/19874/3 "2022-02-25T18:20:51Z")

</div>

But the author uses explicitly Dynare++, this change won’t affect the results?

---

<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:** [25 February 2022 19:12 UTC](https://forum.dynare.org/t/simulation-error-dynare-5-0/19874/4 "2022-02-25T19:12:16Z")

</div>

If you want to be sure to obtain the same results as the original authors, you need to use the same Dynare++ version. If you want to have correct results in the sense of the lower number of bugs potentially affecting the results, use Dynare 5.0.
