Risk Modelling and Survival Analysis · Estimation procedures for lifetime distributions
Kaplan-Meier Estimator of the Survival Function Explained Step by Step
Updated 11 October 2026 · Fact-checked
The Kaplan-Meier estimator estimates S(t) without assuming a distribution. At each observed death time tⱼ, multiply by (1 − dⱼ/nⱼ), where dⱼ is deaths and nⱼ is the number at risk just before tⱼ. Censored lives leave the risk set but cause no drop. Greenwood's formula gives the variance.
Understand Kaplan-Meier Estimator of the Survival Function
The Kaplan-Meier (KM) estimator, also called the product-limit estimator, estimates the survival function S(t) = P(T > t) directly from data. It does not assume a model such as exponential or Gompertz. That is why it is called nonparametric.
The idea is simple. To survive past time t, a life must survive each death time up to t in turn. At a death time tⱼ, the estimated chance of surviving that moment is 1 − dⱼ/nⱼ. Here nⱼ is the risk set: the number of lives still under observation just before tⱼ. And dⱼ is the number of deaths at tⱼ. Multiplying these conditional survival probabilities gives the estimate of S(t).
Censoring is what makes the method useful. A life censored at time c is known to have survived to c, and then we lose sight of it. Up to c it counts in the risk set. After c it does not. A censoring time does not create a step in the curve. It only reduces the risk set for later death times.
The estimate is a step function. It is flat between death times and drops at each death time. It is right-continuous. If the last observation is a censored life, the estimate does not reach zero and is undefined beyond the largest observation. If the last observation is a death with nothing left at risk, the estimate drops to zero.
Because the estimate is a random quantity, you also need its variance. Greenwood's formula gives an estimate of Var(Ŝ(t)). From it you build approximate confidence intervals for S(t).
Key rules to remember
- Kaplan-Meier estimator
- Ŝ(t) = Π over tⱼ ≤ t of (1 − dⱼ/nⱼ)
- nⱼ = number at risk just before tⱼ. dⱼ = deaths at tⱼ. Ŝ(t) = 1 before the first death time.
- Risk set update
- nⱼ₊₁ = nⱼ − dⱼ − cⱼ
- cⱼ = number censored between tⱼ and tⱼ₊₁ (if censored at exactly a death time, the standard convention is that they are still in the risk set at that time).
- Greenwood's formula
- Var(Ŝ(t)) ≈ Ŝ(t)² × Σ over tⱼ ≤ t of dⱼ ÷ [nⱼ(nⱼ − dⱼ)]
- An estimate of the variance. The standard error is its square root.
- Approximate confidence interval
- Ŝ(t) ± z × √Var(Ŝ(t))
- z = 1.96 for 95%. This is a normal approximation and can go outside [0, 1] near the ends.
- Conditional survival from KM
- Ŝ(t₂) ÷ Ŝ(t₁) = Π over t₁ < tⱼ ≤ t₂ of (1 − dⱼ/nⱼ)
- Use this for estimates of survival from t₁ to t₂.
How to solve Kaplan-Meier Estimator of the Survival Function questions
Use a table. It keeps risk sets right and makes Greenwood's sum easy.
- 1List all observations in time order. Mark each as a death or a censoring.
- 2Identify the distinct death times t₁ < t₂ < ... Ignore censoring times as steps.
- 3For each death time, find nⱼ: count everyone with observed time ≥ tⱼ (still under observation just before tⱼ). Write dⱼ.
- 4Compute 1 − dⱼ/nⱼ for each death time.
- 5Multiply cumulatively to get Ŝ(tⱼ). Keep the value constant between death times.
- 6If asked for variance, compute dⱼ ÷ [nⱼ(nⱼ − dⱼ)] for each death time and add them up to time t.
- 7Multiply the sum by Ŝ(t)² to get Greenwood's variance. Take the square root for the standard error.
- 8Build the confidence interval if required, and state the result in words with its time reference.
Quickest way: Running risk-set table
When to use it: Use in any exam question that gives a short list of lifetimes with censoring flags.
- Write the total number of lives as n at the start.
- Go through times in order. At each death time, nⱼ is the current count. Record dⱼ.
- After the death time, subtract the deaths. Subtract any censored lives before the next death time.
- Keep three columns only: nⱼ, dⱼ and the running Ŝ.
- Add a fourth column dⱼ ÷ [nⱼ(nⱼ − dⱼ)] only if variance is asked, and keep a running total.
Common mistakes in Kaplan-Meier Estimator of the Survival Function
Dropping the curve at censoring times
Students treat every observation as an event.
Fix: Only deaths cause a step. A censored life just leaves the risk set after its censoring time.
Using the wrong risk set
Students count lives from the start or subtract censored lives too early.
Fix: nⱼ is the number with observed time ≥ tⱼ. Lives censored before tⱼ are out. Lives censored at or after tⱼ are in.
Using dⱼ/nⱼ instead of 1 − dⱼ/nⱼ
Students confuse the death fraction with the survival fraction.
Fix: Each factor is a survival probability. Check that every factor is between 0 and 1 and that Ŝ never increases.
Forgetting the Ŝ(t)² factor in Greenwood's formula
Students stop after summing dⱼ ÷ [nⱼ(nⱼ − dⱼ)].
Fix: The sum is the variance of log Ŝ approximately. Multiply by Ŝ(t)² to get Var(Ŝ(t)).
Summing Greenwood terms beyond time t
Students use the whole table for every t.
Fix: Include only death times tⱼ ≤ t.
Stating Ŝ(t) beyond the last observation as zero
Students assume everyone must die eventually.
Fix: If the largest time is censored, Ŝ stays at its last value and is not defined beyond. Say so.
Worked examples
Example 1
Ten lives are observed. Death times: 2, 4, 4, 7, 10. Censored times: 3, 6, 9, 12, 12. Estimate S(t) at each death time and find Ŝ(8).
Show the solution
- Order: 2(d), 3(c), 4(d), 4(d), 6(c), 7(d), 9(c), 10(d), 12(c), 12(c).
- t = 2: n = 10, d = 1. Factor = 9/10 = 0.9. Ŝ(2) = 0.9.
- Censor at 3: n becomes 10 − 1 − 1 = 8.
- t = 4: n = 8, d = 2. Factor = 6/8 = 0.75. Ŝ(4) = 0.9 × 0.75 = 0.675.
- After t = 4: n = 6. Censor at 6: n = 5.
- t = 7: n = 5, d = 1. Factor = 4/5 = 0.8. Ŝ(7) = 0.675 × 0.8 = 0.54.
- Censor at 9: n = 3. t = 10: n = 3, d = 1. Factor = 2/3. Ŝ(10) = 0.54 × 2/3 = 0.36.
- Ŝ(8) equals Ŝ(7) because no death occurs between 7 and 8.
Answer: Ŝ(2) = 0.9, Ŝ(4) = 0.675, Ŝ(7) = 0.54, Ŝ(10) = 0.36. Ŝ(8) = 0.54.
Example 2
Using the data in the first example, find the Greenwood standard error of Ŝ(7) and a 95% normal-approximation confidence interval for S(7).
Show the solution
- Death times up to 7: t = 2 (n = 10, d = 1), t = 4 (n = 8, d = 2), t = 7 (n = 5, d = 1).
- Term at 2: 1 ÷ (10 × 9) = 1/90 = 0.011111.
- Term at 4: 2 ÷ (8 × 6) = 2/48 = 0.041667.
- Term at 7: 1 ÷ (5 × 4) = 1/20 = 0.05.
- Sum = 0.011111 + 0.041667 + 0.05 = 0.102778.
- Var = Ŝ(7)² × sum = 0.54² × 0.102778 = 0.2916 × 0.102778 = 0.029970.
- Standard error = √0.029970 = 0.17312.
- 95% interval: 0.54 ± 1.96 × 0.17312 = 0.54 ± 0.33932, giving (0.2007, 0.8793).
Answer: Standard error ≈ 0.173. The 95% confidence interval for S(7) is approximately (0.201, 0.879).
Exam tips
- Draw the table first. Marks are given for correct risk sets even if later arithmetic slips.
- Check ties: when several deaths occur at the same time, use one factor with dⱼ equal to the number of deaths.
- State your convention for a censoring that occurs at the same time as a death: the censored life is in the risk set at that death time.
- In written answers, say that the estimator is nonparametric and that the curve is a step function. Examiners reward the interpretation.
- In R or Excel tasks, show the survival table and the formula used for the variance column, not just the final numbers.
Practice questions from Estimation procedures for lifetime distributions
- When maximising the Cox partial likelihood in the presence of tied death times, which statement is correct about the methods of handling tie…
- In a study of policyholder lifetimes, a life is observed from age 40 until the study ends at age 52, and is still alive at that point. Which…
- In a Nelson-Aalen calculation, a life is censored at time 5 and a death occurs at time 5 for another life. By the standard convention, how i…
- Which statement about the Kaplan-Meier estimate of the survival function is correct?
- Ten lives are observed from birth under an exponential model with force of mortality μ. Four die, at times 2, 3, 5 and 6 years. The other si…
Kaplan-Meier Estimator of the Survival Function: frequently asked questions
What is the difference between the Kaplan-Meier and Nelson-Aalen estimators?
Kaplan-Meier estimates S(t) as a product of (1 − dⱼ/nⱼ). Nelson-Aalen estimates the cumulative hazard as a sum of dⱼ/nⱼ. You can get a survival estimate from Nelson-Aalen as exp(−Λ̂(t)), and it is usually close to Kaplan-Meier.
How is censoring treated in the Kaplan-Meier estimator?
A censored life stays in the risk set up to its censoring time and is then removed. It does not cause a drop in Ŝ. This lets you use the information that the life survived to that time.
Why can the Greenwood confidence interval go outside 0 and 1?
The interval is a normal approximation applied directly to Ŝ(t). Near 0 or 1, or with small risk sets, the limits may fall outside [0, 1]. In that case you can truncate the limits or use a transformation such as the log-log interval if the question asks for one.
What does Ŝ(t) equal between two death times?
It stays constant at the value reached after the earlier death time. The curve only changes at observed death times.