I am trying to get the Std. errors of some estimators using the optim function. But when computing them using sqrt(diag(solve(ans$hessian))) I get an error that says... Lapack routine dgesv: system is exactly singular. Or sometimes I also get that system is computationally singular. When I check the Hessian matrix it has at least one column&row of mostly zeros. My estimators are really close to the true values so I dont know why the std. errors wont come out. Any ideas or suggestions on how to fix this?