Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › The Kaplan–Meier Estimator

Survival Models Review · Tutorial 100 of 697

The Kaplan–Meier Estimator

Learn how the Kaplan–Meier estimator uses the event count and risk set at each event time to estimate a survival curve when follow-up is censored.

Intermediate 12 min read

What You'll Learn

  • Define the event count and risk set used at each distinct event time.
  • Derive the product-limit estimate from conditional survival probabilities.
  • Calculate survival estimates for right-censored data, including with delayed entry.
  • Handle tied event and censoring times under a stated risk-set convention.
  • Interpret the Kaplan–Meier curve and identify conditions that can undermine it.
  • Compare the estimator with crude proportions and grouped or parametric approaches.

Why a Product-Limit Estimate?

In a time-to-event study, some participants may not experience the event before observation ends. Their event times are therefore not known; we only know that they exceed their censoring times. The Kaplan–Meier estimator uses the information available up to each event time, rather than treating censored observations as if their event times were observed.

The key calculation is local: at each distinct observed event time, compare the number of events with the number of participants still at risk just before that time. The estimator multiplies the resulting conditional survival estimates across event times. This tutorial develops that calculation and its assumptions. It concerns estimation of a survival curve, not a model for how longitudinal biomarkers relate to event risk.

Definition: Let \(T_i\) be the event time and \(C_i\) the right-censoring time for participant \(i\). The observed time is \(X_i=\min(T_i,C_i)\), and the event indicator is \(\delta_i=I(T_i\leq C_i)\), where \(\delta_i=1\) denotes an observed event and \(\delta_i=0\) denotes censoring. At distinct observed event time \(t_j\), let \(n_j\) be the number at risk immediately before \(t_j\), and let \(d_j\) be the number of events at \(t_j\). With no delayed entry, a participant is at risk just before \(t_j\) when \(X_i\geq t_j\).

A censored participant contributes to risk sets up to their censoring time, but does not contribute an event at that time. At a time when events and censoring are tied, the usual convention is to count everyone censored at that time in the risk set immediately before the time, while counting only observed events in \(d_j\). This treats those participants as under observation immediately before the tied time. When times are rounded, many ties may reflect limited measurement precision rather than genuinely simultaneous events, so the timing convention should be stated and used consistently.

Deriving the Product-Limit Estimator

Write \(S(t)=P(T>t)\) for the population survival function: the probability that the event time exceeds \(t\). If the distinct event times up to \(t\) are \(t_1,\ldots,t_k\), survival to \(t\) can be expressed as a product of conditional probabilities of surviving each event time, given survival to the preceding one. At \(t_j\), the observed fraction of the risk set experiencing the event is \(d_j/n_j\), so the estimated conditional probability of surviving that time is \(1-d_j/n_j\).

Multiplying these conditional estimates gives the Kaplan–Meier, or product-limit, estimator. It is a step function: it drops at event times and stays level between them. A censoring time alone does not make the curve drop, although censoring can reduce later risk-set sizes.

$$ \widehat S(t)=\prod_{t_j\leq t}\left(1-\frac{d_j}{n_j}\right) =\prod_{t_j\leq t}\frac{n_j-d_j}{n_j}. $$

The justification is the chain rule for conditional probabilities: survival through successive event times is the product of the conditional probabilities of surviving each step. The risk-set fraction \(d_j/n_j\) estimates the conditional event probability at step \(j\); its complement estimates conditional survival. This reasoning depends on observing a representative set of people still at risk at each step. In particular, censoring must not selectively remove people with different future event prospects, after conditioning on information accounted for in the analysis.

Assumptions and scope: The standard Kaplan–Meier estimator assumes event times are measured on a common time scale, event status and censoring times are recorded correctly, and censoring is independent of the event time in the population being described. Independent administrative censoring is a common justification. If censoring depends on event risk, the observed risk sets may not represent those who remain event-free, and the estimate can be biased. With delayed entry, include a participant in a risk set only after entry; identification also requires an appropriate independent-truncation assumption in the observable time region.

