Hello.
I am trying to apply the model of Gerali et al (2010) to China
I used mode_compute=4 for the estimation. However, I encountered the following error message.
data0915.mat (3.6 KB)
estszz0915.mod (25.5 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.”
I tried to use the estimated_params_init block, but it still failed.
So I use mode compute=6 instead. However, the estimated results do not converge, and the posterior distribution has multiple peaks.
This is true even if I select mh_replic=100000.
I don’t know what to do. Can someone help me?
I uploaded my mod files and data
Use the analytic_derivation
of estimation.
estszz0915.mod (26.1 KB)
I succeeded according to your advice, thank you so much!
Dear jpfeifer,
When mh_replic does not take 0, the following error still occurs:
Error using ==> chol
The matrix must be positive definite.
Error posterior_sampler_initialization (line 77)
d = chol(vv);
What is the reason for this and what should be done? Thank you
Did you change anything? It works on my machine and runs the MCMC.
Dear Jpfeifer
I am really sorry that I added an extra shock to the model, and it returned to normal after I corrected it.
In addition, I would like to ask what led to the error of “The matrix must be positive definite.” I made the same mistake again after adding other shocks.
Before you added the shock, there was simply a numerical problem in the computation of the Hessian using two-sided finite differences. Using an analytic point derivative solved the issue.
Dear Jpfeifer
I reduced the number of shocks and selected varobs as varobs qhrateobs cpiobs consobs porateobs;
There will be the following error:
Error using chol
Matrix must be positive definite with real diagonal.
Error in posterior_sampler_initialization (line 77)
d = chol(vv);
I tried all kinds of methods, but still no solution, I am very confused. I’m asking you to help me again.
It is also worth mentioning that I found that qhrateobs in varobs worked successfully when replaced with gdpobs.
Thank you so much!
data0915.mat (8.0 KB)
estszz0919.mod (25.3 KB)
From what I can see, the main issue is that the data mean of porateobs
does not match the steady state of the variable in the model.
Dear Jpfeifer
Thank you for helping me again and again.
I adjusted the porateobs and adjusted the estimated_params_init block value, but I found the mode check graph is strange, In particular, the variances of several shocks and the persistence parameters of interest rates. What is the reason for this?How should I modify it?
modecheck1.fig (2.9 MB)
modecheck2.fig (1.4 MB)
What do you mean with “strange”?