I’ve been trying to extend this 2014 JEDC by Fabio Milani
Which estimates a linear NK model with learning. I’ve tried to code the likelihood function as I interpret it and when maximizing using Matlab’s Fminunc routine gives me a Hessian whose inverse is not semi-positive definite, and therefore cannot be used for the proposal density in a Metropolis Hastings algorithm.
Have any others encountered a similar problem? I thought perhaps I could use the nearest Semi-positive definite matrix to the inverse hessian for the proposal density?
This is a very common problem. Have you tried using mode_compute=6 or 9?
I’ve not figured out how to estimate this particular model using dynare so I’ve tried to compute the likelihood function via the kalman filter myself in a separate file.
What do the 6th or 9th modes in Dynare do when faced with a non-PSD Hessian?
Sure, you could use https://git.dynare.org/Dynare/dynare/-/blob/master/matlab/chol_SE.m
However, problems with the Hessian often indicate deeper underlying issues, so forcing the Hessian to be positive definite may mask those issues.