# Error Replicating paper - Which Dynare version to use

**URL:** <https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001>\
**Category:** Replication Attempts\
**Created:** [14 June 2019 18:55 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001 "2019-06-14T18:55:54Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![bshaw](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/c2a13f/32.png) [@bshaw](https://forum.dynare.org/u/bshaw)\
**Post date:** [14 June 2019 18:55 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/1 "2019-06-14T18:55:54Z")

</div>

Hello everyone!

I am trying to replicate the results from the 2015 AER paper “Fiscal Volatility Shocks and Economic Activity”.

I noticed that the main\_code\_FGKR.mod file mentioned needing Dynare 4.4.3 to run. So I installed that version of Dynare and have received a number of error messages.

The most recent one is below:

The class ‘dates’ is used in its own class definition as a base class, property value, or attribute value. This is  
not allowed.

Error in dseries (line 84)  
ts.dates = dates();

Error in initialize\_dseries\_toolbox (line 66)  
dseries(‘initialize’);

Error in dynare\_config (line 252)  
initialize\_dseries\_toolbox;

Error in dynare (line 63)  
dynareroot = dynare\_config;

I ran the exact same thing yesterday, and haven’t changed anything on the .mod file or anything else, and received a different set of messages:

Attempt to execute SCRIPT k\_order\_perturbation as a function:  
C:\dynare\4.4.3\matlab\k\_order\_perturbation.m

Error in k\_order\_pert (line 64)  
[err, g\_0, g\_1, g\_2, g\_3] = k\_order\_perturbation(dr, …

Error in stochastic\_solvers (line 74)  
[dr,info] = k\_order\_pert(dr,M\_,options\_);

Error in resol (line 137)  
[dr,info] = stochastic\_solvers(dr,check\_flag,M,options,oo);

Error in stoch\_simul (line 88)  
[oo\_.dr,info,M\_,options\_,oo\_] = resol(0,M\_,options\_,oo\_);

Error in main\_code\_FGKR (line 699)  
info = stoch\_simul(var\_list\_);

Error in dynare (line 180)  
evalin(‘base’,fname) ;

I’ve also attempted using the most updated version of Dynare (4.5.7), and received yet another set of error messages here.

Running the .mod file today resulted in the same errors as running Dynare 4.4.3. I’ll copy this below

The class ‘dates’ is used in its own class definition as a base class, property value, or attribute value. This is  
not allowed.

Error in dseries (line 84)  
ts.dates = dates();

Error in initialize\_dseries\_toolbox (line 66)  
dseries(‘initialize’);

Error in dynare\_config (line 252)  
initialize\_dseries\_toolbox;

Error in dynare (line 63)  
dynareroot = dynare\_config;

However, yesterday, I received this series of errors.

Undefined function or variable ‘RunDynarePruning’.

Error in main\_code\_FGKR (line 724)  
outDynare = RunDynarePruning(optPruning,oo\_,M\_,f\_11);

Error in dynare (line 235)  
evalin(‘base’,fname) ;

I’ve attached the .mod file below. Any help with how to fix these errors would be much apprectiated.

Thanks!

[main\_code\_FGKR.mod](https://forum.dynare.org/uploads/short-url/3JHSDyih2f20BiOb93kauJT7OWx.mod) (21.8 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:** [15 June 2019 18:11 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/2 "2019-06-15T18:11:50Z")

</div>

You need to clean up your Matlab path. The error message about `dates` comes from a conflict between Dynare 4.4.3 and 4.5.7. The message about `RunDynarePruning` sounds like the Andreasen pruning toolkit is missing.

---

<div class="post-metadata">

**Author:** ![bshaw](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/c2a13f/32.png) [@bshaw](https://forum.dynare.org/u/bshaw)\
**Post date:** [17 June 2019 17:35 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/3 "2019-06-17T17:35:22Z")

</div>

Thanks. I’ve uninstalled both versions of dynare and reinstalled 4.5.7

I’ve added the .mod file to the matlab folder, and only added the matlab folder to the path. I tried re-running the mod file and received this error instead.

Using 64-bit preprocessor  
Starting Dynare (version 4.5.7).  
Starting preprocessing of the model file …  
ERROR: Could not open file: main\_code\_FGKR.mod

Error using dynare (line 229)  
DYNARE: preprocessing failed

---

<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:** [17 June 2019 18:50 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/4 "2019-06-17T18:50:49Z")

</div>

Is that the full error message? And could it be that your path is too long, i.e. the folder names?

---

<div class="post-metadata">

**Author:** ![bshaw](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/c2a13f/32.png) [@bshaw](https://forum.dynare.org/u/bshaw)\
**Post date:** [17 June 2019 19:01 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/5 "2019-06-17T19:01:02Z")

</div>

Yes, that was the full error message.

The path I was using was C:\dynare\4.5.7\matlab

Since then, I’ve found what looks like to be the correct pruning package at the link below

[https://sites.google.com/site/mandreasendk/home-1/Codes/Dynare44Pruning.zip?attredirects=0&d=1](https://sites.google.com/site/mandreasendk/home-1/Codes/Dynare44Pruning.zip?attredirects=0&d=1)

After uninstalling 4.5.7 and reinstalling 4.4.3, I downloaded this and added the subfolders to the C:\dynare\4.4.3\matlab directory.

Running the .mod file this way, I received a different set of errors.

Warning: Function isfile has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential  
name conflict.

> In path (line 109)  
> In addpath (line 86)  
> In dynare\_config (line 65)  
> In dynare (line 48)

and at the end, I also received this

Starting Dynare (version 4.4.3).  
Starting preprocessing of the model file …  
ERROR: Could not open file: main\_code\_FGKR.mod

Error using dynare (line 174)  
DYNARE: preprocessing failed

---

<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:** [17 June 2019 19:02 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/6 "2019-06-17T19:02:58Z")

</div>

I meant the path where the mod-file is located. The warning is something you can safely ignore.

---

<div class="post-metadata">

**Author:** ![bshaw](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/c2a13f/32.png) [@bshaw](https://forum.dynare.org/u/bshaw)\
**Post date:** [17 June 2019 19:04 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/7 "2019-06-17T19:04:02Z")

</div>

The mod file is also located in C:\dynare\4.4.3\matlab. Would this be a problem?

---

<div class="post-metadata">

**Author:** ![bshaw](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/c2a13f/32.png) [@bshaw](https://forum.dynare.org/u/bshaw)\
**Post date:** [19 June 2019 15:56 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/8 "2019-06-19T15:56:28Z")

</div>

I just noticed this in the code of the same .mod file

//addpath C:\Users\rnpag01\Dropbox\Pruning\_andreasen\_jesus\_juan\DynarePruning\simAndMoments3order ;  
//addpath C:\Users\meow\Dropbox\Pruning\_andreasen\_jesus\_juan\DynarePruning\simAndMoments3order ;  
//addpath(’/Users/rnpag01/Dropbox (Phil Research)/Pruning\_andreasen\_jesus\_juan/Dynare44Pruning/simAndMoments3order’) ;

Since this is referencing folders that do not exist on my computer, could this be causing the line 174 error mentioned above?

---

<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:** [21 June 2019 17:40 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/9 "2019-06-21T17:40:15Z")

</div>

It could well be that you do not have write permission in that folder. Please try a folder where you have such permissions for sure.

---

<div class="post-metadata">

**Author:** ![bshaw](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/c2a13f/32.png) [@bshaw](https://forum.dynare.org/u/bshaw)\
**Post date:** [21 June 2019 18:39 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/10 "2019-06-21T18:39:28Z")

</div>

I placed the .mod file in the following folder and added it to the path

C:\Users\bsbd3\Documents\Summer 2019

I have run the file and am no longer receiving the line 229 error, but now I have a different set of errors.

Using 64-bit preprocessor  
Starting Dynare (version 4.5.7).  
Starting preprocessing of the model file …  
Found 31 equation(s).  
Evaluating expressions…done  
Computing static model derivatives:

- order 1  
Computing dynamic model derivatives:
- order 1
- order 2
- order 3  
Processing outputs …  
done  
Preprocessing completed.

Undefined function or variable ‘RunDynarePruning’.

Error in main\_code\_FGKR (line 724)  
outDynare = RunDynarePruning(optPruning,oo\_,M\_,f\_11);

Error in dynare (line 235)  
evalin(‘base’,fname) ;

---

<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:** [21 June 2019 18:47 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/11 "2019-06-21T18:47:22Z")

</div>

This message now relates to you not providing the correct path to the Andreasen pruning toolkit.

---

<div class="post-metadata">

**Author:** ![bshaw](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/c2a13f/32.png) [@bshaw](https://forum.dynare.org/u/bshaw)\
**Post date:** [21 June 2019 19:00 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/12 "2019-06-21T19:00:30Z")

</div>

I’ve added that now, and it looks like the code is (finally) starting to run. I am however getting this message now.

Error using main\_code\_FGKR (line 856)  
‘smooth’ requires Curve Fitting Toolbox.

Error in dynare (line 235)  
evalin(‘base’,fname) ;

---

<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 June 2019 09:07 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/13 "2019-06-22T09:07:55Z")

</div>

As the message says: to run their code, you need Matlab’s Curve Fitting Toolbox.

---

<div class="post-metadata">

**Author:** ![bshaw](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/c2a13f/32.png) [@bshaw](https://forum.dynare.org/u/bshaw)\
**Post date:** [24 June 2019 17:00 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/14 "2019-06-24T17:00:16Z")

</div>

I’m working on downloading a trial of the Curve Fitting Toolbox. I’ve arrived at this screen, and am at a loss for which of these options is the correct one for what I need.

 ![Screenshot%20(1)](https://forum.dynare.org/uploads/default/original/2X/4/42275a916be58ee1171fb1459209e34efd3b40e6.png)

---

<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 June 2019 06:07 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/15 "2019-06-25T06:07:56Z")

</div>

It’s hard to tell which one is the right option. I would try the Data Science one.

---

<div class="post-metadata">

**Author:** ![bshaw](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/c2a13f/32.png) [@bshaw](https://forum.dynare.org/u/bshaw)\
**Post date:** [3 July 2019 21:13 UTC](https://forum.dynare.org/t/error-replicating-paper-which-dynare-version-to-use/14001/16 "2019-07-03T21:13:09Z")

</div>

Installing the Curve Fitting tool resolved the issue. I have the output now.
