The R documentation for either does not shed much light. All that I can get from this link is that using either one should be fine. What I do not get is why they are not equal.
Fact: The stepwise regression function in R, step()
uses extractAIC()
.
Interestingly, running a lm()
model and a glm()
'null' model (only the intercept) on the 'mtcars' data set of R gives different results for AIC
and extractAIC()
.
> null.glm = glm(mtcars$mpg~1)
> null.lm = lm(mtcars$mpg~1)
> AIC(null.glm)
[1] 208.7555
> AIC(null.lm)
[1] 208.7555
> extractAIC(null.glm)
[1] 1.0000 208.7555
> extractAIC(null.lm)
[1] 1.0000 115.9434
It is weird, given that both the models above are the same, and AIC()
gives the same results for both.
Can anyone throw some light on the issue?