Skip to content

tausurv

Survival analysis for Python: nonparametric estimators, regression models, tree ensembles and neural networks behind one interface, with support for competing risks.

A Kaplan-Meier curve with a 95% confidence band and an at-risk table, on the Mayo Clinic PBC trial:

import tausurv as ts
ts.plot.set_style("publication")
X, Y, delta = ts.datasets.load_pbc()
ts.plot.km(Y / 365.25, delta, xlabel="years from registration")

Kaplan-Meier survival curve on the PBC trial cohort, with a 95% confidence band and an at-risk table below the time axis.

subpackagecontents
ts.nonparametricKaplan-Meier, Nelson-Aalen, Aalen-Johansen, censoring distribution
ts.linearCox proportional hazards, Weibull, log-normal and log-logistic AFT, Fine-Gray
ts.treessurvival tree, random survival forest, gradient boosting
ts.nnDeepSurv, DeepHit, logistic hazard, deep survival machines, CopulaSurv, HACSurv
ts.metricsconcordance, time-dependent AUC, Brier score, calibration, with cause-specific variants
ts.model_selectioncross-validation, hyperparameter search, nested cross-validation
ts.datasets100 survival tables from 68 studies, downloaded on first use and checksummed
ts.simulationssingle-risk and competing-risks data with known truth
ts.plotsurvival and incidence curves, forest plots, calibration, metrics over time, SHAP

Every fitted model exposes the same prediction methods: survival function, cumulative hazard, cumulative incidence, restricted mean survival time and a risk score.

  • Tutorials work through an analysis of the PBC trial: Kaplan-Meier curves, a Cox model with held-out evaluation, and competing risks.
  • How-to guides solve one task each.
  • Concepts explain the quantities and assumptions behind the methods.
  • Plotting covers the plot functions and styles.
  • API reference is generated from the docstrings.