Learn R Programming

survC1 (version 1.0-3)

cvC: Cross-validation estimate for C

Description

Provides a cross-validation estimate for C

Usage

cvC(mydata, tau, cvK = 10, Rep = 10)

Arguments

mydata

Input data. The 1st column should be time-to-event, and the 2nd column is event indicator (1=event, 0=censor). The rest of the columns are covariates/predictors used in the model. No character variable or missing is allowed.

tau

Truncation time. The resulting C tells how well the given prediction model works in predicting events that occur in the time range from 0 to tau. Note that the survival function for the underlying censoring time distribution needs to be positive at tau.

cvK

The number of fold. A K-fold cross-validation is performed, according to the number given for cvK. Generally, a value from 2 to 10 will be specified.

Rep

The number of iteration of the random splits for the K-fold cross-validation. The average of the Rep times of cvK-fold cross-validation estimates is provided as a resulting estimate for C.

Examples

Run this code
# NOT RUN {
D=CompCase(pbc[,c(2:4,10:14)]) 
D[,2]=as.numeric(D[,2]==2)

tau=365.25*8

model1=D[1:200,c(1,2,4)]

cvC(model1,tau,cvK=2,Rep=10)

# }

Run the code above in your browser using DataLab