Problem with mode_compute=5


When I use mode_compute=5, it fails at the end on some models. The problem probably is rather simple for someone who knows the code. Here’s what I know so far:

  • The DsgeLikelihood_hh.m file fails because the variable LIK does not exist.
  • LIK does not exist because kalman_algo=2, and it has to be 1 or 3 for LIK to be define.
  • kalman_algo=2 only at of maximisation which leads me to believe the problem should have a quick fix.

Unfortunately, I don’t know what kalman_algo refers to, so I don’t what to meddle that far inside the code…


This is the error message:

??? Undefined function or variable “LIK”.

Error in ==> DsgeLikelihood_hh at 225
if imag(LIK) ~= 0

Error in ==> mr_hessian at 35
[f0, ff0]=feval(func,x,varargin{:});

Error in ==> newrat at 188
[dum, gg, htol0, igg, hhg]=mr_hessian(func_hh,xparam1,flagit,htol,varargin{:});

Error in ==> dynare_estimation at 407
[xparam1,hh,gg,fval,invhess] = newrat(‘DsgeLikelihood’,xparam1,hh,gg,igg,crit,nit,flag,gend,data);

Error in ==> mixte2p at 462

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

Hi again, so far I added this little fix, but I have no idea if I’m messing things up or not. It seems to work, but if someone who knows what the kalman_algo does could tell me if it’s ok, I would greatly appreciate. Thanks.

This is what I did:
In file DsgeLikelihood_hh.m, I replaced all instances of “options_.kalman_algo” with “kalman_algo”, then at line 191 (after the “% 4. Likelihood evaluation” comment), I inserted the folowing:
if options_.kalman_algo == 1 || options_.kalman_algo == 2
kalman_algo = 1;
kalman_algo = 3;