The Kaplan-Meier estimator: how bioinformaticians ask whether a gene, mutation, or treatment predicts how long patients survive.
The previous visualizations answer molecular questions: which genes changed, where they sit, how cells cluster. The clinical question is whether any of that predicts patient outcomes.
The Kaplan-Meier survival curve tracks a group of patients over time, estimating the fraction who have not yet had an event. Splitting patients by a molecular marker (high vs. low gene expression) lets you ask whether the marker is associated with different survival, but the plot itself is descriptive. The test and the effect size do the inferential work.
The survival probability at time \( t \) is estimated as:
\[ S(t) = \prod_{i: t_i \le t} \left( 1 - \frac{d_i}{n_i} \right) \]
Where \( d_i \) is the number of events (deaths) at time \( t_i \), and \( n_i \) is the number of patients at risk just before that time. Each step down marks an event. Tick marks on the curve show censored observations: patients who were lost to follow-up or were still alive when the study ended. We know they survived at least that long.
Figure 1. A single Kaplan-Meier curve for 80 simulated patients. Cross marks are censored observations. The shaded band is the 95% confidence interval, which widens over time as fewer patients remain at risk.
Without censoring, patients still alive at study end would either be dropped, which wastes information and can bias results, or counted as events, which underestimates survival. The Kaplan-Meier estimator keeps them in the risk set until their last known follow-up, then removes them from later denominators. This depends on a non-informative censoring assumption: censored patients should have similar future risk to those still being followed at that time.
Patients can be divided into groups by any covariate. Below, the split is by the expression level of a simulated gene.
Figure 2. Kaplan-Meier curves split by gene expression. Red: high expression. Blue: low expression. Drag the threshold to feel how the split changes the curves; this is an exploratory control. The log-rank p shown below is the test for a single, pre-specified split. Once you start scanning thresholds for the largest gap, that p is anti-conservative — a minimum-p test or a held-out validation cohort is required before reporting it as significance.
A visual gap is suggestive, not proof. The log-rank test compares the observed and expected number of events across the whole follow-up period. It answers a narrow question: under the null hypothesis of identical survival distributions, how surprising is this separation?
A small p-value (\( p < 0.05 \)) is evidence that the curves differ, not a measure of how large the difference is. The hazard ratio provides that companion effect size, usually from a Cox model. But test 20,000 genes and about 1,000 will reach \( p < 0.05 \) by chance. Bonferroni or FDR correction adjusts for multiple testing.
Figure 3. Three genes splitting the same patients differently. Some show a clear survival difference; others don't.
A gene that is both differentially expressed and predicts survival is a stronger biomarker candidate than one that satisfies either criterion alone.
The series traces a path from raw data to clinical relevance:
Each visualization answers a different question; together they form a working vocabulary for moving from molecular measurements to clinical decisions.