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 argument is "survival" or "crr"

type

The outcome type: "logistic" for binary, "survival" for ordinary time-to-event, and "crr" for competing risks outcomes. Defaults to "crr".

failcode

The value of fstatus that indicates the event of interest. Defaults to 1.

cencode

The censoring event code. Defaults to 0.

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"]


[Package QHScrnomo version 3.0.1 Index]