Closed okenk closed 1 year ago
I am just using what {sdmTMB} reports. Here is the code
extractAIC.sdmTMB <- function(fit, scale, k = 2, ...) {
L <- logLik(fit)
edf <- attr(L, "df")
return(c(edf, c(-2 * L + k * edf)))
}
which can be found here.
Ahh, I see the problem. It is my fault 😮💨 . I am labeling the log likelihood as the "NLL" or negative log likelihood, which is incorrect. @okenk would you prefer that I fix the label or fix the value?
I changed the value to match the NLL label. Please feel free to reopen the issue if you would like the log likelihood to be saved instead.
Is there an existing issue for this?
Current Behavior
Current AIC values reported in aic_nll.txt are negative. AIC be positive though since NLL is positive. Formula is 2 n_pars - 2 loglikelihood
Note -2 loglikelihood. If using NLL (from optimization) formula is 2 n_pars PLUS 2 NLL
Expected Behavior
AIC should generally be positive.
Steps To Reproduce
No response
Environment
Anything else?
No response