cindex {QHScrnomo} | R Documentation |
Concordance Index Calculation (C-Index)
Description
Computes the concordance index for a predictor as a discrimination metric for binary, time-to-event, and competing risks outcomes.
Usage
cindex(
prob,
fstatus,
ftime,
type = "crr",
failcode = 1,
cencode = 0,
tol = 1e-20
)
Arguments
prob |
A risk score (typically a probability giving the risk of event failure) |
fstatus |
The event status |
ftime |
The event times. Applies when the |
type |
The outcome type: |
failcode |
The value of |
cencode |
The censoring event code. Defaults to |
tol |
Error tolerance (not used) |
Value
A named vector with following elements:
N |
Total number of observations in the input data |
n |
Number of observations used for calculation |
usable |
Total number of usable pairs |
concordant |
Number of concordant pairs |
cindex |
The concordance index: number of concordant pairs divided by the total number of usable pairs |
Author(s)
Changhong Yu, Michael Kattan, Brian Wells, Amy Nowacki.
Examples
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)
# Cross-validated predictions
prostate.dat$preds.cv.prostate.crr.120 <- tenf.crr(prostate.crr, time = 120, fold = 2)
## calculate the competing-risks version of concordance index
with(prostate.dat, cindex(preds.cv.prostate.crr.120,
ftime = TIME_EVENT,
fstatus =EVENT_DOD, type = "crr"))["cindex"]