In a study following cancer patients for 24 months after surgery to measure the time to relapse, the researcher noticed that some patients had moved to another city in month 8, while others reached the end of month 24 without their tumour returning.
The researcher asked: “Should I delete the patients who did not have the event or whose follow-up was interrupted, and then calculate the arithmetic mean of follow-up months for the rest?”
Deleting these patients, or calculating an ordinary mean of follow-up time, throws away the most important information in the study and distorts the results, because time-to-event data has its own statistical framework: survival analysis.
What Are an Event and Censoring?
Despite its historical name, “survival analysis” is not limited to studying death. It covers any study that measures the time elapsed from a defined starting point until a particular event occurs, whether the event is negative (death, relapse, failure of a medical device) or positive (recovery, hospital discharge, fracture healing).
The distinctive feature of these studies is that the event does not occur for every participant during the study period. This is where right censoring comes in, and it arises in three main situations:
- End of the official study period: the patient reaches the end of the study (for example month 24) well, with no event yet.
- Loss to follow-up: the patient travelled or lost contact with the clinic in month 10. We know for certain that they were well for at least 10 months, but we do not know what happened afterwards.
- Withdrawal from the study: the patient withdrew for a reason unrelated to the event under study. (Competing events, such as death from another cause in a relapse study, have their own methods called competing risks analysis, and should not be treated as ordinary censoring without thought.)
Why You Cannot Average Follow-Up Times
Imagine two patients:
- Patient (A) relapsed in month 6 (a confirmed event).
- Patient (B) travelled and was lost to follow-up in month 6 while perfectly well (a censored observation at month 6).
If you treat the number 6 as an ordinary numeric variable and calculate the mean, you treat the patient who relapsed in month six exactly like the patient who stayed well until month six and then left! And if you delete patient (B) because their final outcome is unknown, you ignore the fact that they went a full 6 months without relapse, which lowers the estimate of the treatment’s true survival.
The Kaplan–Meier Estimator, Step by Step, With a Worked Table
The Kaplan–Meier method rests on a clever idea. Instead of calculating a proportion once at the end of the study, we divide time into stations at each moment when an actual event occurs, calculate the conditional probability of surviving at that moment, and then multiply the successive probabilities together:
S(tⱼ) = S(tⱼ₋₁) × (1 - dⱼ/nⱼ)
where:
- nⱼ: the number of patients at risk, still under follow-up immediately before time tⱼ.
- dⱼ: the number of patients who had the event at time tⱼ.
- Censored observations contribute to the denominator nⱼ for as long as they are present, then drop out of the denominator at later time points without being counted as an event in the numerator dⱼ.
A Numerical Example With 6 Patients
Let us follow 6 patients for 10 months after starting a new treatment (a + sign marks a censored observation that had not had the event up to that moment). The recorded times in months are: 2, 4+, 5, 8, 9+, 10.
- At the start (t = 0): all six patients are under follow-up (n₀ = 6), and the initial survival probability is S(0) = 1.00 (100%).
- At month 2: one event occurs (d₁ = 1) out of n₁ = 6 at risk.
S(2) = 1.00 × (1 - 1/6) = 1.00 × 5/6 = 5/6 ≈ 0.833 (83.3%)
- At month 4: one patient leaves the study well (censored, 4+). The survival probability does not change because no event occurred (d = 0), but the number at risk at the next step drops by this patient (in addition to the patient who had the event in month 2), leaving 6 - 1 - 1 = 4 patients.
- At month 5: one event occurs (d₂ = 1) out of n₂ = 4 at risk.
S(5) = 5/6 × (1 - 1/4) = 5/6 × 3/4 = 15/24 = 0.625 (62.5%)
- At month 8: one event occurs (d₃ = 1) out of n₃ = 3 remaining.
S(8) = 0.625 × (1 - 1/3) = 0.625 × 2/3 = 10/24 ≈ 0.417 (41.7%)
- At month 9: one patient leaves well (censored, 9+). The survival probability stays at 0.417, and only one patient remains under follow-up (n₄ = 1).
- At month 10: the last patient has the event (d₄ = 1) out of n₄ = 1.
S(10) = 0.417 × (1 - 1/1) = 0.417 × 0 = 0.000 (0%)
The Complete Kaplan–Meier Table for the Example
| Time in months (tⱼ) | At risk (nⱼ) | Events (dⱼ) | Censored (cⱼ) | Interval survival probability (1 - dⱼ/nⱼ) | Cumulative survival S(tⱼ) |
|---|---|---|---|---|---|
| 0 | 6 | 0 | 0 | 1.000 | 1.000 (100.0%) |
| 2 | 6 | 1 | 0 | 5/6 = 0.833 | 0.833 (83.3%) |
| 4 (censored) | 5 | 0 | 1 | 1.000 | 0.833 (83.3%) |
| 5 | 4 | 1 | 0 | 3/4 = 0.750 | 0.625 (62.5%) |
| 8 | 3 | 1 | 0 | 2/3 = 0.667 | 0.417 (41.7%) |
| 9 (censored) | 2 | 0 | 1 | 1.000 | 0.417 (41.7%) |
| 10 | 1 | 1 | 0 | 0/1 = 0.000 | 0.000 (0.0%) |
How to Read the Median Survival Time
In survival analysis we rely on the median survival time instead of the mean. It is the time at which cumulative survival S(t) falls to 0.50 (50%) or below. Looking at our table above:
- At month 5, cumulative survival was 62.5% (above 50%).
- At month 8, cumulative survival fell to 41.7% (below 50%). Since the Kaplan–Meier curve is a step function that drops only when events occur, the time at which the curve crosses the 50% level is month 8, so the median survival time in this sample is 8 months.
Comparing Groups: The Log-Rank Test and Cox Regression
When you want to compare the survival curves of two groups (for example surgery versus radiotherapy):
The log-rank test: the standard non-parametric test for comparing two complete Kaplan–Meier curves across all follow-up time points. It compares the observed number of events (O) with the expected number (E) in each group under the null hypothesis that the two curves are identical, and gives a p-value. But it does not give you a measure of effect size, and it cannot adjust for confounders.
When to move to Cox proportional hazards regression? We move to Cox regression in two main situations:
- When we want to calculate the effect size, expressed as the hazard ratio (HR) with its 95% confidence interval. (For example, HR = 0.65 means the new treatment lowers the risk of the event at any moment in time by 35% compared with the control group.)
- When we need to control for accompanying or confounding variables (such as age, tumour stage, and chronic diseases), whether categorical or continuous, while checking the proportional hazards assumption over time.
How to Write It Up in Your Research
When presenting survival analysis results, report the median survival for each group with its 95% confidence interval, the log-rank test result, and the hazard ratio (HR) from the Cox model:
Sample reporting sentence (APA 7th edition style):
“Relapse-free survival was estimated using the Kaplan–Meier method and compared between groups using the log-rank test. Median relapse-free survival was 18.0 months (95% CI [14.5, 21.5]) in the intervention group versus 11.0 months (95% CI [8.2, 13.8]) in the control group (log-rank p = .004). In a multivariable Cox proportional hazards model adjusted for age and baseline disease stage, the intervention was associated with a significantly lower hazard of relapse (HR = 0.58, 95% CI [0.39, 0.86], p = .007).”
To apply this to your own data, try it on analysez.ai.