Worked Example: A Right-Censored Sample

Suppose six hypothetical participants are followed from time zero. Their observed times and statuses are: an event at 1, events at 2 and 2, censoring at 3, an event at 4, and censoring at 5. Assume independent censoring and use the tied-time convention stated above. Calculate the Kaplan–Meier estimate through time 5.

At time 1, all six participants are at risk and one has an event. Thus \(n_1=6\), \(d_1=1\), and the first factor is \(1-1/6=5/6\).

At time 2, five remain at risk and two have events. The factor is \(1-2/5=3/5\). Therefore, \(\widehat S(2)=(5/6)(3/5)=15/30=0.5000\).

At time 3, one participant is censored. This does not create a factor in the product, but removes that participant from later risk sets. Two participants are then at risk at time 4; one has an event, giving a factor \(1-1/2=1/2\). Hence \(\widehat S(4)=0.5000(1/2)=0.2500\). The final censoring at time 5 does not lower the estimate, so \(\widehat S(5)=0.2500\).

The estimate of survival beyond time 4 is 0.25, or 25%, under the stated assumptions. It is not the fraction of all six participants known to survive beyond time 4: two event times were observed and two participants were censored at or before the end of follow-up.

Risk Sets with Delayed Entry

When participants enter observation after the time origin, a participant cannot be counted as at risk before entry. This is the delayed-entry setting covered by the earlier material on delayed entry and left truncation. Let \(L_i\) be the entry time. Under the convention that entry must occur before the event time to be included in the risk set immediately before it, define \(n_j\) by counting participants with \(L_i<t_j\leq X_i\). Event counts still include only observed events at \(t_j\). The product-limit formula is unchanged; the risk-set counts are not.

Worked Example: Correcting the Risk Set for Entry Time

Consider five hypothetical participants. A enters at 0 and has an event at 2; B enters at 0 and has an event at 3; C enters at 0 and has an event at 4; D enters at 2.5 and is censored at 4; E enters at 0 and is censored at 5. Assume the required independent-truncation and independent-censoring conditions hold. Calculate the curve at the event times.

At time 2, A, B, C, and E entered before the event time and remain under observation immediately before it. Thus \(n_1=4\), \(d_1=1\), and \(\widehat S(2)=1(1-1/4)=3/4=0.7500\).

At time 3, B, C, D, and E are at risk: D entered at 2.5, and E remains under observation until 5. Thus \(n_2=4\), \(d_2=1\), and \(\widehat S(3)=(3/4)(1-1/4)=9/16=0.5625\).

At time 4, C, D, and E are at risk. C has an event and D is censored at that time; under the stated convention, D is counted in the risk set immediately before time 4. Therefore \(n_3=3\), \(d_3=1\), and \(\widehat S(4)=(9/16)(1-1/3)=(9/16)(2/3)=18/48=3/8=0.3750\). E’s censoring at time 5 does not cause a further drop.

This example illustrates why entry and censoring must both be checked when constructing each risk set. In particular, E remains at risk at times 2, 3, and 4; omitting E would incorrectly shrink all three denominators.

Reading Ties, Steps, and Survival Quantiles

The estimate at a time \(t\) includes all event-time factors with \(t_j\leq t\). Thus it takes the post-event value at an event time and is constant until the next event time. If multiple events occur at one time, \(d_j\) counts all of them and there is one factor for that time. Censoring at the same time affects neither \(d_j\) nor the immediate drop, although the censoring observation is removed from later risk sets.

A quantile can be read from the estimated curve when the curve reaches the corresponding survival level. For example, the estimated median survival time is the first time at which \(\widehat S(t)\leq 0.5\). If the curve never reaches 0.5 during observed follow-up, the median is not estimable from that curve; it is not appropriate to extrapolate a crossing that the data do not show.

Worked Example: A Tie, a Censoring Time, and the Median

