How to interpret this error message?

Dear Dynare helpers,

I have been debugging this large-scale DSGE model for two days, but the job is not fruitful yet. I am wondering if this error message could provide me some hint?

I have used model diagnostic command but it says no obvious error is detected.

It seems to me the main problem is that the estimated capital share is constantly pushed to the lower bound of priors. I think there is probably a problem with the model itself. Would you think the problem is most likely in one of the equations or the steady state relationships with the parameter? Or more loosely related, the F.O.C’s for investment and capital, etc?

And the parameter risk aversion is low compared to commonly calibrated values, although within its bound.

I have also attached my code here, but you don’t really have to provide me an exact answer, because it seems to be a model-related issue, and I understand that this is not your responsibility. I am just wondering if somehow I can narrow my scope of debugging, or if there are problems which I might have overlooked. If you can offer some debugging skills it would have been better.

I have a closed economy version which works well (it is almost the same as Smets Wouters 07), but it seems not easy to reduce my model gradually to that model, because the relative prices connect everything together.

Posterior_Generation.mod (35.5 KB)
data.mat (57.5 KB)
Posterior_Generation_mode.mat (23.1 KB)

POSTERIOR KERNEL OPTIMIZATION PROBLEM!
(minus) the hessian matrix at the “mode” is not positive definite!
=> posterior variance of the estimated parameters are not positive.
You should try to change the initial values of the parameters using
the estimated_params_init block, or use another optimization routine.

The following parameters are at the prior bound: calfa
Some potential solutions are:

  • Check your model for mistakes.
  • Check whether model and data are consistent (correct observation equation).
  • Shut off prior_trunc.
  • Change the optimization bounds.
  • Use a different mode_compute like 6 or 9.
  • Check whether the parameters estimated are identified.
  • Check prior shape (e.g. Inf density at bound(s)).
  • Increase the informativeness of the prior.
    Warning: The results below are most likely wrong!

In dynare_estimation_1 (line 316)
In dynare_estimation (line 105)
In Posterior_Generation (line 1372)
In dynare (line 235)

MODE CHECK

Fval obtained by the minimization routine (minus the posterior/likelihood)): 749.390684
Most negative variance -1489.654462 for parameter 2 (eb = 0.173789)
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.

In dynare_estimation_1 (line 339)
In dynare_estimation (line 105)
In Posterior_Generation (line 1372)
In dynare (line 235)

Error using chol
Matrix must be positive definite with real diagonal.

Error in posterior_sampler_initialization (line 84)
d = chol(vv);

Error in posterior_sampler (line 60)
posterior_sampler_initialization(TargetFun, xparam1, vv, mh_bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);

Error in dynare_estimation_1 (line 448)
posterior_sampler(objective_function,posterior_sampler_options.proposal_distribution,xparam1,posterior_sampler_options,bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);

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

Error in Posterior_Generation (line 1341)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 235)
evalin(‘base’,fname) ;

Best

Jing

Based on your mode, I ran mode_compute=5. With the file
Posterior_Generation_mode.mat (26.6 KB)
the mode_check plots like quite good. The only issue is cprobp being at the lower bound. You need to find out why and maybe adjust your prior.

Thanks a lot! I didn’t know that changing the mode compute could change the results too.
I’ll have a try

With your help, I have finally got the result. And many looks much better than those obtained by mode compute 4.

Thanks again!

Dear jpfeifer,

As you also know, cprobp (Calvo parameter) was low despite a successful estimation, so I kept on debugging. Today I found out a small mistake in the wage-setting equation and ran the corrected code again. Now I am not sure if my current estimation is successful at all. The estimation seemed to run smoothly but there is a red warning poping-up after in the very end. Is my estimation successful? What does the warning mean and is it a matter of concern? If yes, what should I do to get rid of it?

A second question is that my data for hours worked is demeaned, and the measurement equation is, of course, labobs = lab + constelab. So I would expect “constelab” to be around zero. But the mode is around 3. How could this happen?

Posterior_Generation.mod (35.5 KB)
data.mat (57.5 KB)
Posterior_Generation_mode.mat (27.2 KB)

Best

Jing

What is the warning?

It looked like the same warning which I posted at the top, as last time.

From “Error using chol
Matrix must be positive definite with real diagonal.” onwards

That means your estimation again has problems. You may want to again check for errors and try different mode-finders.

OK. Could this kind of problem be related to the choice of priors?

Not really. If it’s only about mode-finding, then that may help. If there is something more fundamental, then not.

Thanks. It seems like a disaster. I will debug again.

I could find the posterior distribution with optimizer 6, without any error message. But I don’t know if that error message by optimizer 5 still is a sign of some error in my model. Anyway, I will check again.