stepmpr {mpr} | R Documentation |
Stepwise Selection Procedure for Multi-Parameter Regression (MPR) Models
Description
Applies a stepwise selection procedure to an object of class “mpr
” to find the best model
in the sense of AIC (or BIC).
Usage
stepmpr(object, scope = list(lower = ~ 1, upper = ~ .),
comp = 1:(object$ncomp), direction = c("both", "backward", "forward"),
joint = TRUE, jointonly = FALSE, aic = TRUE, trace = 3, ...)
Arguments
object |
an object of class “ |
scope |
either a single formula defining the |
comp |
a numeric vector indicating the regression component(s) to which the selection procedure should be
applied. Note that “ |
direction |
the mode of stepwise search, which can be one of |
joint |
logical. If |
jointonly |
logical. If |
aic |
logical. If |
trace |
if positive, information is printed during the running of |
... |
additional arguments to be passed to internal methods. |
Details
The function stepmpr
uses repeated calls to addterm
and
dropterm
and is based on the idea that variable selection should be applied to
each component individually and to all components jointly (when joint = TRUE
). As an example,
consider the case where forward selection (direction = "forward"
) will be carried out in components
1 and 2 individually (comp = 1:2
) and jointly (joint = TRUE
). At a given iteration of
the algorithm, the following single-term additions are then carried out:
- individual step
1
: -
each term currently absent from component 1 will be considered.
- individual step
2
: -
each term currently absent from component 2 will be considered.
- joint step
1&2
: -
each term currently absent from both components 1 and 2 will be considered.
The reason for the joint step is to account for the possibility that a covariate may only appear significant
when it is present simultaneously in both regression components. This situation can arise as the
variance-covariance matrix for the estimated regression coefficients is typically not block diagonal with
respect to the regression components and, in particular, coefficients for the same covariate in
different components are typically highly correlated. Of course, the stepmpr
function has the
flexibility to carry individual steps only, joint steps only or individual steps in a particular component
only as the end user prefers. See “Examples” below.
The set of models searched is determined by the scope
argument which is either a single
upper
formula or a list whose elements are lower
and upper
formulae. The
upper
formula must contain each formula corresponding to the components under
consideration (as indicated by comp
) whereas the lower
formula must be contained
within each of these formulae. For more information on the use of lower
and upper
, see
addterm
.
If scope
is missing, the lower
model is simply the null model (i.e., a model with no
covariates) and the upper
model is formed using terms from the initial model; specifically,
all terms from the regession components under consideration (as indicated by comp
) are used
in the upper
formula.
Value
A final “best” mpr
model as selected using the stepwise procedure.
Author(s)
Kevin Burke.
See Also
mpr
, dropterm
, addterm
, update.mpr
.
Examples
# Veterans' administration lung cancer data
veteran <- survival::veteran
head(veteran)
#######
mod0 <- mpr(Surv(time, status) ~ 1, data=veteran)
mod0 # family = "Weibull" by default
# the "upper" model formula (by default the lower will be ~ 1)
scope <- ~ trt + celltype
stepmpr(mod0, scope)
stepmpr(mod0, scope, direction="forward", aic=FALSE)
# individual steps only
stepmpr(mod0, scope, joint=FALSE)
# joint steps only
stepmpr(mod0, scope, jointonly=TRUE)
# component 1 only (and, hence, only individual steps)
stepmpr(mod0, scope, comp=1)
#######
mod1 <- mpr(Surv(time, status) ~ trt + celltype, data=veteran)
mod1
stepmpr(mod1)
stepmpr(mod1, scope = ~ .^2)
# "lower" model formula forces trt to stay in
stepmpr(mod1, scope = list(~trt, ~.))