Learn R Programming

dynpred (version 0.1.2)

pe: Calculate prediction error curve

Description

Calculate prediction error curve.

Usage

pe(time, status, tsurv, survmat, tcens, censmat, FUN = c("KL", "Brier"), tout)
pecox(formula, censformula, data, censdata, FUN = c("KL", "Brier"), tout, CV = FALSE, progress = FALSE)

Arguments

time
Vector of time points in data
status
Vector of event indicators in data
tsurv
Vector of time points corresponding to the estimated survival probabilities in survmat
survmat
Matrix of estimated survival probabilities; dimension should be length of tsurv x length of time
tcens
Vector of time points corresponding to the estimated censoring probabilities in censmat
censmat
Matrix of estimated censoring probabilities; dimension should be length of tcens x length of time
FUN
The error function, either "KL" (default) for Kullback-Leibler or "Brier" for Brier score
tout
Vector of time points at which to evaluate prediction error. If missing, prediction error will be evaluated at all time points where the estimate will change value
formula
Formula for prediction model to be used as in coxph
censformula
Formula for censoring model, also to be used as in coxph
data
Data set in which to interpret formula
censdata
Data set in which to interpret censformula
CV
Boolean (default=FALSE); if TRUE, (leave-one-out) cross-validation is used for the survival probabilities
progress
Boolean (default=FALSE); if TRUE, progress is printed on screen

Value

A data frame with columns
time
Event time points
Err
Prediction error of model specified by formula at these time points

Details

The censformula is used to calculate inverse probability of censoring weights (IPCW).

References

Graf E, Schmoor C, Sauerbrei W & Schumacher M (1999), Assessment and comparison of prognostic classification schemes for survival data, Statistics in Medicine 18, 2529-2545.

Gerds & Schumacher (2006), Consistent estimation of the expected Brier score in general survival models with right-censored event times, Biometrical Journal 48, 1029-1040.

van Houwelingen HC, Putter H (2012). Dynamic Prediction in Clinical Survival Analysis. Chapman & Hall.

Examples

Run this code
data(ova)
# Example on a subset, because the effect of CV is clearer
ova2 <- ova[1:100,]
pecox(Surv(tyears, d) ~ Karn + Broders + FIGO + Ascites + Diam, Surv(tyears, 1-d) ~ 1,
  data = ova2, FUN="Brier", tout=seq(0,6,by=0.5))
pecox(Surv(tyears, d) ~ Karn + Broders + FIGO + Ascites + Diam, Surv(tyears, 1-d) ~ 1,
  data = ova2, FUN="Brier", tout=seq(0,6,by=0.5), CV=TRUE, progress=TRUE)


pecox(Surv(tyears, d) ~ Karn + Broders + FIGO + Ascites + Diam, Surv(tyears, 1-d) ~ 1,
  data = ova, FUN="Brier", tout=seq(0,6,by=0.5))
pecox(Surv(tyears, d) ~ Karn + Broders + FIGO + Ascites + Diam, Surv(tyears, 1-d) ~ 1,
  data = ova, FUN="Brier", tout=seq(0,6,by=0.5), CV=TRUE, progress=TRUE)

Run the code above in your browser using DataLab