Description Usage Arguments Value Author(s) See Also Examples
Survival predictions based on mpr
objects.
1 2 3 |
object |
an object of class “ |
newdata |
|
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 |
prob |
numeric value between 0 and 1 (i.e., probability) indicating the percentile to be predicted. By
default |
... |
further arguments passed to or from other methods. |
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.
Kevin Burke.
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 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.