Problem of ? Error using ==> chol Matrix must be positive

Hi Guys! I know this is a very often discussed topic here. However, I usedmode_compute=6, the code still crashed. I am wondering could anyone help me to figure out how this problem happened? My data are detrended by HP filter. Thanks.
Spain.zip (12.9 KB)

Please read Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models” sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf. You are for example neglecting parameter dependence. Also, you are not supposed to use an HP-filter.

Thanks Johannes! I fixed the dependence parameter problem. But I found that if I estimate all the parameters which are used to calculate dependence parameters, the model will crash. If I only estimate a few of them (except bet, del, alph1,aph2), the model can run. Is it because I only have 18 years’ annual data? By the way, after log the observed data, why cannot I use HP filter to do the 0 zero detrend? Thanks!
Spain_estimation.mod (13.7 KB)

Your biggest problem is that many of the parameters you try to estimate are not identified given your observables. Run the identification command to see this.

Regarding the HP filter, see the Remark on non-causal filters in the linked document.

Hi Johannes! My code still crashes when I run the Bayesian estimation. The information shown is as follows:

**Error in computing likelihood for initial parameter values

ESTIMATION_CHECKS: There was an error in computing the likelihood for initial parameter values.
ESTIMATION_CHECKS: You should try using the calibrated version of the model as starting values. To do
ESTIMATION_CHECKS: this, add an empty estimated_params_init-block with use_calibration option immediately before the estimation
ESTIMATION_CHECKS: command (and after the estimated_params-block so that it does not get overwritten):

misuse print_info (line 100)
Likelihood is a complex number**

I think I fixed the identification issue and it seems there is no parameters hit the bound. The code estimated_params_init is included, but the code still does not work. Anything I am wrong? Please advice. Thanks!
Spain.zip (12.7 KB)

For some reason the Lyapunov equation for your model cannot be solved. That is, the covariance matrix of the state variables is not positive definite. Run model_diagnostics to see that there is still a problem with your setup.

Hi Johannes! I revised the code. Now all the parameters can be identified and the rank condition is verified. There is no further information after I used the diagnostic order. But the code still crashed. Any suggestions? Thanks in advance.
Spain.zip (12.7 KB)

Please either provide the error message.

Hi, here comes the error message.

[code]??? Error using ==> chol
Matrix must be positive definite.
Error in ==> gmhmaxlik at 197
dd = transpose(chol(CovJump));
Error in ==> dynare_estimation_1 (line 437)
[xparam1,PostVar,Scale,PostMean] = …

Error in ==> dynare_estimation (line 89)
dynare_estimation_1(var_list,dname);

Error in ==> Spain_estimation_notrend (line 721)
dynare_estimation(var_list_);

Error in ==> dynare (line 180)
evalin(‘base’,fname) ;
[/code].

Thanks in advance. This is the model I would like to use for my Phd thesis, so it is very important for me.

It seems there is a problem with mode-finding. Take a look at the mode_check plots and try to understand why the mode is not at the peak of the posterior.

Hi Johannes! Thanks for your help. Now the model could run. I have a question which is not related to the code, but to the result. I think most of IRFs should be very smooth with a significant trend. However, my IRFs show like waves with up and down decreasing fluctuations. Is this normal? Could this be caused by the values of parameters? Maybe this is a very general question, but I do appreciated any suggestions from you. Thanks!

Oscillating IRFs are caused by complex eigenvalues. They are often due to a timing problem in the model or some very strange parameter values.

Dear Prof. Pfeifer,

Can you specify how to run the identification command? I mean, can you give the syntax for the identification command? I am just a rookie.

Thank you,
Alex

Simply add

identification;

In such straightforward cases, please consult the Dynare manual first.

Thank you Prof. Pfeifer for your help. Alex