mpr (version 1.0.5)

# addterm: 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 “mpr” which is the result of a call to mpr.

upper

a one-sided formula (used in addterm) specifying a maximal model which must include the current one.

lower

a one-sided formula (used in dropterm) specifying a minimal model which must be within the current one.

comp

a numeric value (or vector) indicating the regression component (or components) where (simultaneous) additions / deletions occur. Note that “1” $$= \lambda$$, “2” $$= \gamma$$ and “3” $$= \rho$$. For more information on the various components, see mpr and distributions.

aic

logical. If TRUE, AIC is used as the basis for determining the best model among those considered. If FALSE, BIC is used.

bestmodel

an initial best model which, by default, is the supplied current model. This argument is used within the stepmpr function but is unlikely to be used directly by the end user.

additional arguments to be passed to internal methods.

## Value

A list containing the following components:

modeltab

a table containing information about each of the fitted models. This information comes from the “model” element of each of the mpr objects - see mpr for details.

bestmodel

the model with the lowest AIC (or BIC if aic = FALSE) among the fitted models including the initial bestmodel passed to the addterm / dropterm function.

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

mpr, stepmpr, update.mpr.

## Examples

# NOT RUN {
# Veterans' administration lung cancer data
data(veteran, package="survival")

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