Compute Models by Adding One Term - Generic Function
DESCRIPTION:
Returns information on models that have one more term than the
given object.
This function is an S Version 3 generic (see Methods);
method functions can be written to handle specific
S Version 3 classes of data. Classes which already
have methods for this function include:
lm
.
USAGE:
add1(object, scope, ...)
REQUIRED ARGUMENTS:
object
a fitted model, which in some sense represents some but not all possible
terms.
scope
a description of the range of new terms to add.
In the case of linear models and related models,
this is given by a formula.
VALUE:
an object representing some or all of the information got by fitting
each of the models formed by adding a term from
scope to the original
model in
object.
DETAILS:
The main (currently only) method for this is
add1.lm, which produces
an
anova object.
Other kinds of models could use different methods for summarizing the
additional fits and, possibly, different classes of objects to represent
the result.
SEE ALSO:
,
,
,
.
EXAMPLES:
# consider all interactions of terms in lm.object for inclusion
add1(lm.object, ~ .^2)
glm.object <- glm(Kyphosis ~ bs(Start, 5) + Number, family = binomial,
data = kyphosis)
# try some candidate transformations for Age.
add1(glm.object, ~ . -Age + poly(Age,2) + log(Age) + sqrt(Age))