Description Usage Arguments Details Value Author(s) See Also Examples
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.
1 2 3 4 5 |
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. |
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.
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 |
Kevin Burke.
mpr, stepmpr, update.mpr.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.