Search code examples
rlog-likelihood

How can I estimate standard error in maximum likelihood destinati in


I can’t estimate standard error for parametri in maximum likelihood estimation. How could I do?


Solution

  • You have to evaluate the Hessian to estimate standard error for a parameter

    fit = optim(start.theta, fn = function,    #start.theta initial value of paramter
                        hessian = TRUE, method = "L-BFGS-B",     #hessian True to calculate Hessian matrix
                        lower = c(), 
                        upper = c(),
                        control = list(trace = 1, fnscale = -1))  #fnscale= -1 to maximize the function
    
    
    
            theta.hat = fit$par                 #parameter estimate
            sd.hat = sqrt(diag(solve(fit$hessian/(n-1))))  #se estimate
               # you could use also optimHess to evaluate the Hessian