score.cindex | R Documentation |
C-index (Concordance index) of the predicted vs. true answer, i.e. proportion of pairs that go in correct direction over all pairwise comparisons
score.cindex(pred, time, event, real)
pred |
Numeric risk score for each event |
time |
A vector of event or censoring times |
event |
A binary valued vector that indicates either death (1) or right-censoring (0) |
real |
A previously constructed Surv-object instead of providing time and event |
Corcordance index (c-index) of the prediction
# A random prediction ought to be near 0.5
# c-index is not sensitive to time scale, as it tests pairwise prediction accuracy
set.seed(1); prediction <- sample(1:20)
time <- seq(from=1000, to=50, by=-50)
event <- c(0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1)
library(survival)
score.cindex(pred = prediction, real = Surv(time=time, event=event))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.