mpr (version 1.0.5)

update.mpr: Update and Re-fit a Multi-Parameter Regression (MPR) Model Call

Description

Updates the right-hand side of the formula and re-fits the mpr model.

Usage

# S3 method for mpr
update(object, new, comp = 1:(object$ncomp), ...)

Arguments

object

an object of class “mpr” which is the result of a call to mpr.

new

either a one-sided formula (in which case the comp argument is also required) or a list of one-sided formula objects whose length is equal to the number of regression components in the mpr object, e.g., the Weibull model has two components.

comp

a numeric vector indicating the regression component(s) to be updated (only needed when new is a one-sided formula) where “1” \( = \lambda\), “2” \( = \gamma\) and “3” \( = \rho\). For more information on the various components, see mpr and distributions.

additional arguments to be passed to the updated mpr call.

Value

The fitted, updated mpr object.

Details

There are two ways in whcih the update.mpr function can be used. The first specificies which component(s) will be updated (via the comp argument) along with the update to be applied via new which must then be a one-sided formula. The second approach specifies both the components in question and the updates to be applied through new which is a list of one-sided formula objects (in this case comp is ignored). See “Examples” below.

In the new formula (or list of formulae) . means “what is already there”.

See Also

mpr, addterm, dropterm, stepmpr.

Examples

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

# Weibull MPR treatment model
mod1 <- mpr(Surv(time, status) ~ list(~ trt, ~ trt), data=veteran,
            family="Weibull")

# remove trt from first component
update(mod1, ~ . - trt, comp=1)
update(mod1, list(~ . - trt, ~ .))

# remove trt from both components
update(mod1, ~ . - trt, comp=1:2)
update(mod1, list(~ . - trt, ~ . - trt))

# add celltype to second component
update(mod1, ~ . + celltype, comp=2)
update(mod1, list(~ . , ~ . + celltype))

# simultaneously remove trt from first component and add celltype to second
# component. This is only possible using the approach where "new" is a list. 
update(mod1, list(~ . - trt, ~ . + celltype))

# can also update other things, e.g. "family"
update(mod1, ~ ., family="Gompertz")
update(mod1, ~ . + celltype, family="Loglogistic")

mod2 <- update(mod1, ~ ., family="Burr") # change to Burr model
mod2
update(mod2, ~ . + celltype, comp=2:3) # add celltype to components 2 and 3
# }

Run the code above in your browser using DataLab