% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/evaluation.R
\name{eval_cindex}
\alias{eval_cindex}
\title{Calculate Concordance Index (Harrell's or Uno's)}
\usage{
eval_cindex(time, event, S_mat, times, eval_time, method = "uno")
}
\arguments{
\item{time}{Numeric vector of observed follow-up times.}

\item{event}{Numeric vector of event indicators (1 = event, 0 = censored).}

\item{S_mat}{A numeric matrix of predicted survival probabilities.}

\item{times}{Numeric vector of evaluation times matching the columns of \code{S_mat}.}

\item{eval_time}{Numeric. The specific time point at which to extract predictions.}

\item{method}{Character. Either "harrell" or "uno". Defaults to "uno".}
}
\value{
A numeric value representing the chosen C-index.
}
\description{
Calculate Concordance Index (Harrell's or Uno's)
}
\examples{
data("metabric", package = "SuperSurv")
dat <- metabric[1:40, ]
x_cols <- grep("^x", names(dat))[1:3]
X <- dat[, x_cols, drop = FALSE]
newX <- X[1:10, , drop = FALSE]
times <- seq(50, 150, by = 50)

fit <- surv.coxph(
  time = dat$duration,
  event = dat$event,
  X = X,
  newdata = newX,
  new.times = times,
  obsWeights = rep(1, nrow(dat)),
  id = NULL
)

eval_cindex(
  time = dat$duration[1:10],
  event = dat$event[1:10],
  S_mat = fit[["pred"]],
  times = times,
  eval_time = 100,
  method = "uno"
)
}
