% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/metrics.R
\name{cindex_mtl}
\alias{cindex_mtl}
\title{Concordance Index for Multi-Task Predictions}
\usage{
cindex_mtl(true.label.mat, pred.label.mat)
}
\arguments{
\item{true.label.mat}{A numeric matrix of true response labels with
dimensions \code{n x numTasks}. May contain \code{NA} for censored
observations (as produced by \code{\link{create_longitudinal_labels}}).}

\item{pred.label.mat}{A numeric matrix of predicted response values
with dimensions \code{n x numTasks} (as produced by
\code{\link{predict.orthoMTL}}).}
}
\value{
A numeric value between 0 and 1 (higher is better).
  A value of 0.5 indicates random concordance.
}
\description{
Computes a concordance index (C-index) adapted for the multi-task
survival framework. Predictions across tasks are aggregated by
row-sum to produce a single score per patient, then concordance
is evaluated over pairs where at least one member has a fully
observed outcome.
}
\details{
The effective survival time for each patient is derived as the
highest task index where the true label is positive (i.e., the
last threshold at which the patient was progression-free).

A patient is considered "uncensored" only if all task labels are
non-\code{NA}. Concordant pairs require both a correct ordering
of effective survival times and a matching ordering of predicted
scores.
}
\section{Known limitations}{

The following limitations are documented and flagged for future
investigation:
\itemize{
  \item No credit for tied predictions or tied survival times
  \item Strict censoring: uncensored requires all tasks observed
  \item Equal weighting of all tasks in the row-sum aggregation
}
}

\examples{
# Simulate a small multi-task prediction scenario
set.seed(42)
n <- 30; n_tasks <- 4
SurvTime <- rexp(n, rate = 0.1)
Event <- rbinom(n, 1, 0.7)
thresholds <- c(4, 6, 10, 15)

Y <- create_longitudinal_labels(SurvTime, Event, thresholds)

# Simulate imperfect predictions (add noise to true labels)
pred <- Y
pred[is.na(pred)] <- 0.5
pred <- pred + matrix(rnorm(n * n_tasks, sd = 0.3), n, n_tasks)

cindex_mtl(Y, pred)
}
\seealso{
\code{\link{predict.orthoMTL}} for generating the
  prediction matrix.
}
