← SciSim / Statistics
Survival Analysis — Kaplan-Meier
Tier: Standard Undergraduate
§1 Interactive Simulation
Parameter 1
Parameter 2
Mean
Variance
Samples
0
Query prob
Parameter 1
Parameter 2
Query x
Speed 20/s
§2 The Idea, Step by Step

From "how many are still here?" to the Kaplan-Meier curve

Picture a classroom growing 100 bean plants. Each week a few wilt. A natural question is: what fraction of plants are still alive after $t$ weeks? Plot that fraction against time and you get a survival curve — it starts at 100% and steps downward every time something dies. That stepping-down picture is the whole subject in one image.

BUILD · HIGH SCHOOL

Give the curve a name: the survival function $S(t)$ is the probability of lasting longer than time $t$. The trick is to update it only at the moments something actually happens. At each event time you ask two numbers: how many were still "at risk" ($n_i$), and how many had the event right then ($d_i$). The fraction that came through that step is $1-\dfrac{d_i}{n_i}$.

Work a number. Week 1: 100 plants at risk, 10 wilt, so the step factor is $1-\tfrac{10}{100}=0.90$. Week 2: 90 at risk, 9 wilt, giving $1-\tfrac{9}{90}=0.90$ again. Survival to the end of week 2 is the product $0.90\times0.90=0.81$ — about 81% still standing. Notice we multiplied; we did not subtract. Survival chains together conditional steps.

DEEPEN · AP / INTRO COLLEGE

Chaining every step gives the Kaplan-Meier estimator $\hat{S}(t)=\prod_{t_i\le t}\left(1-\dfrac{d_i}{n_i}\right)$. Its real power is handling censoring: a plant moved to another greenhouse before it wilts still counts in $n_i$ up until it leaves, then quietly drops out of the at-risk pool without ever counting as an event $d_i$. That is why you never throw away a subject just because you stopped watching.

The instantaneous version is the hazard $h(t)$ — the event rate among those who have survived to $t$ — and the two are linked by $S(t)=\exp\!\left(-\int_0^t h(u)\,du\right)$. In the panel above, Parameter 1 shifts the typical time-to-event and Parameter 2 widens or narrows its spread, reshaping the modeled density that the survival curve is read from; the Query x slider reports the cumulative probability of having had the event by time $x$ (so survival is one minus that).

TRY THIS IN THE SIM ABOVE

Push Parameter 2 up and watch the density flatten and stretch — events spread over a wider window, so the curve declines more gently. Slide Query x across the range and read the "Query prob" card to see the cumulative chance climb from near 0 toward 1. Then press Play (or tap +1000) and watch the sampled bars pile up toward the smooth modeled curve — the empirical estimate converging on the theory, exactly as Kaplan-Meier converges as more subjects are observed.

§3 Mathematical Derivation

Survival Analysis — Kaplan-Meier — Time-to-event analysis with censoring

$$\hat{S}(t) = \prod_{t_i \leq t}\left(1 - \frac{d_i}{n_i}\right)$$

$h(t) = \lim_{\Delta t\to0}\frac{P(t\leq T

KEY PROPERTIES

This distribution has important theoretical and applied properties. See the simulation tabs to explore how shape changes with parameters.

APPLICATIONS

Clinical trials: time to death, relapse, or recovery. Engineering: time to failure (reliability). Economics: unemployment duration. Epidemiology: disease-free survival. The key challenge: censoring — some subjects leave before the event occurs (dropout, study ends). Kaplan-Meier handles censored observations correctly, producing a step-function survival estimate.

Key Results

Use the interactive simulation above to explore how the PDF shape responds to parameter changes. The Live Sampling tab demonstrates convergence of empirical frequencies to theoretical probabilities.

Ross — A First Course in Probability, 10th ed. 2019
Hogg, McKean & Craig — Introduction to Mathematical Statistics, 8th ed. 2018
DeGroot & Schervish — Probability and Statistics, 4th ed. 2012
§4 FAQ
StatQuest — youtube.com/@statquestSeeing Theory — seeing-theory.brown.edu
§5 Misconceptions & Common Errors
Key Error

Always verify parameter definitions before computing probabilities.
Different textbooks and software packages use different parameterizations. Always check which convention is being used (e.g., rate vs scale for exponential/gamma; shape vs rate for beta). Plug in extreme values and check that the PDF shape matches your expectation.
See the simulation to visualize how parameters affect the distribution shape.

Casella & Berger — Statistical Inference, 2nd ed. 2002
DeGroot & Schervish — Probability and Statistics, 4th ed. 2012