score.cindex: Scoring function for evaluating survival prediction through...

Description Usage Arguments Value Examples

View source: R/int.R

Description

C-index (Concordance index) of the predicted vs. true answer, i.e. proportion of pairs that go in correct direction over all pairwise comparisons

Usage

1
score.cindex(pred, time, event, real)

Arguments

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

Value

Corcordance index (c-index) of the prediction

Examples

1
2
3
4
5
6
7
# 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))

ePCR documentation built on Dec. 1, 2019, 1:21 a.m.

Related to score.cindex in ePCR...