Kaplan–Meier and Nelson–Aalen Estimation › Example - A Ten-Person Failure Table

Michael BrenndoerferOctober 26, 20263 min read
Machine Learning from ScratchAll chapters
Part 6 of 15Survival Analysis
Chapter 49Kaplan–Meier and Nelson–Aalen Estimation › Example - A Ten-Person Failure Table
Reading section 5 of 10 · Example - A Ten-Person Failure Table · 3 minSection 5 of 10 · 3 min

Section 5 of 10 · 3 min read

Kaplan–Meier and Nelson–Aalen Estimation › Example - A Ten-Person Failure TableSection view · Sections in this chapter5 / 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 formulas are compact, so it is worth slowing down and watching the risk set change row by row. We now work through a small failure table by hand. The observed times and event indicators are:

Ten-person failure table with follow-up times and event indicators.
SubjectYiY_iΔi\Delta_i
121
231
331
450
561
660
781
890
9101
10120

The distinct event times are 2,3,6,8,102,3,6,8,10. We process tied events and censorings using events first. At each event time, the first question is always the same: who is still in the risk set?

At t=2t=2, all ten subjects are at risk and one event occurs:

n1=10,d1=1,1−d1n1=1−110=0.9.n_1=10,\qquad d_1=1,\qquad 1-\frac{d_1}{n_1}=1-\frac{1}{10}=0.9.

Thus S^(2)=0.9\hat S(2)=0.9 and H^(2)=0.1\hat H(2)=0.1. The risk set has shrunk by one because subject 1 has now had the event.

At t=3t=3, subject 1 has already had an event, so nine subjects remain at risk. Two events occur at time 3.

n2=9,d2=2,1−d2n2=1−29=79.n_2=9,\qquad d_2=2,\qquad 1-\frac{d_2}{n_2}=1-\frac{2}{9}=\frac{7}{9}.

The updated estimates are

S^(3)=0.9⋅79=0.7,H^(3)=0.1+29=0.322222.\hat S(3)=0.9\cdot \frac{7}{9}=0.7, \qquad \hat H(3)=0.1+\frac{2}{9}=0.322222.

At t=5t=5 subject 4 is censored. This does not create a step, but it removes subject 4 from later risk sets. That is the only role of censoring here: it changes who is available for future events.

At t=6t=6, subject 4 is gone, but subject 6 is censored at time 6 and remains in the risk set for the event at time 6 under our convention. Six subjects are at risk and one event occurs:

n3=6,d3=1,1−d3n3=1−16=56.n_3=6,\qquad d_3=1,\qquad 1-\frac{d_3}{n_3}=1-\frac{1}{6}=\frac{5}{6}.

Therefore

S^(6)=0.7⋅56=0.583333,H^(6)=0.322222+16=0.488889.\hat S(6)=0.7\cdot \frac{5}{6}=0.583333, \qquad \hat H(6)=0.322222+\frac{1}{6}=0.488889.

At t=8t=8, subjects 5 and 6 have left after time 6, so four subjects remain at risk. One event occurs:

n4=4,d4=1,1−d4n4=1−14=34.n_4=4,\qquad d_4=1,\qquad 1-\frac{d_4}{n_4}=1-\frac{1}{4}=\frac{3}{4}.

Thus

S^(8)=0.583333⋅34=0.4375,H^(8)=0.488889+14=0.738889.\hat S(8)=0.583333\cdot \frac{3}{4}=0.4375, \qquad \hat H(8)=0.488889+\frac{1}{4}=0.738889.

At t=10t=10, two subjects remain at risk and one event occurs:

n5=2,d5=1,1−d5n5=1−12=12.n_5=2,\qquad d_5=1,\qquad 1-\frac{d_5}{n_5}=1-\frac{1}{2}=\frac{1}{2}.

So

S^(10)=0.4375⋅12=0.21875,H^(10)=0.738889+12=1.238889.\hat S(10)=0.4375\cdot \frac{1}{2}=0.21875, \qquad \hat H(10)=0.738889+\frac{1}{2}=1.238889.

At t=12t=12, the one remaining subject is censored, so the Kaplan-Meier curve remains flat at 0.218750.21875 after time 10. It never reaches zero because the last subject leaves the study without an observed event.

The Nelson–Aalen estimate at time 10 is 1.2388891.238889, and

exp⁡(−H^NA(10))=exp⁡(−1.238889)≈0.2897.\exp(-\hat H_{\mathrm{NA}}(10)) = \exp(-1.238889) \approx 0.2897.

This is above the Kaplan–Meier value 0.218750.21875. The gap is the finite-sample effect of using 1−dj/nj1-d_j/n_j rather than e−dj/nje^{-d_j/n_j} at each event time. It is not a bug, and it is one reason we should not label exp⁡(−H^NA)\exp(-\hat H_{\mathrm{NA}}) as Kaplan–Meier.

For uncertainty, the Greenwood increments are

110⋅9, 29⋅7, 16⋅5, 14⋅3, 12⋅1.\frac{1}{10\cdot 9},\ \frac{2}{9\cdot 7},\ \frac{1}{6\cdot 5},\ \frac{1}{4\cdot 3},\ \frac{1}{2\cdot 1}.

Their sum is approximately 0.6595240.659524. At the final event time,

SE⁡^(S^(10))=0.218750.659524≈0.1776.\widehat{\operatorname{SE}}(\hat S(10)) = 0.21875\sqrt{0.659524} \approx 0.1776.

The median is the first time the curve is at or below 0.50.5. At time 6 the estimate is 0.5833330.583333, and at time 8 it is 0.43750.4375, so the estimated median is 88. This is a useful check on the risk-set arithmetic: the median is read from the step function, not computed by interpolating between event times.

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