Kaplan–Meier and Nelson–Aalen Estimation › Visualizing Kaplan–Meier and Nelson–Aalen

Michael BrenndoerferOctober 26, 20265 min read
Machine Learning from ScratchAll chapters
Part 6 of 15Survival Analysis
Chapter 49Kaplan–Meier and Nelson–Aalen Estimation › Visualizing Kaplan–Meier and Nelson–Aalen
Reading section 7 of 10 · Visualizing Kaplan–Meier and Nelson–Aalen · 5 minSection 7 of 10 · 5 min

Section 7 of 10 · 5 min read

Kaplan–Meier and Nelson–Aalen Estimation › Visualizing Kaplan–Meier and Nelson–AalenSection view · Sections in this chapter7 / 10 ↓
Reading tools Definitions, links & notes

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Notes & comments

The estimates are already computed. We now use plots to expose the mechanism: where the steps occur, how censorings enter, how the product-limit and exponential transforms differ, and how the shrinking risk set limits tail interpretation.

The standard-error plot describes this one simulated cohort. Its shape depends on both the risk set and the falling survival estimate; a rise followed by a decline is not a universal pattern.

VisualizationOut [23]
CollapseExpand
Two step curves declining from one. Kaplan-Meier lies below exp(-Nelson-Aalen), with steps at times 2, 3, 6, 8, and 10. Censoring marks sit below the curves.
Kaplan-Meier and exp(-Nelson-Aalen) curves for the ten-person failure table. Steps occur only at event times; censorings change future risk sets but do not create steps.

The blue curve is the Kaplan-Meier estimate. It drops from 11 to 0.90.9 at time 2, to 0.70.7 at time 3, to 0.58330.5833 at time 6, to 0.43750.4375 at time 8, and to 0.218750.21875 at time 10. The orange curve is exp⁡(−H^NA)\exp(-\hat H_{\mathrm{NA}}). It is close to the blue curve early, but it stays above it. The gap is the finite-sample difference between multiplying by 1−dj/nj1-d_j/n_j and multiplying by e−dj/nje^{-d_j/n_j}.

The censor marks at times 5, 6, 9, and 12 do not create steps. They remind us that subjects leave after their censoring times and are unavailable for later events. The horizontal line at 0.50.5 shows why the median is time 8: the curve is still above 0.50.5 at time 6 and below 0.50.5 at time 8.

VisualizationOut [24]
CollapseExpand
A step-shaped Kaplan-Meier curve close to a smooth true survival curve, surrounded by a blue pointwise confidence band whose width increases through the middle of follow-up and then decreases in the extreme tail. A dashed exp(-Nelson-Aalen) curve stays slightly above the Kaplan-Meier curve. Censoring marks sit below the curves.
Kaplan-Meier curve with a pointwise 95% Greenwood log-log confidence band for the simulated right-censored sample. The dashed curve is exp(-Nelson-Aalen), and the smooth curve is the true Weibull survival function.

The simulated curve tracks the true Weibull survival function reasonably well in the middle of the follow-up range. The Kaplan-Meier curve is a step function, so it cannot follow the smooth curve exactly. The pointwise interval width depends on both the risk set and the survival estimate in this one sample. Its absolute width alone does not describe how much follow-up information remains. The dashed exp⁡(−H^NA)\exp(-\hat H_{\mathrm{NA}}) curve again sits slightly above the product-limit curve. Censoring marks appear as follow-up progresses; they do not create steps in the curve, but they remove subjects from later risk sets, and the risk set is smallest at the latest follow-up times where few patients remain.

The band in this figure is pointwise. It does not have 95% simultaneous coverage for the entire curve. Simultaneous coverage requires calibration for the entire specified time interval; the pointwise 95% labels here do not provide it.

VisualizationOut [25]
CollapseExpand
A left-continuous risk-set curve decreases from 240 subjects at time zero to one just before the last observed event.
Subjects at risk just before each observed event or censoring time. The decreasing risk set exposes how little follow-up remains in the tail.
VisualizationOut [26]
CollapseExpand
The standard-error curve reaches its maximum near follow-up time 10 and then declines; the undefined terminal standard-error value is omitted.
Pointwise Greenwood standard error in this simulated sample. It rises through the middle of follow-up and then declines. The terminal value is omitted because the last event exhausts the risk set.

The risk-set curve starts at 240 and falls as events and censorings accumulate. The standard-error curve is not monotone: its path depends on both the risk set and the falling survival estimate. Its last value is undefined and is omitted. One event removes a larger fraction of the remaining estimated survival when ten subjects are at risk than when two hundred are at risk. A flat Kaplan-Meier tail means that no further events were observed; it does not establish a cure fraction or show that the hazard has stopped. Check the number still at risk, because a flat segment can occur with either many or few subjects under observation.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy