
Last chance! 50% off unlimited learning
Sale ends in
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.
R2(object, models, what, times, reference = 1)
An object with estimated prediction error curves obtained with the function pec
For which of the models in object$models
should we
compute $R^2(t). By default all models are used except for the reference
model.
The name of the entry in x
to be used. Defauls to
PredErr
Other choices are AppErr
, BootCvErr
,
Boot632
, Boot632plus
.
Time points at which the summaries are shown.
Position of the model whose prediction error is used as the reference in the denominator when constructing $R^2$
A matrix where the first column holds the times and the following columns are the corresponding $R^2$ values for the requested prediction models.
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$.
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 & Schumacher M (2008) The performance of risk prediction models Biometrical Journal, 50(4), 457--479
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab