cindex_survmat | R Documentation |
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)'.
cindex_survmat(object, predicted, t_star = NULL)
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. |
A single numeric value representing the C-index.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.