Description Usage Arguments Details Value Author(s) See Also Examples

Applies a stepwise selection procedure to an object of class “`mpr`

” to find the best model
in the sense of AIC (or BIC).

1 2 3 |

`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. |

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.

A final “best” `mpr`

model as selected using the stepwise procedure.

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, ~.))
``` |

mpr documentation built on May 29, 2017, 9:03 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.