Bugfix (?) for positive definiteness failure

As Dynare 4 is now the main version, this forum is now closed. Please, post
on the Dynare Help forum
Forum rules
As Dynare 4 is the current Dynare version, there forum is now close. Post new question in the Dynare Help Forum.

Bugfix (?) for positive definiteness failure

Postby JamieHall » Fri Mar 06, 2009 3:45 am

Hi everyone!

Once in a while, you may get a failure of positive definitness at line 52 of metropolis_hastings_initialization, on "d = chol(vv);".

This can be caused, I think, when you have an unidentified parameter that has a weak gamma prior. But it also happens sometimes when you use newrat (option mode_compute=5), because mr_hessian returns a complex-valued Hessian matrix. I haven't been able to figure out why that happens, but here is a workaround that seems to paper over the problem succesfully. In dynare_estimation, just after line 410, insert these lines:
Code: Select all
if(any(any(~isreal(hh))))
      if ~options_.bvar_dsge
         hh = reshape(hessian('DsgeLikelihood',xparam1,gend,data),nx,nx);
      else
         hh = reshape(hessian('DsgeVarLikelihood',xparam1,gend),nx,nx);
      end
   end


...so that Dynare will fall back to the standard Hessian estimator if newrat's doesn't work.


cheerio
Jamie
JamieHall
 
Posts: 20
Joined: Wed Feb 11, 2009 4:42 am

Re: Bugfix (?) for positive definiteness failure

Postby reluginbuhl » Fri Mar 06, 2009 7:50 am

I believe that I also am experiencing crashes due to this problem. I want to try using your fix, but cannot find line 410 in dynare.estimation.m. There are not that many lines of code in this file. I would guess that you are not using the most recent subversion? Assuming this to be the case I have added your fix after line 421 in the file dynare_estimation_1.m. Unfortunately, this did not solve my problem. (So perhaps I have not put the patch in the right place?)

What is my problem? I ran RBC_Datagen.mod from \doc\userguide\models which comes with dynare. Then I attempted to run RBC_Est.mod. This results in the following error message:

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.
??? Error using ==> dynare_estimation_1
I cannot go further!

Error in ==> dynare_estimation at 57
dynare_estimation_1(var_list,varargin{:});

Error in ==> RBC_Est at 128
dynare_estimation(var_list_);

Error in ==> dynare at 102
evalin('base',fname) ;

I think this should be of interest to the makers of Dynare. Their program at least ought to work for the examples they provide with the software. Note: I do not get an error message using the previous subversion of version 4 provided I alter the code in dynare_estimation.m from line 980, which was

eval(['oo_.UpdatedVariables.' deblank(M_.endo_names(dr.order_var(i),:)) ...
' = updated variables(i,:)'';']);

into the following

eval(['oo_.UpdatedVariables.' deblank(M_.endo_names(dr.order_var(i),:)) ...
' = updated_variables(i,:)'';']);
reluginbuhl
 
Posts: 53
Joined: Wed Mar 04, 2009 2:41 pm

Re: Bugfix (?) for positive definiteness failure

Postby StephaneAdjemian » Fri Mar 06, 2009 9:29 am

Hi, we recently changed dynare (in the trunk of our subversion repository, I did not change the 4.0 branche) so that when minus the hessian matrix at the estimated mode is not positive-definite dynare stops. In previous version dynare (in dynare 4.0.x) we sligthly change the hessian matrix so that minus the hessian becomes positive definite... But there is no true rational for this transformation. When you get this error message it means that your estimated mode is not the mode of the posterior kernel. In this case you have to find another estimate of the mode (by changing the optimization routine or the initial conditions. The problem may be related to the shape of the priors also).

Best,
Stéphane.
Stéphane Adjemian
Université du Maine, GAINS and DynareTeam
https://stepan.adjemian.eu
StephaneAdjemian
 
Posts: 429
Joined: Wed Jan 05, 2005 4:24 pm
Location: Paris, France.

Re: Bugfix (?) for positive definiteness failure

Postby JamieHall » Sun Mar 08, 2009 9:16 pm

Yes, quite. But I would have sworn that mr_hessian also generates this error when newrat has genuinely found the mode (as evidenced by the mode_check plots and the posterior marginals). I don't mean to diss newrat, though --- the problem is probably in my model somewhere...
JamieHall
 
Posts: 20
Joined: Wed Feb 11, 2009 4:42 am


Return to Dynare version 4

Who is online

Users browsing this forum: No registered users and 2 guests