Bayesian estimation:Error using chol


I am a beginner in DSGE. When using Bayesian estimation, the following problem occurred, and I didn’t know how to change it. I have provided the model and the associated parameters. I would appreciate a friend who could help me find my mistakes and fix them.The following error message is displayed in MATLAB:

Error using chol
Matrix must be positive

Error in gmhmaxlik_core (line 194)
dd = transpose(chol(CovJump));

Error in gmhmaxlik (line 100)
[PostMode, PostVariance, Scale, PostMean] = gmhmaxlik_core(fun, OldPostMode, bounds, gmhmaxlikOptions, Scale, flag, MeanPar, OldPostVariance, varargin{:});

Error in dynare_minimize_objective (line 336 )
[opt_par_values, hessian_mat, Scale, fval] = gmhmaxlik(objective_function, start_par_value, …

Error in dynare_estimation_1 (line 221)
[xparam1, fval, exitflag, hh, options_, Scale, new_rat_hess_info] = dynare_minimize_objective(objective_function,xparam1,options_.mode_compute,options_,[ bounds.ub],,bayestopt_,hh,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);

Error in dynare_estimation (line 118)

Error in mit_base1.driver (line 1759)

Error in dynare (line 281)
evalin(‘base’,[fname ‘.driver’]); (21.7 KB)

How come your Y_obs hardly fluctuates, while C_obs does. The latter has a 100 times bigger standard deviation.

First of all, thank you very much for your help!
According to your guidance, I found a problem with the data processing of the C_obs . after I corrected it, this estimate can work normally, thank you very much for your guidance, good luck!

Hello, sorry to bother you again, my Y_obs has been seasonally adjusted, logarithmic, and one-side HP filtered. The last time you pointed out the problem with the C_obs, I adjusted it in the same way as the Y data, but I got the same error again. Hope you can help me find the problem and the solution, thank you very much for your help.
model (22.2 KB)

I think your data treatment for inflation and the interest rate is wrong. It seems the net and gross concepts in the data and the model do not match.