Why do I get negative variance from hessian matrix in optim function
问题 I try to estimate mle parameters of a generalised gamma distribution. I use optim function with a lower bound equal to one (since parameters must be positive) and BFGS method. Initially, I estimate the log likelihood function as below: negloglikgengamma<-function(thet,dat) { alpha<-thet[1] kappa<-thet[2] lamda<-thet[3] -sum(dggamma(y,scale=alpha,shape1=kappa,shape2=lamda,log=T)) } I use minus log likelihood function in order to use "optim" and find the minimum. Then I use optim function.