concordance_index() gives Harrell's C, the proportion of comparable pairs of subjects in which
the subject with the higher risk score has the event first. A pair is comparable when one
subject has the event while the other is still under observation (a later time, or censored at
the same time). Ties in the score count as one half, and pairs with the same event time are
left out. A C of 0.5 is no better than chance and 1 is perfect ranking.
Arguments
- response
A right-censored
Surv()object.- risk
A risk score for each subject, such as a Cox model's linear predictor. Higher scores mean earlier events.
- tau
The truncation time for
concordance_index_ipcw(). The default is the last event time.
Details
concordance_index_ipcw() gives Uno's C, which weights each case by
\(1 / G(T_i-)^2\), where \(G\) is the Kaplan-Meier estimate of the censoring distribution.
Under independent censoring it is consistent for the concordance probability, which Harrell's C
isn't when censoring is heavy. Only cases with an event at or before tau count, and they're
compared with subjects whose time is strictly later.
Examples
lung <- data.frame(
time = c(306, 455, 1010, 210, 883, 1022, 310, 361, 218, 166, 170, 654),
status = c(2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2),
age = c(74, 68, 56, 57, 60, 74, 68, 71, 53, 61, 57, 68)
)
fit <- cox_ph(Surv(time, status) ~ age, data = lung)
death <- Surv(lung$time, lung$status)
concordance_index(death, risk = predict(fit))
#> [1] 0.5615385
concordance_index_ipcw(death, risk = predict(fit), tau = 700)
#> [1] 0.5634921