Bayesian Estimation error

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Bayesian Estimation error

Postby bayes » Sun Mar 29, 2015 12:42 am

Hi! When I try to estimate my model (log-linearized by hand before) I get the following error message:

STEADY: The Jacobian contains Inf or NaN. The problem arises from:

Attempt to reference field of non-structure array.

Error in display_problematic_vars_Jacobian (line 39)
aux_vars_type = [M_.aux_vars.type];

Error in dynare_solve (line 56)
display_problematic_vars_Jacobian(infrow,infcol,M,x,'static','STEADY: ')

Error in evaluate_steady_state (line 194)
[ys,check] = dynare_solve([M.fname '_static'],...

Error in dynare_estimation_init (line 513)
[oo_.steady_state, params] = evaluate_steady_state(oo_.steady_state,M,options_,oo_,steadystate_check_flag);

Error in dynare_estimation_1 (line 94)
[dataset_, dataset_info, xparam1, hh, M_, options_, oo_, estim_params_, bayestopt_, bounds] = ...

Error in dynare_estimation (line 91)
dynare_estimation_1(var_list,dname);

Error in baseLTVest (line 513)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 185)
evalin('base',fname) ;

*********************************************
The model could be simulated before and steady-state could be computed using calibrated parameters. What does this error warning mean? Is it an indication that something with my priors is possibly wrong? Or could it be a bug in Dynare?
I used one-sided HP filter for variables with a trend.

Thank you!
bayes
 
Posts: 14
Joined: Thu Jan 22, 2015 9:45 am

Re: Bayesian Estimation error

Postby jpfeifer » Sun Mar 29, 2015 9:24 am

Please provide the files to replicate the issue.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Bayesian Estimation error

Postby bayes » Sun Mar 29, 2015 1:00 pm

Here is the mod-file and the data I used. I generally followed the procedure described in the User guide and the Guide to observation equations, but it looks like I did something wrong..
Thank you for your help!
Last edited by bayes on Mon Apr 06, 2015 10:16 pm, edited 1 time in total.
bayes
 
Posts: 14
Joined: Thu Jan 22, 2015 9:45 am

Re: Bayesian Estimation error

Postby jpfeifer » Mon Mar 30, 2015 8:25 am

Try to execute the Matlab code before the model block (you will need to replace the // comments with % comments). When doing so, you will see that when computing
Code: Select all
kappa = (1-theta)*(1-beta*theta)/theta;

that theta is not defined.

Moreover, your estimation routine looks incorrect due the steady state not being correctly updated. After running estimation, Dynare will update the estimated parameters but not take any dependence into account that you did not specify. Rather, your calibration only once updates the other parameters depending on the estimated one. That’s why you should use model-local variables (the ones with the pound operator) or a steady state file. See Remark 4 (Parameter dependence and the use of model-local variables) in Pfeifer(2013): "A Guide to Specifying Observation Equations for the Estimation of DSGE Models" https://sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Bayesian Estimation error

Postby bayes » Mon Mar 30, 2015 3:26 pm

Thank you! I changed that steady-state parameters to model-local variables, but then I got an error message:

Error using chol
Matrix must be positive definite

Is it then a Problem of my Priors or possibly of the data?
bayes
 
Posts: 14
Joined: Thu Jan 22, 2015 9:45 am

Re: Bayesian Estimation error

Postby bayes » Mon Mar 30, 2015 4:00 pm

And second question - I Need a hint on how to write a steady-state Matlab file to this model. Should I just paste the steady-state parameters that I have now as model-local variables in the steady-state file? (following the procedure in the example file NK_baseline)?
I would prefer to have a separate steady-state file rather than model-local variables, but I'm confused about how I should proceed. Or is it necessary for that to completely rewrite the model?

Thank you in advance!
bayes
 
Posts: 14
Joined: Thu Jan 22, 2015 9:45 am

Re: Bayesian Estimation error

Postby jpfeifer » Thu Apr 02, 2015 8:50 am

Your model is linear, so there is no point in having a separate steady state file. Thus, I would recommend using model-local variables as it is faster. If you want to have a steady state file, you need to manually set all model variables within the steady state file to 0 (their steady state value). For the general structure, just follow the NK_baseline_steady_state.m
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 10 guests