Try All One-Term Deletions from a Model
Try fitting all models that differ from the current model by dropping a single term, maintaining marginality.
This function is generic; there exist methods for classes
glm and the default method will work for many other classes.
dropterm (object, ...)
## S3 method for class 'default': dropterm(object, scope, scale = 0, test = c("none", "Chisq"), k = 2, sorted = FALSE, trace = FALSE, ...)
## S3 method for class 'lm': dropterm(object, scope, scale = 0, test = c("none", "Chisq", "F"), k = 2, sorted = FALSE, ...)
## S3 method for class 'glm': dropterm(object, scope, scale = 0, test = c("none", "Chisq", "F"), k = 2, sorted = FALSE, trace = FALSE, ...)
- A object fitted by some model-fitting function.
- a formula giving terms which might be dropped. By default, the model formula. Only terms that can be dropped and maintain marginality are actually tried.
- used in the definition of the AIC statistic for selecting the models,
currently only for
scaleasserts that the residual standard error or dispersion is known.
- should the results include a test statistic relative to the original
model? The F test is only appropriate for
aovmodels, and perhaps for some over-dispersed
glmmodels. The Chisq test can be an exact test (
- the multiple of the number of degrees of freedom used for the penalty.
k = 2gives the genuine AIC:
k = log(n)is sometimes referred to as BIC or SBC.
- should the results be sorted on the value of AIC?
TRUEadditional information may be given on the fits as they are tried.
- arguments passed to or from other methods.
The definition of AIC is only up to an additive constant: when
lm models with specified scale) the constant is taken
to be that used in Mallows' Cp statistic and the results are labelled
- A table of class
"anova"containing at least columns for the change in degrees of freedom and AIC (or Cp) for the models. Some methods will give further information, for example sums of squares, deviances, log-likelihoods and test statistics.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.
quine.hi <- aov(log(Days + 2.5) ~ .^4, quine) quine.nxt <- update(quine.hi, . ~ . - Eth:Sex:Age:Lrn) dropterm(quine.nxt, test= "F") quine.stp <- stepAIC(quine.nxt, scope = list(upper = ~Eth*Sex*Age*Lrn, lower = ~1), trace = FALSE) dropterm(quine.stp, test = "F") quine.3 <- update(quine.stp, . ~ . - Eth:Age:Lrn) dropterm(quine.3, test = "F") quine.4 <- update(quine.3, . ~ . - Eth:Age) dropterm(quine.4, test = "F") quine.5 <- update(quine.4, . ~ . - Age:Lrn) dropterm(quine.5, test = "F") house.glm0 <- glm(Freq ~ Infl*Type*Cont + Sat, family=poisson, data = housing) house.glm1 <- update(house.glm0, . ~ . + Sat*(Infl+Type+Cont)) dropterm(house.glm1, test = "Chisq")