Skip to content
Prev 12047 / 398503 Next

GLM model selection

On Fri, 29 Jun 2001, Antonio Olinto wrote:

            
for selecting GLM models with gamma error distribution and log link function.

Look at
function (fit, scale = 0, k = 2, ...)
{
    n <- length(fit$residuals)
    edf <- n - fit$df.residual
    aic <- fit$aic
    c(edf, aic + (k - 2) * edf)
}

which uses the aic value from
function (y, n, mu, wt, dev)
{
    n <- sum(wt)
    disp <- dev/n
    -2 * sum(dgamma(y, 1/disp, mu * disp, log = TRUE) * wt) +
        2
}

That's not the correct AIC with unknown scale, since the scale estimate is
not the MLE.
gamma distribution phi (scale?) is not constant. Also in step( ) help page is
written that "there is a potential problem in using glm fits with a variable
scale as in that case the deviance is not simply related to the maximized
log-likelihood".
best way to perform the selection?

You could rewrite the AIC to use the MLE for the scale and the correct
formulae.