I wrote the following code to estimate a model by Christiano, Eichenbaum, and Evans (2005), but I keep getting the same error:

“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. Warning: The results below are most likely wrong!”,

followed by:

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

If I set “compute_mode=6”, the code runs for a long time, but the results don’t seem correct. I have tried changing the prior distributions multiple times, but it doesn’t seem to make a difference. Where am I going wrong?

CEE_model.zip (88.7 KB)