2

I'm using a maximum likelihood estimation and I'm using the optim() function in R in a similar way as follows:

optim(c(phi,phi2, lambda), objf, method = "L-BFGS-B", lower = c(-1.5, -1.5, 0), upper = c(1.5, 1.5, 1), model = model_gaussian)

where objf is the function to estimate parameters given as:

objf <- function(pars, model, estimate = TRUE) {

model$T[is.na(model$T)] <- pars[c(1,2,3)] 

 if (estimate) {
-logLik(model)
} else {
model
}
}

(The model$T given above is for the KFAS package)

Now, I would like to obtain the standard errors (in order to calculate t-stats) for the parameters I am estimating. However, apparently since this optimisation is a constrained maximum likelihood estimation (due to the "L-BFGS-B") I cannot use the Hessian matrix to obtain standard errors since it would not be mathematically correct, so this means I can't just add hessian=TRUE to the optim line.

For example, if I were using the BFGS(which is not restricted/constrained) rather than the L-BFGS-B method, to find standard errors is pretty simple:

opt <- optim(c(phi,phi2, lambda), objf, method = "L-BFGS-B", lower = c(-1.5, -1.5, 0), upper = c(1.5, 1.5, 1), model = model_gaussian, hessian = TRUE)
standarderrors <- sqrt(abs(diag(solve(-opt$hessian))))

For this reason I thought I'd ask: what's the best way to obtain standard errors for my problem? What is the appropriate method to going about doing it? Thanks in advance.

  • 1
    Unless your boundaries excluded the ML values of the parameters, I think you can still use the Hessian to obtain standard errors. Alternative methods could be bootstrap or jackknife. – matteo Dec 11 '18 at 22:32
  • @matteo I see, I thought for constrained MLE the Hessian matrix had issues so I was a bit concerned, especially since (at times) the standard errors obtained were very large. I'll look into it a bit more, thanks! – ThePlowKing Dec 11 '18 at 22:57

0 Answers0