These are support for the functions
add1.lm,
drop1.lm and
step.glm.
OPTIONAL ARGUMENTS:
terms1
the terms object for the base model, or the formula corresponding to it.
terms2
the terms object (or formula) for the upper scope
for
add.scope, or the lower scope for
drop.scope.
factor
the
"factor" attribute of
terms1
scope
a list with two components;
$add or
$drop which are the
factor attributes corresponding to upper and lower scope terms objects.
Either can be missing.
VALUE:
A character vector of term labels is returned by
add.scope,
which are all the terms in
terms2, but not in
terms1,
that can be separately added to
terms1.
This last provision ensures that the hierarchical nature of the model is
preserved; e.g., third order interactions will only be added if
their second order marginals are present.
Similarly,
drop.scope returns all the term labels that can be
dropped from
term1, except for those in
terms2, and likewise
maintaining the hierarchy.
factor.scope is support for the first two, and uses the factor
attributes of the terms to efficiently establish the valid labels.
SEE ALSO:
,
,
.
EXAMPLES:
add.scope( ~ a + b + c + a:b, ~ (a + b + c)^3)
# [1] "a:c" "b:c"
drop.scope( ~ a + b + c + a:b)
# [1] "c" "a:b"