# stepmpr: Stepwise Selection Procedure for Multi-Parameter Regression... In mpr: Multi-Parameter Regression (MPR)

## 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

 ```1 2 3``` ```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 “`mpr`” which is the result of a call to `mpr`. `scope` either a single formula defining the `upper` (maximal) model or a list containing two formulae - the `lower` (minimal) and `upper` (maximal) models respectively. See “Details” for further information. `comp` a numeric vector indicating the regression component(s) to which the selection procedure should be applied. Note that “`1`” = λ, “`2`” = γ and “`3`” = ρ. For more information on the various components, see `mpr` and `distributions`. `direction` the mode of stepwise search, which can be one of `"both"`, `"backward"`, or `"forward"`, with a default of `"both"`. `joint` logical. If `TRUE`, the selection procedure carries out joint component (i.e., simultaneous) steps in addition to individual component steps. If `FALSE`, only individual component steps are carried out. See “Details” for more information. `jointonly` logical. If `TRUE`, the selection procedure only carries out joint component steps. `aic` logical. If `TRUE`, AIC is used as the basis for determining the best model among those considered. If `FALSE`, BIC is used. `trace` if positive, information is printed during the running of `stepmpr`. Larger values may give more detailed information. `...` 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.

`mpr`, `dropterm`, `addterm`, `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 27 28 29 30 31 32``` ```# Veterans' administration lung cancer data data(veteran, package="survival") 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, ~.)) ```