predict_survreg: Predictions from Parametric Survival Models

Description Usage Arguments Value Note Examples

Description

Predicts survival or quantiles from Parametric Survival Models that were fitted using survreg. Unlike with predict.survreg.penal, predictions are population averages (i.e. the frailty effect is fixed at its mean). The confidence bounds of the predictions are determined using nonparametric bootstrap resampling.

Usage

1
2
3
predict_survreg(model, data, strata = NULL, type = "quantile",
  quantiles = c(0.5, 0.1), times = NULL, conf.int = NULL, R = 500,
  parallel = "no", ncpus = NULL, ...)

Arguments

model

An object of class survreg.

data

The data used to fit model.

strata

The name of the variable in data that should be used as strata by boot. (It seems to be a good idea to use the frailty variable as strata.)

type

A character string: one of c("quantile", "survival").

quantiles

A numeric vector of survival quantiles for which the times are predicted.

times

A numeric vector of survival times for which the survival percentage should be predicted.

conf.int

NULL or numeric vector of length one giving the desired confidence level.

R

The number of bootstrap replicates. Passed to boot.

parallel

Passed to boot.

ncpus

Passed to boot.

...

Further arguments passed to boot.

Value

A list with one element per predictor level combination that contains a data frame with one row and columns for the predictors, and a one or three column matrix (point prediction, lower and upper confidence limit). For each desired time / survival quantile, one row in the matrix is returned.

Note

Predictions are returned for all levels of all predictors (quantitative predictors not tested yet).

Unlike boot, if ncpus = NULL and parallel != "no" all but one or two CPU are used on UNIX-Systems and on other platforms, respectively.

Examples

1
2
3
4
5
6
7
8
intS2 <- with(MIC, create_int2Surv(concentration, inhibition))
psm <- survival::survreg(as.formula("intS2 ~ region +
 frailty(herd, sparse = FALSE)"), data = cbind(intS2, MIC))
predict_survreg(psm, data = cbind(intS2, MIC), strata = "herd",
 conf.int = 0.95, parallel = "snow")
predict_survreg(psm, data = cbind(intS2, MIC), strata = "herd",
 type = "survival", times = c(0.5, 1), conf.int = 0.95, parallel = "snow")
rm(psm, intS2)

VZoche-Golob/AFTtools documentation built on May 9, 2019, 9:42 p.m.