Ask Mallard

Kaplan-Meier and the log-rank test

The Kaplan-Meier estimator describes the probability of surviving past each point in time using all the follow-up available, including from people whose observation ended before the outcome occurred.

What question does this help answer?

It answers "what proportion are still event-free at six months", and, with the log-rank test, "do these two groups differ over the whole follow-up period". It does this without assuming any shape for the underlying risk.

How censoring works

Someone who leaves the study, or reaches the end of it, without the outcome contributes information up to that moment and then stops. The estimator uses that partial information rather than discarding the person, which is what makes it usable when follow-up varies.

What censored follow-up looks like

Five people's follow-up lines, starting at different times. Two end in the outcome; three are censored when follow-up stops for another reason. Each contributes time until its line ends, and the number still at risk falls as lines end.Censoring: every line counts until it endsStill at risk here: B, D and EPerson APerson BStudy endsPerson CLost to follow-upPerson DPerson EWithdrewTimeA censored person is not an event-free person. The method assumes censoring is unrelated to thechance of the outcome.Outcome occursFollow-up ends without the outcome (censored)
Conceptual diagram. It shows the structure of the idea, not data from any study.

What a Kaplan-Meier plot looks like

Group 1Group 2
Illustrative placeholder. Every value in this figure is invented to show the shape of the result, and is not an estimate of anything.

When to use it

Use it to describe time-to-event data before modelling it, to present survival visually, and to compare groups when no adjustment is needed. A Kaplan-Meier plot with numbers at risk beneath it is usually the most informative single figure in a survival paper.

When not to use it

It cannot adjust for covariates, so it is descriptive rather than a substitute for a model. It should not be used where a COMPETING EVENT exists, because it treats the competing death as though the patient could still have the outcome later. And a log-rank test is the wrong test when curves cross, because it averages an effect that changes direction into one number and can report no difference where a large one exists.

Why Mallard may recommend it

Mallard offers a Kaplan-Meier exhibit when the estimand's measure is a hazard ratio and nothing in the plan contradicts a survival presentation. Where the estimand records a competing event, it does NOT: the figure is withheld rather than printed with a caveat.

Key assumptions and design requirements

  • Censoring is uninformative: leaving the study is unrelated to the risk of the outcome.
  • Time zero is defined the same way for everyone, and follow-up begins there.
  • Numbers at risk are shown beneath the curve, because the tail is where the estimate is least stable.
  • A median survival is not reported when the curve has not reached 50 percent.
  • Where a competing event exists, cumulative incidence is used instead.

What to watch out for

The curve assumes censoring is uninformative: that people lost to follow-up were no more and no less likely to have the outcome than those who stayed. Where a competing event exists the complement of the curve OVERSTATES cumulative incidence, and a log-rank test can miss a real difference entirely when curves cross, because it averages a changing effect into a single comparison.

Clinical example

Question: Do patients discharged on a new anticoagulant remain free of readmission longer? Analysis: Plot Kaplan-Meier curves by drug with numbers at risk, compare with a log-rank test, and inspect whether the curves cross before trusting that single p-value.

Code for this method
Loading…
Recent studies that used this
Searching PubMed…
Related Learn pages
Sources & further reading
  1. The logrank test (opens in a new tab) · BMJ · doi 10.1136/bmj.328.7447.1073
  2. Kaplan-Meier Curves, Log-Rank Tests, and Cox Regression for Time-to-Event Data (opens in a new tab) · Anesth Analg · doi 10.1213/ANE.0000000000005358
Both are short introductions rather than methodological treatments, which is deliberate for a first read. Neither covers competing risks; that is a separate page and a separate estimator.
Last source review: 2026-09-06
AI-generated educational content
Mallard uses reputable methodological and reporting sources, but this material may contain errors or omit important context. Verify important methodological decisions with the cited sources and, when appropriate, a qualified research methodologist or statistician.