Page 1 of 1

Error when trying to estimate a DSGE model

PostPosted: Thu Mar 08, 2012 11:58 am
by AndersE88
Hi,

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.

Re: Error when trying to estimate a DSGE model

PostPosted: Fri Mar 09, 2012 5:46 pm
by jpfeifer
It looks as if you are using
Code: Select all
estimation(datafile=dataest,prefilter=1,lik_init=1,mh-replic=1500000,mh_jscale=0.5,mode_check);

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.

Re: Error when trying to estimate a DSGE model

PostPosted: Mon Mar 12, 2012 10:13 am
by AndersE88
jpfeifer wrote:It looks as if you are using
Code: Select all
estimation(datafile=dataest,prefilter=1,lik_init=1,mh-replic=1500000,mh_jscale=0.5,mode_check);

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.


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?

Re: Error when trying to estimate a DSGE model

PostPosted: Mon Mar 12, 2012 11:32 am
by AndersE88
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.


STEADY-STATE RESULTS:

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
dQSA_PCPIJAEI 1
dQSA_PCPIJAEIMP 1
logQUA_QI44 0
dQSA_YMN 0
QUA_RN3M 0
dAUA_WILMN_PCT_Qr 0

EIGENVALUES:
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
initial_estimation_checks(xparam1,gend,data,data_index,number_of_observations,no_more_missing_observations);

Error in ==> dynare_estimation at 62
dynare_estimation_1(var_list,varargin{:});

Error in ==> nemo at 354
dynare_estimation(var_list_);

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


Anyone who can help? I'm attaching the mod-file

Re: Error when trying to estimate a DSGE model

PostPosted: Wed Mar 14, 2012 9:45 pm
by AndersE88
Can anyone help me?

Re: Error when trying to estimate a DSGE model

PostPosted: Wed Mar 14, 2012 11:08 pm
by jpfeifer
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.

Re: Error when trying to estimate a DSGE model

PostPosted: Sun Feb 28, 2016 11:49 pm
by lelos
Do you allow me a simple theoretical question please???

Why a demeaned data imply a zero steady state??

Many thanks

Re: Error when trying to estimate a DSGE model

PostPosted: Mon Feb 29, 2016 9:01 am
by jpfeifer
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.