Reputation: 61
I run quasi-Poisson glm models in R and I want to compute AIC criterion. I run the code below but I am not sure if it is correct. Also, I find weird the fact that the AIC decreases while degrees of freedom increase.
fqaic <- function(model) {
loglik <- sum(dpois(model$y, model$fitted.values, log = TRUE))
phi <- summary(model)$dispersion
qaic <- -2*loglik + 2*summary(model)$df[3]*phi
return(qaic)
}
I would be grateful for any advice.
Upvotes: 1
Views: 3059
Reputation: 226332
There are some notes here, indicating that among other things that there are existing methods for computing qAIC in the bbmle
, AICcmodavg
, and MuMIn
packages. The correct formula for qAIC is
-2 * logLik/dispersion + 2 * df
Upvotes: 4