addterm {mpr} | R Documentation |
All Possible Single-Term Additions to / Deletions from a Multi-Parameter Regression (MPR) Model
Description
Identifies all models which arise via single-term additions to / deletions from a
component (or, simultaneously, multiple components) of the supplied mpr
model, fits all such
models and summarises these models in a table.
Usage
addterm(object, upper = ~ ., comp = 1:(object$ncomp),
aic = TRUE, bestmodel = object, ...)
dropterm(object, lower = ~ 1, comp = 1:(object$ncomp),
aic = TRUE, bestmodel = object, ...)
Arguments
object |
an object of class “ |
upper |
a one-sided |
lower |
a one-sided |
comp |
a numeric value (or vector) indicating the regression component (or components) where (simultaneous)
additions / deletions occur. Note that “ |
aic |
logical. If |
bestmodel |
an initial best model which, by default, is the supplied current model. This argument is used within the
|
... |
additional arguments to be passed to internal methods. |
Details
The hierarchy is respected when considering terms to be added or dropped, e.g., all main effects contained in a second-order interaction must remain.
When using addterm
, the terms in the upper
model formula must be a superset
of the terms for each regression component indicated by comp
. For example, if component
1 is ~ a + b + c
and component 2 is ~ a + b
(and terms are to be added to both
simultaneously, i.e., comp=1:2
),
then upper = ~ a + b + c + d
is acceptable and means that the variable
d
will be added simultaneously to components 1 and 2 (this can be written more compactly as
upper = ~ . + d
). On the other hand, ~ a + b + d
is not acceptable since its terms do
not form a superset of the terms in component 1 (however, this would be acceptable if we were only
considering component 2, i.e., if comp=2
).
When using dropterm
, the terms in the lower
model formula must be a subset
of the terms for each regression component indicated by comp
. Again, if component 1 is
~ a + b + c
and component 2 is ~ a + b
(and terms are to be dropped from both
simultaneously, i.e., comp=1:2
), then lower = ~ a
is
acceptable and means that the variable b
will be dropped simultaneously from components 1 and 2
(this can be written more compactly as lower = ~ . - b
). On the other hand, ~ c
is not
acceptable since its terms do not form a subset of the terms in component 2 (however, this would be
acceptable if we were only considering component 1, i.e., if comp=1
).
To summarise the above two paragraphs, the upper
formula must contain each formula
corresponding to the components under consideration whereas the lower
formula must be
contained within each of these formulae.
Value
A list
containing the following components:
modeltab |
a table containing information about each of the fitted models. This information comes from the
“ |
bestmodel |
the model with the lowest AIC (or BIC if |
Author(s)
Kevin Burke.
See Also
mpr
, stepmpr
, update.mpr
.
Examples
# Veterans' administration lung cancer data
veteran <- survival::veteran
head(veteran)
# null model
mod1 <- mpr(Surv(time, status) ~ list(~ 1, ~ 1), data=veteran)
mod1 # family = "Weibull" by default
# consider adding trt and celltype to component 1
addterm(mod1, ~ trt + celltype, comp=1)
# consider adding trt and celltype to components 1 and 2 simultaneously
addterm(mod1, ~ trt + celltype, comp=1:2)$modeltab
# further examples
mod2 <- mpr(Surv(time, status) ~ list(~ trt + celltype, ~ trt + karno),
data=veteran)
dropterm(mod2, ~ 1, comp=1:2)$modeltab
dropterm(mod2, ~ 1, comp=1)$modeltab
dropterm(mod2, ~ 1, comp=2)$modeltab
# does nothing since celltype is only in component 1
dropterm(mod2, ~ . - celltype, comp=1:2)$modeltab
# removes celltype from component 1
dropterm(mod2, ~ . - celltype, comp=1)$modeltab