
This function is generic; there exist methods for classes lm
and
glm
and the default method will work for many other classes.
addterm(object, ...)## S3 method for class 'default':
addterm(object, scope, scale = 0, test = c("none", "Chisq"),
k = 2, sorted = FALSE, trace = FALSE, ...)
## S3 method for class 'lm':
addterm(object, scope, scale = 0, test = c("none", "Chisq", "F"),
k = 2, sorted = FALSE, ...)
## S3 method for class 'glm':
addterm(object, scope, scale = 0, test = c("none", "Chisq", "F"),
k = 2, sorted = FALSE, trace = FALSE, ...)
lm
, aov
and glm
models. Specifying scale
asserts that the residual standard error or dispersion is known.lm
and aov
models,
and perhaps for some over-dispersed glm
models. The
Chisq test can be an exact test (k=2
gives the genuine AIC: k = log(n)
is sometimes referred
to as BIC or SBC.TRUE
additional information may be given on the fits as they are tried."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.lm
models with specified scale) the constant is taken
to be that used in Mallows' Cp statistic and the results are labelled
accordingly.dropterm
, stepAIC
quine.hi <- aov(log(Days + 2.5) ~ .^4, quine)
quine.lo <- aov(log(Days+2.5) ~ 1, quine)
addterm(quine.lo, quine.hi, test="F")
house.glm0 <- glm(Freq ~ Infl*Type*Cont + Sat, family=poisson,
data=housing)
addterm(house.glm0, ~. + Sat:(Infl+Type+Cont), test="Chisq")
house.glm1 <- update(house.glm0, . ~ . + Sat*(Infl+Type+Cont))
addterm(house.glm1, ~. + Sat:(Infl+Type+Cont)^2, test = "Chisq")
Run the code above in your browser using DataLab