I'm using stepwise removal of variable for a glm using drop1.
From model 1, I am dropping the variable with the lowest AIC as required producing model 2.
However, when I then compare the AIC of the two the AIC of model 1 is lower and the AIC reported from drop1
for model2 and the AIC reported from AIC()
are different.
I'm confused why these AICs for the same model from drop1()
and AIC()
and how to go about model selection given this?
Thanks
m1 <- glm(abundance ~ treatment + land_use + patch_size, data=df)
drop1(m1, test="F")
m2 <- glm(abundance ~ treatment + land_use, data=df)
AIC(m1)
AIC(m2) ##this AIC varies from that reported in drop1() and is higher than AIC(m1)
The
drop1
function usesextractAIC
to get the AIC, while theAIC
function uses a different additive constant. See the Details section of?extractAIC
, specifically this paragraph:However, as it goes on to say:
So in other words, you could implement your own
drop1
function usingAIC
, and you'd get the same differences between the AICs of the various submodels and the AIC of the full model that you do with the built-indrop1
.