timeROC: Compute Time-Dependent ROC Curves and AUC

View source: R/timeROC_archived.R

timeROCR Documentation

Compute Time-Dependent ROC Curves and AUC

Description

Computes time-dependent AUC for survival models using inverse probability of censoring weighting (IPCW).

Usage

timeROC(
  T,
  delta,
  marker,
  other_markers = NULL,
  cause,
  weighting = "marginal",
  times,
  ROC = TRUE,
  iid = FALSE
)

Arguments

T

Vector of observed failure times.

delta

Vector of status indicators: 0 for censoring, 1 for the event of interest, 2 or higher for competing events.

marker

Vector of marker values.

other_markers

Optional matrix of additional markers associated with the censoring mechanism. Default is NULL.

cause

The value of delta that indicates the main event of interest.

weighting

Weighting technique for IPCW. One of "marginal" (Kaplan-Meier, default), "cox" (Cox proportional hazards model), or "aalen" (additive Aalen model).

times

Vector of time points at which to compute the time-dependent AUC.

ROC

Logical; if TRUE (default), the true positive fraction (sensitivity) and false positive fraction (1-specificity) are saved for each time in times.

iid

Logical; if TRUE, computes the IID representation of the AUC estimator. Default is FALSE.

Details

This function is a verbatim copy from the timeROC package (v0.4) by Paul Blanche and Mickaƫl Foucher, which was archived on CRAN in 2024 (https://cran.r-project.org/package=timeROC). It is included here without modification to ensure continued functionality of the CalibrationCurves package after the dependency was removed.

Value

An object of class "ipcwcompetingrisksROC" (with competing risks) or "ipcwsurvivalROC" (without competing risks), containing:

  • AUC: vector of AUC values for each time point.

  • TP, FP: (if ROC = TRUE) matrices of true and false positive fractions.

  • times: the (ordered) input time points.

  • n: number of observations.

  • Stats: matrix with case/control/censoring counts per time point.

  • weights: IPCW weight object.

  • computation_time: elapsed computation time.


CalibrationCurves documentation built on March 27, 2026, 9:06 a.m.