Learn R Programming

pec (version 1.0.7)

R2: Summarizing prediction error curves

Description

Cumulating prediction error curves over time and a time-dependent $R^2$ like measure.

Usage

R2(object, who, what, times ,nullModel=1)
crps(object, who, what, times, start)

Arguments

object
An object with estimated prediction error curves obtained with the function pec
who
Which models in object$models should be considered. Default is all models for crps and all models except the reference for R2
what
Usually pred.error -- if crossvalidation or bootstrap methods are used then also the apparent.error and if replan=boot.632plus then also the BootB0.error, the estimated overfit, and the NoInf.error can be cumulated o
times
Time points at which the summaries are shown.
start
Only for crps: the time point at which the cumulation is started
nullModel
Position of the model whose prediction error is used as the reference in the denominator when constructing $R^2$

Value

  • A matrix with a column for every requested prediction model

Details

The cumulative prediction error (continuous ranked probability score) is defined as the area under the prediction error curve.

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$.

See Also

pec

Examples

Run this code
set.seed(18713)

dat=SimSurv(100)
nullmodel=prodlim(Hist(time,status)~1,data=dat)
pmodel=coxph(Surv(time,status)~X1+X2,data=dat)
perror=pec(list(KaplanMeier=nullmodel,Cox=pmodel),Hist(time,status)~1,data=dat)

## cumulative prediction error
crps(perror,times=1) # between min time and 1
crps(perror,times=1,start=0) # between 0 and 1
crps(perror,times=seq(0,1,.2),start=0) # between 0 and seq(0,1,.2)

R2(perror,times=seq(0,1,.1))

Run the code above in your browser using DataLab