time_dependent_auc() gives the cumulative-dynamic AUC of Uno and others (2011) at each time.
At time \(t\) the cases are the subjects with an event by \(t\) and the controls are those
still under observation after \(t\). The AUC is the proportion of case-control pairs in which
the case has the higher marker, with ties counted as one half and each case weighted by
\(1 / G(T_i-)^2\), where \(G\) is the Kaplan-Meier estimate of the censoring distribution.
It is NA at a time with no cases or no controls.
Arguments
- response
A right-censored
Surv()object.- marker
A risk score for each subject. Higher values should mean earlier events, so negate a predicted survival probability before passing it.
- times
The times.
integrated_auc()needs at least two, in increasing order.
Value
time_dependent_auc() gives a vector with one AUC per time. integrated_auc() gives a
single number.
Details
integrated_auc() averages the AUC over the times with the trapezoidal rule, after dropping
the times where it is NA.
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)
time_dependent_auc(death, marker = predict(fit), times = c(200, 300, 400))
#> [1] 0.6750000 0.8750000 0.5571429
integrated_auc(death, marker = predict(fit), times = c(200, 300, 400))
#> [1] 0.7455357