Why Small Bookkeeping Errors Matter
Kaplan–Meier and Nelson–Aalen calculations use the same event-time information, but they estimate different quantities. Both also depend on keeping the risk set correct: the number of individuals still under observation and event-free immediately before a given time. A single censoring assigned to the wrong side of an event time can change every later estimate.
This tutorial focuses on auditing calculations rather than re-teaching the full estimators. The central checks are: who is at risk just before each event time, how tied failures and censorings are ordered, whether the result is survival or cumulative hazard, and which step value applies at the requested time.
The estimates are step functions. Under the usual convention, an event at \(t_j\) is included in the estimate evaluated at \(t_j\), while censoring at a time with no event creates no drop in the Kaplan–Meier curve. When a failure and a censoring have the same recorded time, the risk set for the failures includes those censored at that time. They are removed only after the failures at that time have been counted.
This event-before-censoring convention is appropriate when tied recorded times are handled as simultaneous observations and the censored individuals are considered at risk immediately before that time. If time recording is coarse, a tie may conceal the actual order; the convention is then a modeling rule, not evidence that the failure happened first in real time.
A Reliable Audit Sequence
Before calculating either estimator, write down the event times and the counts at risk, failing, and censored at each time. Start with the original cohort size. At each time, calculate the failures using the risk set just before that time; then remove both failures and censorings to find the next risk set. This prevents censorings at earlier times from remaining in later denominators.
List event and censoring times in increasing order. Include censoring times when updating the risk set, even though they do not create estimator increments.
Begin with the cohort size, then subtract all failures and censorings at earlier times. At a tie, count failures before removing censorings at that same time.
For Kaplan–Meier, multiply by \(1-d_j/n_j\). For Nelson–Aalen, add \(d_j/n_j\). Do not substitute one type of update for the other.
Include an event at the requested time, exclude events after it, and carry the last estimate across intervals with no event.
Why the Updates Have These Forms
Among the \(n_j\) individuals at risk just before \(t_j\), the observed fraction with failures at \(t_j\) is \(d_j/n_j\). Thus the estimated conditional probability of surviving that event time, given survival to just before it, is \(1-d_j/n_j\). Survival through successive event times is the product of those conditional survival estimates, giving the Kaplan–Meier formula. The Nelson–Aalen estimate instead accumulates the event-time hazard increments \(d_j/n_j\), giving a sum.
This also explains why the two outputs should not be interchanged. The Nelson–Aalen estimate is a cumulative hazard, not a survival probability. Transforming it to \(\exp(-\hat H_{\mathrm{NA}}(t))\) gives an exponentiated cumulative-hazard estimate of survival, which is generally not identical to the Kaplan–Meier product.
Worked Example: A Censoring Must Leave Later Risk Sets
In a hypothetical study of six insured devices, failures are observed at times 1, 3, and 4. One device is censored at time 2. Calculate the Kaplan–Meier survival estimate and the Nelson–Aalen cumulative-hazard estimate through time 4. The remaining two observations are censorings after time 4, so they do not affect either estimate through time 4.
Method. Construct the risk sets in time order. The failure at time 1 leaves five devices. The censoring at time 2 removes one more, so only four devices are at risk immediately before the failure at time 3. After that failure, three are at risk at time 4.
At time 1, \(n_1=6\) and \(d_1=1\). At time 3, \(n_2=4\) and \(d_2=1\). At time 4, \(n_3=3\) and \(d_3=1\). Therefore,
For Nelson–Aalen,
Check and common mistake. If the censoring at time 2 is mistakenly kept in the risk set at time 3, the time-3 risk count is wrongly taken as 5. This gives the incorrect values \(\hat S_{\mathrm{KM}}(4)=(5/6)(4/5)(2/3)=4/9=0.4444\) and \(\hat H_{\mathrm{NA}}(4)=1/6+1/5+1/3=0.7000\). The censoring occurred before time 3, so it must be removed before the time-3 risk set is formed. The correct estimates use \(n_2=4\).
Handling Tied Failures and Censorings
When several failures occur at the same event time, \(d_j\) is their total count, and all are evaluated against the single risk set \(n_j\) immediately before that time. If censorings share that recorded time, do not subtract them from \(n_j\) before calculating the failure fraction. Remove them, along with the failures, when establishing the risk set for the next time.
Worked Example: Tied Failures With Tied Censorings
A hypothetical cohort begins with 10 policies. At time 2, three policies have claims that meet the study’s failure definition and two policies are censored. At time 4, two more policies fail. Calculate both estimates through time 4.
Method. At time 2, all 10 policies are at risk immediately before the tied observations, so \(n_1=10\) and \(d_1=3\). The two censorings at time 2 are removed after those failures are counted. Thus the risk set at time 4 is \(10-3-2=5\), and \(n_2=5,\ d_2=2\).
Check and common mistake. The risk count after time 2 is \(5\), regardless of whether the three failures or two censorings are subtracted first when moving to time 4. But the time-2 failure fraction must use 10, not 8. Incorrectly removing the two tied censorings first gives a time-2 Kaplan–Meier factor \(1-3/8=5/8\) and a Nelson–Aalen increment \(3/8\); those are not the correct updates under the event-before-censoring convention. The correct denominator is \(n_1=10\).
Do Not Confuse Hazard, Survival, and Their Step Values
A Nelson–Aalen step adds to cumulative hazard; a Kaplan–Meier step multiplies survival by a conditional survival factor. The cumulative hazard is nondecreasing, while the Kaplan–Meier survival estimate is nonincreasing. Their numerical values need not add to one or otherwise match. A useful audit is to label every running total explicitly as either \(\hat H_{\mathrm{NA}}\) or \(\hat S_{\mathrm{KM}}\).
Worked Example: Cumulative Hazard Is Not Survival
A hypothetical group has five observations. Two fail at time 1, and one of the remaining three fails at time 2; the other two are censored later. Calculate both estimates at time 2 and compare the Nelson–Aalen exponential transform with Kaplan–Meier.
Method. At time 1, \(n_1=5,d_1=2\). There are three survivors of time 1, so \(n_2=3,d_2=1\) at time 2.
The exponential transform is \(\exp(-\hat H_{\mathrm{NA}}(2))=\exp(-11/15)\approx0.4803\), not \(0.4000\). It is a separate survival estimate, not a relabeling of the Nelson–Aalen cumulative hazard and not, in general, the Kaplan–Meier estimate.
Check and common mistake. A cumulative hazard of \(0.7333\) is not a survival probability of \(0.7333\). Calling it survival would also reverse the direction of interpretation: higher cumulative hazard indicates greater accumulated failure experience, whereas higher survival indicates fewer failures.
The step convention is another frequent source of errors. Both estimators change at event times, not at censoring times. Their values are constant between successive event times. The products and sums include events at or before the evaluation time; therefore, the estimate at an event time is the value after that event-time update. Immediately before that time, it is still the preceding step value.
Worked Example: Selecting the Estimate at an Exact Time
A hypothetical cohort of eight contracts has two failures at time 1, one censoring at time 2, and one failure at time 3. The other four observations are censored after time 3. Find the Kaplan–Meier and Nelson–Aalen estimates at time 2.5, immediately before time 3, and at time 3.
Method. At time 1, \(n_1=8,d_1=2\), so survival becomes \(6/8=3/4\) and cumulative hazard becomes \(2/8=1/4\). The censoring at time 2 does not change either estimate, but it reduces the risk set from six to five. Thus at time 3, \(n_2=5,d_2=1\).
At time 2.5 and immediately before time 3, no new failure has occurred since time 1. The estimates are \(\hat S_{\mathrm{KM}}=3/4=0.7500\) and \(\hat H_{\mathrm{NA}}=1/4=0.2500\). At time 3, include the failure:
Check and common mistake. The censoring at time 2 changes the time-3 denominator, but it does not create a drop at time 2.5. Conversely, the failure at time 3 is included in the estimate evaluated at exactly time 3. Reporting \(0.7500\) for survival at time 3 would use the left-hand step rather than the estimate at the event time.
Common Audit Traps
- Keeping a prior censoring in the risk set. Remove each censored observation before the next later event time.
- Removing a tied censoring too early. Under the stated convention, use the risk set immediately before the tied time for its failures; remove tied censorings afterward.
- Using each tied failure separately with a shrinking denominator. Failures tied at one time form one event group with a single \(d_j/n_j\) update.
- Calling cumulative hazard survival. Nelson–Aalen adds increments; Kaplan–Meier multiplies conditional survival factors.
- Using the wrong side of a step. At an event time, include that event. Between event times, carry forward the estimate unchanged.
A final audit should check that risk counts never increase, each failure count is no greater than its risk count, Kaplan–Meier survival stays between zero and one and never rises, and Nelson–Aalen cumulative hazard never falls. These checks do not replace correct bookkeeping, but they can reveal arithmetic or interpretation errors before an answer is finalized.
Check Your Understanding
For each problem, state the relevant risk counts and apply the event-time convention carefully.
- A cohort of 12 has three failures at time 1, two censorings at time 2, and two failures at time 3. Find both estimates through time 3. (Answer: \(n_1=12,\ n_2=7;\ \hat S_{\mathrm{KM}}(3)=15/28=0.5357,\ \hat H_{\mathrm{NA}}(3)=15/28=0.5357\).)
- Nine observations are followed. At time 2, two fail and two are censored; at time 5, one fails. Find both estimates through time 5. (Answer: \(n_1=9,\ n_2=5;\ \hat S_{\mathrm{KM}}(5)=28/45=0.6222,\ \hat H_{\mathrm{NA}}(5)=19/45=0.4222\).)
- Ten observations have one failure at time 1, three censorings at time 2, and two failures at time 4. Give both estimates at time 3.5 and at time 4. (Answer: \(n_1=10,\ n_2=6;\) at 3.5, \(\hat S_{\mathrm{KM}}=0.9000,\ \hat H_{\mathrm{NA}}=0.1000;\) at 4, \(\hat S_{\mathrm{KM}}=0.6000,\ \hat H_{\mathrm{NA}}=0.4333\).)
- Six observations have two failures at time 1 and one failure at time 2; all other observations are censored later. Calculate Kaplan–Meier survival and Nelson–Aalen cumulative hazard at time 2, and explain why they differ. (Answer: \(\hat S_{\mathrm{KM}}(2)=0.5000,\ \hat H_{\mathrm{NA}}(2)=7/12=0.5833\); one is a product estimate of survival and the other a sum of hazard increments.)
- At time 3, one failure and one censoring are tied, with five individuals at risk immediately beforehand. Another individual fails at time 4. Find the time-3 updates and the risk count at time 4. (Answer: use \(n_3=5,d_3=1\), so the KM factor is \(4/5\) and the NA increment is \(1/5\); after removing both tied observations, \(n_4=3\).)