R2 {pec} | R Documentation |
Explained variation for survival models
Description
This function computes a time-dependent $R^2$ like measure of the variation explained by a survival prediction model, by dividing the mean squared error (Brier score) of the model by the mean squared error (Brier score) of a reference model which ignores all the covariates.
Usage
R2(object, models, what, times, reference = 1)
Arguments
object |
An object with estimated prediction error curves obtained with the function pec |
models |
For which of the models in |
what |
The name of the entry in |
times |
Time points at which the summaries are shown. |
reference |
Position of the model whose prediction error is used as the reference in the denominator when constructing $R^2$ |
Details
In survival analysis the prediction error of the Kaplan-Meier estimator plays a similar role as the total sum of squares in linear regression. Hence, it is a sensible reference model for $R^2$.
Value
A matrix where the first column holds the times and the following columns are the corresponding $R^2$ values for the requested prediction models.
Author(s)
Thomas A. Gerds tag@biostat.ku.dk
References
E. Graf et al. (1999), Assessment and comparison of prognostic classification schemes for survival data. Statistics in Medicine, vol 18, pp= 2529–2545.
Gerds TA, Cai T and Schumacher M (2008) The performance of risk prediction models Biometrical Journal, 50(4), 457–479
See Also
Examples
set.seed(18713)
library(prodlim)
library(survival)
dat=SimSurv(100)
nullmodel=prodlim(Hist(time,status)~1,data=dat)
pmodel1=coxph(Surv(time,status)~X1+X2,data=dat,x=TRUE,y=TRUE)
pmodel2=coxph(Surv(time,status)~X2,data=dat,x=TRUE,y=TRUE)
perror=pec(list(Cox1=pmodel1,Cox2=pmodel2),Hist(time,status)~1,data=dat,reference=TRUE)
R2(perror,times=seq(0,1,.1),reference=1)