Back to Main Index Open Learning Roadmap Try the Quiz

Survival Analysis and Competing Risks in Health ML

Many health questions are not just "will an event happen?" but "when will it happen, and what else might happen first?" This guide introduces time-to-event prediction, censoring, hazards, survival curves, and competing risks for clinical machine learning.

Beginner Learn how time-to-event outcomes differ from ordinary binary labels.
Intermediate Read survival curves, hazards, censoring marks, and Cox model outputs.
Advanced Recognize competing risks, time-aware validation, and clinical evaluation pitfalls.
2 Key outputs: event probability and event timing
1 Special label type: censored follow-up
3 Evaluation layers: discrimination, calibration, utility

Why this page matters

The portal already covers classification metrics, calibration, train-validation-test splits, and leakage. Survival analysis fills the gap for outcomes such as time to death, time to hospital readmission, time to relapse, graft failure, or disease progression.

Simple rule: if patients have different follow-up lengths or some leave the study before the event is observed, ordinary binary classification can throw away important information.

The four building blocks

Outcome

Event

The clinical endpoint of interest, such as death, readmission, relapse, infection, or treatment failure.

  • Define the event before modeling.
  • Keep the event window clinically meaningful.
  • Avoid changing the endpoint after seeing results.
Clock

Time origin

The moment follow-up begins: diagnosis date, surgery date, enrollment date, discharge date, or first prescription.

  • All patients need a consistent start point.
  • Features should be known at or before this time.
  • Ambiguous clocks create hidden leakage.
Missing event

Censoring

A patient is censored when follow-up ends before the event is observed.

  • They may have moved, study follow-up may end, or records may stop.
  • Censoring is not the same as "no event ever."
  • Survival methods keep partial follow-up information.
Rate

Hazard

The instantaneous event rate among patients who have not yet had the event.

  • Hazard ratios compare relative event rates.
  • A hazard ratio is not the same as absolute risk.
  • Clinical decisions still need absolute risk at useful time horizons.

Interactive survival curve explorer

Choose a cohort scenario and watch how the event timing changes the survival curve. A step down means an observed event; a censoring mark means the patient left observation without the event being seen.

Choose a clinical scenario

Interpret carefully: a lower curve means more events have occurred by that time, not necessarily that every patient was followed equally long.

Survival curve

Event: readmission

Competing risks: when another event gets there first

A competing risk is an event that prevents observing the primary event. For example, if the primary endpoint is cancer relapse, death from another cause prevents future relapse from being observed.

Standard survival question

"What is the probability of remaining free of relapse over time?"

  • Useful when one event dominates the question.
  • Censoring assumes unobserved future risk behaves like observed risk.
Competing-risk question

"What is the probability of relapse before death from another cause?"

  • Separates the primary event from events that block it.
  • Often summarized with cumulative incidence functions.
Clinical interpretation

"Which event should the care team plan for, and by what time horizon?"

  • Different events may require different actions.
  • Absolute event probabilities are often more actionable than hazard ratios.
Common mistake: treating a competing event as ordinary censoring can overestimate the probability of the primary event, especially in older or high-risk cohorts.

Which model fits the question?

Survival modeling is a family of methods. Choose the method based on the data size, interpretability needs, proportional hazards assumptions, and whether predictions must support bedside decisions.

Method Best for Watch out for
Kaplan-Meier curve Describing event-free survival for groups without many covariates. It is descriptive; it does not adjust for many patient features.
Cox proportional hazards model Interpretable covariate effects and hazard ratios. The proportional hazards assumption may fail over long follow-up.
Random survival forest Nonlinear patterns and interactions without specifying a parametric form. Interpretation and calibration need extra care.
Deep survival model Large, high-dimensional data such as imaging, waveform, omics, or longitudinal EHR features. Requires strong validation, transparency planning, and careful leakage control.
Competing-risk model Endpoints where different event types block each other, such as relapse versus non-cancer death. Report event-specific probabilities, not just one overall risk score.

Evaluation checklist for health ML

C-index Can the model rank patients by who has events earlier?
Brier Are time-specific risk predictions accurate on average?
Calib. Do predicted 1-year or 5-year risks match observed risks?
Utility Would acting on the risk score improve clinical decisions?
1. Define

Endpoint and time horizon

State the event, time origin, maximum follow-up, and whether competing events exist.

2. Split

Respect patients and time

Keep repeated patients together and avoid training on future information when deployment is temporal.

3. Model

Fit only inside training data

Preprocessing, feature selection, imputation, and tuning must stay inside the training folds.

4. Validate

Report clinically useful risk

Use discrimination, calibration, and decision usefulness at prespecified time horizons.

Mini knowledge check

Case 1

A patient is event-free at the last clinic visit, then moves away. What is this?

Correct answer: Censoring. We know the patient was event-free until the last observed time, but not after.

Case 2

If death prevents observing relapse, what should you consider?

Correct answer: Competing risks. Death changes the probability of observing relapse and should be modeled or reported explicitly.

Case 3

Which quantity is most useful for a decision such as screening every 6 months?

Correct answer: Risk by a chosen time horizon. Decisions usually need absolute risk by a clinically meaningful date.

How this connects to other portal pages

After train-validation-test splitting

Survival data still need clean splits, grouped patients, and time-aware validation to avoid leakage.

After calibration and thresholds

Time-to-event models should be calibrated at clinically meaningful time horizons before use.

Before deployment monitoring

Event rates, treatment pathways, and censoring mechanisms can drift over time, so survival models need ongoing checks.