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

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

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

Postby dean0504 » Sat Jun 13, 2015 2:17 pm

Hi Guys! I know this is a very often discussed topic here. However, I used
Code: Select all
mode_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.
Attachments
Spain.zip
(12.94 KiB) Downloaded 377 times
dean0504
 
Posts: 25
Joined: Mon Jan 04, 2010 8:10 am

Re: Problem of ??? Error using ==> chol Matrix must be posit

Postby jpfeifer » Sat Jun 13, 2015 3:02 pm

Please read Pfeifer(2013): "A Guide to Specifying Observation Equations for the Estimation of DSGE Models" https://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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem of ??? Error using ==> chol Matrix must be posit

Postby dean0504 » Sun Jun 14, 2015 8:01 am

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!
Attachments
Spain_estimation.mod
(13.66 KiB) Downloaded 161 times
dean0504
 
Posts: 25
Joined: Mon Jan 04, 2010 8:10 am

Re: Problem of ??? Error using ==> chol Matrix must be posit

Postby jpfeifer » Sun Jun 14, 2015 11:42 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem of ??? Error using ==> chol Matrix must be posit

Postby dean0504 » Sat Jul 04, 2015 4:05 pm

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
Code: Select all
estimated_params_init
is included, but the code still does not work. Anything I am wrong? Please advice. Thanks!
Attachments
Spain.zip
(12.69 KiB) Downloaded 117 times
dean0504
 
Posts: 25
Joined: Mon Jan 04, 2010 8:10 am

Re: Problem of ??? Error using ==> chol Matrix must be posit

Postby jpfeifer » Mon Jul 06, 2015 3:16 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem of ??? Error using ==> chol Matrix must be posit

Postby dean0504 » Wed Jul 08, 2015 5:41 pm

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.
Attachments
Spain.zip
(12.72 KiB) Downloaded 139 times
dean0504
 
Posts: 25
Joined: Mon Jan 04, 2010 8:10 am

Re: Problem of ??? Error using ==> chol Matrix must be posit

Postby jpfeifer » Wed Jul 08, 2015 6:34 pm

Please either provide the error message.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem of ??? Error using ==> chol Matrix must be posit

Postby dean0504 » Wed Jul 08, 2015 10:10 pm

Hi, here comes the error message.
Code: Select all
??? 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) ;
.

Thanks in advance. This is the model I would like to use for my Phd thesis, so it is very important for me.
dean0504
 
Posts: 25
Joined: Mon Jan 04, 2010 8:10 am

Re: Problem of ??? Error using ==> chol Matrix must be posit

Postby jpfeifer » Thu Jul 09, 2015 6:20 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem of ??? Error using ==> chol Matrix must be posit

Postby dean0504 » Fri Jul 10, 2015 1:32 pm

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!
dean0504
 
Posts: 25
Joined: Mon Jan 04, 2010 8:10 am

Re: Problem of ??? Error using ==> chol Matrix must be posit

Postby jpfeifer » Sat Jul 11, 2015 8:03 am

Oscillating IRFs are caused by complex eigenvalues. They are often due to a timing problem in the model or some very strange parameter values.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 7 guests