Error Replicating paper - Which Dynare version to use

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 (21.8 KB)

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.

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

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

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

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

1 Like

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

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

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?

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.

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) ;

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

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) ;

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

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.

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

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