comprisk: A scikit-learn-compatible Python toolkit for competing-risks survival analysis

Abstract

Medical time-to-event data are frequently subject to competing risks, where the occurrence of one terminal event precludes the others and standard survival methods that treat competing events as censoring yield biased absolute-risk estimates. Correct analysis instead targets the cause-specific cumulative incidence function (CIF). This methodology has been available to applied researchers almost exclusively through R packages, forcing Python-based machine-learning workflows into a Python-to-R round trip. We present comprisk, a scikit-learn-compatible Python toolkit that consolidates the canonical competing-risks methods (a scalable competing-risks random survival forest together with Fine-Gray subdistribution-hazard regression including a penalized variant, cause-specific Cox regression, the Aalen-Johansen CIF estimator, and Gray's K-sample test) behind a single, consistent API, and adds competing-risks-aware model evaluation (inverse probability of censoring weighted time-dependent AUC and Brier score, cause-specific concordance indices with closed-form confidence intervals, and calibration curves). Every estimator is validated numerically against the established R reference implementations. The forest uses a histogram-based, numba-compiled split kernel that fits 10-22x faster than randomForestSRC at comparable discrimination on real electronic-health-record cohorts and scales to n = 106 on a consumer CPU. comprisk is distributed on PyPI and lets applied researchers perform correct and scalable competing-risks analysis entirely within the Python scientific stack.

0

Turn this paper into a full lesson

ArcXiv compiles a staged curriculum from this paper: 8-12 lessons across beginner → advanced, synthesised section guides, visuals, flashcards, a quiz, exercises, and on-demand deep dives per section. Grounded in the abstract, never invented.

Discussion (0)

Sign in to join the discussion.

Loading comments…