MATLAB: Problematic SE with fminunc

fminunchessin

Hi I am trying to estimate a discrete choice mixed (logit) model.
The mle (via maximum simulated lik) converges but my standard errors are imaginary. (with fewer simulations I get NaN sometimes).
I use: ihess=inv(hessian); stderr=sqrt(diag(ihess));
The hessian has some columns of zeroes and also negative numbers.
My questions are: 1. What could be causing the imaginary errors? 2. Is there some fix?

Best Answer

If the hessian has columns of zeros, then it is only semi-definite. NOT positive definite. So it is not invertible.
Negative numbers in a Hessian are NOT a problem, as long as the MATRIX as a whole is positive definite (think positive eigenvalues.) You don't have that.
There are linear combinations of your variables that yield the same MLE function value, at least a one-dimensional subspace of your parameters has that property.
The EIG or SVD decomposition of your hessian will tell you what that subspace is.