predict.mpr {mpr}R Documentation

Predict method for Multi-Parameter Regression (MPR) Fits

Description

Survival predictions based on mpr objects.

Usage

## S3 method for class 'mpr'
predict(object, newdata, type = c("survivor", "hazard", "percentile"),
        tvec, prob = 0.5, ...)

Arguments

object

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

newdata

data.frame in which to look for variables with which to predict.

type

type of prediction which may be a survivor function, hazard function or percentile value.

tvec

vector of times at which the predicted survivor or hazard function will be evaluated. Only required if type is "survivor" or "hazard".

prob

numeric value between 0 and 1 (i.e., probability) indicating the percentile to be predicted. By default prob = 0.5 which corresponds to the median value. Only required if type is "percentile".

...

further arguments passed to or from other methods.

Value

A matrix of predictions whose rows correspond to the rows of newdata. When type is "survivor" or "hazard", this matrix of predictions has columns corresponding to tvec. However, when type is "percentile", the matrix only has one column.

Author(s)

Kevin Burke.

See Also

mpr, summary.mpr

Examples

library(survival)

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

# predicted survivor function evaluated at four times
predict(mod1, newdata=data.frame(trt=c(1,2)), type="survivor",
        tvec=c(25, 50, 100, 150))

# predicted percentiles
predict(mod1, newdata=data.frame(trt=c(1,2)), type="percentile", prob=0.5)
predict(mod1, newdata=data.frame(trt=c(1,2)), type="percentile", prob=0.1)

# comparing predicted survivor functions to Kaplan-Meier curves
KM <- survfit(Surv(time, status) ~ trt, data=veteran)
plot(KM, col=1:2)
tvec <- seq(0, max(KM$time), length=100)
Stpred <- predict(mod1, newdata=data.frame(trt=c(1,2)), type="survivor",
                  tvec=tvec)
lines(tvec, Stpred[1,])
lines(tvec, Stpred[2,], col=2)

[Package mpr version 1.0.6 Index]