update.mpr {mpr} | R Documentation |
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 class 'mpr'
update(object, new, comp = 1:(object$ncomp), ...)
Arguments
object |
an object of class “ |
new |
either a one-sided |
comp |
a numeric vector indicating the regression component(s) to be updated (only needed when |
... |
additional arguments to be passed to the updated |
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
# Veterans' administration lung cancer data
veteran <- survival::veteran
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