Bayesian Estimation error

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!

Please provide the files to replicate the issue.

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!

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

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” sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf.

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?

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!

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