cindex: Compute Concordance of survivalmodel Risk

View source: R/cindex.R

cindexR Documentation

Compute Concordance of survivalmodel Risk

Description

A thin wrapper around survival::concordance which essentially just sets reverse = TRUE.

Usage

cindex(risk, truth, ...)

Arguments

risk

(numeric())
Vector of risk predictions from a survivalmodel model (so high risk implies low survival time prediction).

truth

(numeric())
Vector of true survival times, must be same length as risk.

...

(ANY)
Further parameters passed to survival::concordance.

Value

The numeric value of the index.

Examples

if (!requireNamespace("survival", quietly = TRUE)) {
  set.seed(10)
  data <- simsurvdata(20)
  fit <- deepsurv(data = data[1:10, ])
  p <- predict(fit, type = "risk", newdata = data[11:20, ])
  concordance(risk = p, truth = data[11:20, "time"])
}

survivalmodels documentation built on May 29, 2024, 7:26 a.m.