Learn R Programming

mlsurvlrnrs (version 0.0.8)

c_index: c_index

Description

Calculate the Harrell's concordance index (C-index)

Usage

c_index(ground_truth, predictions)

Arguments

ground_truth

A survival::Surv object with the ground truth.

predictions

A vector with predictions.

Details

A wrapper function around glmnet::Cindex() for use with mlexperiments.

See Also

glmnet::Cindex()

Examples

Run this code
if (requireNamespace("survival", quietly = TRUE) &&
requireNamespace("glmnet", quietly = TRUE)) {
  set.seed(123)
  gt <- survival::Surv(
    time = rnorm(100, 50, 15),
    event = sample(0:1, 100, TRUE)
  )
  preds <- rbeta(100, 2, 5)

  c_index(gt, preds)
}

Run the code above in your browser using DataLab