For five hypothetical participants, suppose there is an event at time 2, an event and a censoring at time 3, an event at time 5, and censoring at time 6. Assume independent censoring and that everyone entered at time zero. Find the estimate at the event times and the estimated median.

At time 2, \(n_1=5\), \(d_1=1\), so the factor is \(4/5\) and \(\widehat S(2)=0.8000\). At time 3, four participants are at risk immediately beforehand: the three who remained after the event at 2, plus the participant with an event at 3 and the participant censored at 3. Only one of these four has an event, so \(n_2=4\), \(d_2=1\), and \(\widehat S(3)=(4/5)(3/4)=3/5=0.6000\).

After time 3, two participants remain under observation. At time 5, one has an event, giving \(n_3=2\), \(d_3=1\), and \(\widehat S(5)=(3/5)(1/2)=3/10=0.3000\). The estimate first falls to 0.5 or below at time 5, so the estimated median survival time is 5 time units. The censoring at 6 causes no drop.

Diagnostics, Alternatives, and Limitations

A careful calculation begins with a subject-level event and censoring table, then checks every event-time risk set against entry and follow-up. Useful checks include verifying that \(0\leq d_j\leq n_j\), that each event is counted once, and that the product does not increase or become negative. With no delayed entry, risk-set sizes cannot increase over time. With delayed entry, they can increase when new participants enter, so this check must be adapted. A plotted curve should be flat between event times and should show censoring marks, if displayed, without treating those marks as drops.

The curve can look precise even when few people remain at risk late in follow-up. Report or inspect the risk-set sizes alongside it, and be cautious about late plateaus: a flat estimate after the last event does not show that the population’s survival probability is known to remain constant. It may simply reflect that observation ended or that only censored participants remained. Kaplan–Meier estimation also does not make informative censoring harmless; dependence between censoring and future event times cannot generally be ruled out by the curve alone.

The Kaplan–Meier estimator is nonparametric: it does not require choosing a particular distribution for event times. A grouped life-table estimate instead summarizes events and censoring within time intervals, which can be useful with coarsened follow-up but depends on interval choices and typically treats within-interval timing less precisely. A parametric survival model can provide a smooth curve and extrapolation, but relies on a specified distributional form. A crude fraction of participants with observed events ignores follow-up time and censoring, so it is not a substitute for the product-limit estimate.

In joint longitudinal and time-to-event analyses, the Kaplan–Meier curve is a useful descriptive benchmark for event-time experience. It does not adjust for covariates or account for dependence between a longitudinal biomarker and event risk. If censoring is informative, or if the scientific question requires a conditional or biomarker-linked survival model, a descriptive Kaplan–Meier estimate alone may not answer it.

Common pitfall: A student sees one participant censored at time 3 and counts that person as an event, or removes that person from the risk set before calculating events at time 3. Both steps are wrong under the stated convention. Censoring at time 3 is not an event; the person contributes to the risk set immediately before time 3, then is removed from later risk sets. Only observed events create factors below 1 in the product.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. At an event time, \(n_j=10\) and \(d_j=2\). What is the conditional survival factor for that time?
  2. At time 4, three people are at risk and one has an event while one is censored at that same time. What values of \(n_j\) and \(d_j\) are used under this tutorial’s convention?
  3. A participant enters at time 3 and is still under observation at time 5. Should they be included in the risk set immediately before an event at time 2?
  4. A Kaplan–Meier curve has values 0.72 at time 6 and 0.48 at time 8, with no event times between them. What is the estimated median time, if the curve first crosses 0.5 at time 8?

Solutions. (1) The factor is \(1-2/10=0.8\). (2) Both people are included in the risk set immediately before time 4, so \(n_j=3\) and \(d_j=1\); the factor is \(1-1/3=2/3\). (3) No. Entry at time 3 is after time 2, so that participant was not yet under observation and is not in that risk set. (4) The estimated median is 8 time units, the first time the curve is at or below 0.5.

Clinical Biostats