# Negative Hessian matrix in R optim [closed]

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?

• Typically, you want to maximize the log likelihood (which is a concave function) rather than minimizing it. – Brian Borchers Dec 31 '13 at 5:38
• 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.. – lsheng Dec 31 '13 at 6:01
• Have you tried to change your initial values when applying optim? – Stat Dec 31 '13 at 19:32
• 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.. – lsheng Jan 6 '14 at 2:46
• I think it is sometimes just about luck to get it run... – lsheng Jan 6 '14 at 2:47