Error when trying to estimate a DSGE model


I’m trying to reproduce the results of an estimation of a DSGE model. I’ve got the .mod file and the data set in a .mat file and everything I’m supposed to need to run the estimation.

I’ve installed matlab and dynare and I’m able to run a simulation of the examples that come along with dynare. To do this I start with setting the path: file-set path-add folder: c:\dynare\4.2.4\matlab then i type the command: “cd C:\dynare\4.2.4\examples” an then the command: “dynare example1” and the simulation works fine.

But when I try to estimate the DSGE model(with bayesian maximum likelihodd, and I’ve got the priors) I’m getting an error. I upload the folder where the files are and I type the command: “estimation(datafile=dataest,prefilter=1,lik_init=1,mh-replic=1500000,mh_jscale=0.5,mode_check);” which is the command used by he who created the .mod file and who’s results I’m supposed to reproduce.

Then I get the error: ??? estimation(datafile=dataest,prefilter=1,lik_init=1,mh-replic=1500000,mh_jscale=0.5,mode_check);
Error: The expression to the left of the equals sign is not a valid target for an assignment. (It’s pointing to the equal sign datafile=dataest, where dataest is the .mat file with the dataset)

Can anyone help me figure out what I’m doing wrong?

Thanks, Anders.

It looks as if you are using

as a Matlab command. This won’t work. The statement only works when embedded into a Dynare mod-file that is processed by the preprocessor.

[quote=“jpfeifer”]It looks as if you are using

as a Matlab command. This won’t work. The statement only works when embedded into a Dynare mod-file that is processed by the preprocessor.[/quote]

OK thanks for the reply. Thats right, I’ve used it as a Matlab command, but it’s also embedded in the mod-file. How can I then estimate the model, which command do I use?

I’ve tried to run the command: dynare nemo (nemo is the mod-file), but for some reason I thought this was not right. Then I get som kind if result:

dynare nemo

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.

Starting Dynare (version 4.2.4).
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
    Processing outputs …done
    Preprocessing completed.
    Starting MATLAB/Octave computing.


y 0
C 0
CH 0
CF 0
CH_f 0
C_f 0
r 0
rf 0
bf 0
z_y 0
z_u 0
z_r 0
z_b 0
pi 0
pih 0
pif 0
pif_f 0
ph 0
pf 0
w 0
Q 0
N 0
vepsHhat 0
vepsFhat 0
G 0
logQUA_QI44 0

Modulus Real Imaginary

           0               -0                0
  3.751e-018      -3.751e-018                0
  1.478e-016      -1.478e-016                0
  2.631e-016      -2.631e-016                0
         0.5              0.5                0
         0.5              0.5                0
         0.5              0.5                0
         0.5              0.5                0
         0.5              0.5                0
         0.5              0.5                0
         0.5              0.5                0
         0.5              0.5                0
         0.5              0.5                0
      0.5889           0.4873           0.3306
      0.5889           0.4873          -0.3306
      0.6456           0.5553           0.3292
      0.6456           0.5553          -0.3292
      0.6837           0.6837                0
      0.9956           0.9956                0
       1.011            1.011                0
       1.149            1.149                0
        1.97             1.97                0
       2.496            2.496                0
         Inf              Inf                0
         Inf              Inf                0
         Inf              Inf                0

There are 7 eigenvalue(s) larger than 1 in modulus
for 7 forward-looking variable(s)

The rank condition is verified.

You did not declare endogenous variables after the estimation command.
This version of Dynare cannot estimate non linearized models!
Set “order” equal to 1.

Loading 75 observations from dataest.mat

You are trying to estimate a model with a non zero steady state for the observed endogenous
variables using demeaned data!
??? Error using ==> initial_estimation_checks at 107
You should change something in your mod file…

Error in ==> dynare_estimation_1 at 122

Error in ==> dynare_estimation at 62

Error in ==> nemo at 354

Error in ==> dynare at 120
evalin(‘base’,fname) ;

Anyone who can help? I’m attaching the mod-file
nemo.mod (8.16 KB)

Can anyone help me?

As the error message says, two of your variables do not have steady state 0. Rather, dQSA_PCPIJAEI and dQSA_PCPIJAEIMP have steady state 1. But when you use prefilter=1, the data are demeaned and thus always have steady state 0. This is inconsistent with their theoretical counterparts in the model that have a steady state value of 1.

Do you allow me a simple theoretical question please???

Why a demeaned data imply a zero steady state??

Many thanks

If your process is ergodic and no Jensen’s Inequality effects are present (e.g. at first order), then the mean will coincide with the deterministic steady state.