Learn R Programming

QHScrnomo (version 3.0.2)

tenf.crr: Obtain K-Fold Cross-Validated Predictions

Description

Computes "out-of-sample" predictions by K-fold cross-validation for each observation in the modeling data set from a crr.fit object.

Usage

tenf.crr(fit, time = NULL, lps = FALSE, fold = 10, trace = TRUE)

Value

A vector of failure probabilities at the specified time point (or linear predictors if lps=TRUE) with length equal to the number of rows in the original data set.

Arguments

fit

A model fit by crr.fit

time

A single time point to calculate the failure probability

lps

Should the linear predictor be returned instead of the failure probability? Defaults to FALSE.

fold

The number of folds. Defaults to 10.

trace

Should the progress of cross-validation be printed to the console? Defaults to TRUE.

Author

Changhong Yu, Michael Kattan, Ph.D
Department of Quantitative Health Sciences
Cleveland Clinic

See Also

crr.fit crr

Examples

Run this code
dd <- datadist(prostate.dat)
options(datadist = "dd")
prostate.f <- cph(Surv(TIME_EVENT,EVENT_DOD == 1) ~ TX  + rcs(PSA,3) +
           BX_GLSN_CAT +  CLIN_STG + rcs(AGE,3) +
           RACE_AA, data = prostate.dat,
           x = TRUE, y = TRUE, surv = TRUE,time.inc = 144)
prostate.crr <- crr.fit(prostate.f, cencode = 0, failcode = 1)
tenf.crr(prostate.crr, time = 120, fold = 2)

Run the code above in your browser using DataLab