I used the optim() function in R to find the min log likelihood, however the diagonal elements of the inverse of Hessian matrix turned out to be negative.

> round(diag(solve(KFopt$hessian)),2)
[1]    0.00   -0.08   -0.03    0.00   -0.47   -0.18 -167.32

Does that mean the optimization is wrong? So what should I do if I want to extract standard deviation of each estimates?

  • 1
    $\begingroup$ Typically, you want to maximize the log likelihood (which is a concave function) rather than minimizing it. $\endgroup$ Dec 31 '13 at 5:38
  • $\begingroup$ I already coded the function as negative log likelihood, then I put optim(psi,fn = function,...) to minimize (negative log likelihood), I think it should be correct.. $\endgroup$
    – lsheng
    Dec 31 '13 at 6:01
  • $\begingroup$ Have you tried to change your initial values when applying optim? $\endgroup$
    – Stat
    Dec 31 '13 at 19:32
  • $\begingroup$ I did, and sometimes it did work. But I don't think it is robust enough... Occasionally it works for a while but no longer works for same set of initial values.. $\endgroup$
    – lsheng
    Jan 6 '14 at 2:46
  • $\begingroup$ I think it is sometimes just about luck to get it run... $\endgroup$
    – lsheng
    Jan 6 '14 at 2:47