I am trying to understand the stopping point of StepAIC(). When using direction = 'backward', does it stop if any further deletion of the terms no longer decreases model AIC? Example as follows:
fm<- lm(mpg ~ ., data = mtcars)
require(MASS)
fit_fm <- stepAIC(fm, direction = 'backward')
#The final step stopped at:
Step: AIC=61.31
mpg ~ wt + qsec + am
Df Sum of Sq RSS AIC
<none> 169 61.3
- am 1 26.2 195 63.9
- qsec 1 109.0 278 75.2
- wt 1 183.3 353 82.8
Does this mean deleting any of the terms wt, qsec, or am will not decrease model AIC at all (i.e., all AICs=61.31)?
Yes, that's right. You can check this yourself (the second value from
extractAIC()is the AIC):Note that the values returned by
extractAIC()are different from those returned byAIC()in base R, but the differences between model AICs (which is all we really care about) are the same: