Update and Re-fit a Multi-Parameter Regression (MPR) Model Call

Share:

Description

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

Usage

1
2
## S3 method for class '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 = λ, “2 = γ and “3 = ρ. For more information on the various components, see mpr and distributions.

...

additional arguments to be passed to the updated mpr call.

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

Value

The fitted, updated mpr object.

Author(s)

Kevin Burke.

See Also

mpr, addterm, dropterm, stepmpr.

Examples

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