Computes Harrel's C (concordance) index for predictions, taking censoring into account.

getCindex(pred, y, weights = rep(1, nrow(y)))

Arguments

pred

A vector of predictions.

y

Survival response variable, must be a Surv or stratifySurv object.

weights

Observation weights (default is all equal to 1).

Value

The C index for the predictions (a single numeric value).

Examples

set.seed(1) pred <- rep(1:2, length.out = 10) y <- survival::Surv(exp(rnorm(10)), rbinom(10, 1, 0.5)) getCindex(pred, y)
#> [1] 0.1944444