Learn R Programming

survdnn (version 0.6.0)

cindex_survmat: Concordance Index from a Survival Probability Matrix

Description

Computes the time-dependent concordance index (C-index) from a predicted survival matrix at a fixed time point. The risk is computed as `1 - S(t_star)`.

Usage

cindex_survmat(object, predicted, t_star = NULL)

Value

A single numeric value representing the C-index.

Arguments

object

A `Surv` object representing the observed survival data.

predicted

A data frame or matrix of predicted survival probabilities. Each column corresponds to a time point (e.g., `t=90`, `t=180`).

t_star

A numeric time point corresponding to one of the columns in `predicted`. If `NULL`, the last column is used.

Examples

Run this code
library(survival)
data(veteran, package = "survival")
mod <- survdnn(Surv(time, status) ~
age + karno + celltype, data = veteran, epochs = 50, verbose = FALSE)
pred <- predict(mod, newdata = veteran, type = "survival", times = c(30, 90, 180))
y <- model.response(model.frame(mod$formula, veteran))
cindex_survmat(y, pred, t_star = 180)

Run the code above in your browser using DataLab