Worked survival-analysis example

Read a Kaplan-Meier curve without mistaking censoring for an event.

A step down, a censor mark and a shrinking risk set mean different things. Work through the canonical 6-MP remission dataset and learn what the curve, median and log-rank test each answer.

42 patientsTime to relapse21 per arm9-minute read

The short answer

Events make the curve fall. Censoring changes who remains at risk.

A Kaplan-Meier curve estimates the probability of remaining event-free beyond each observed time. When an event occurs, the curve steps down. When follow-up ends without an observed event, the subject is right-censored: the curve does not drop at that moment, but the subject leaves later risk sets.

Define the endpoint first: “survival” is generic statistical language. In this historical example, the time variable is duration of leukemia remission and the event is relapse—not death or overall survival.

The canonical 6-MP remission dataset

This commonly reproduced teaching dataset contains 21 patients maintained with 6-mercaptopurine (6-MP) and 21 maintained with placebo after steroid-induced remission. Every placebo observation is a relapse. In the 6-MP arm, 9 relapses and 12 right-censored observations are recorded.

Kaplan-Meier curves for 6-MP and placebo remission duration The 6-MP curve falls more slowly and remains at 44.8 percent after week 23. The placebo curve reaches zero at week 23. Twelve censor marks appear on the 6-MP curve and none on the placebo curve. 0 0.5 1.0 0 8 16 24 32 Weeks since remission Remission probability 6-MP Placebo Number at risk 6-MP Placebo 0 8 16 24 32 wk 21 16 11 5 4 21 12 3 0 0
Steps show relapse events; diagonal marks show right censoring. The risk table reveals how much information remains in the tail of each curve.

What Plotwright calculates

Median remission duration 23 vs 8 weeks

6-MP: 23 weeks; placebo: 8 weeks (95% CI 4 to 11 weeks).

Log-rank curve comparison χ²(1) = 16.79

P = 4.17×10⁻⁵ for equality of the two event-time distributions.

The 95% confidence interval for the 6-MP median has a lower bound of 13 weeks, but its upper bound is not estimable from these data. That is not a software failure: the upper confidence curve never falls through 0.5 before follow-up ends.

Historical-data caveat: this 21-per-arm excerpt is a canonical statistical teaching dataset derived from the 1963 trial. The original article's abstract summarizes a broader analyzed population and reports different medians. Use the excerpt to reproduce the calculation, not to restate the complete clinical evidence or guide current treatment.

What censoring assumes

Right censoring means only that an event was not observed before follow-up ended for that subject. It does not mean the subject never experienced the event, survived indefinitely, or should be removed from the analysis. The subject contributes time at risk until the censoring time.

Standard Kaplan-Meier inference depends on censoring being non-informative, conditional on the analysis design: those censored at a time should have comparable future event prospects to those who remain under observation. Loss to follow-up related to prognosis can bias the curve. Software cannot verify this from two columns of times and event codes.

What the log-rank test does—and does not—say

  • It compares the full event-time distributions across groups, not survival at one chosen week.
  • Its P value is evidence about a difference, not the magnitude or clinical importance of that difference.
  • It does not explain whether a difference reflects treatment, confounding, selection or informative censoring.
  • Crossing curves can make one overall log-rank summary hard to interpret; inspect the graph and prespecified estimand.
  • A hazard ratio adds an effect estimate but brings model and proportional-hazards considerations of its own.

A reporting checklist

  1. Define time origin, event and censoring rules.
  2. Report participants, observed events and censored observations per group.
  3. Show censor marks, confidence bands and numbers at risk beneath the curve.
  4. Limit the displayed tail when very few participants remain at risk.
  5. Report median time with its confidence interval when estimable; say “not reached” or “not estimable” when it is not.
  6. Name the curve-comparison test and report an effect estimate with uncertainty appropriate to the study question.

A compact result template

“Time to relapse was measured from remission and summarized with Kaplan-Meier estimates. Relapse was the event; follow-up without observed relapse was right-censored. The analysis included 21 patients per arm (6-MP: 9 events and 12 censored; placebo: 21 events). Median remission duration was 23 versus 8 weeks. The curves differed by the two-sided log-rank test, χ²(1) = 16.79, P = 4.17×10⁻⁵.”

Adapt the wording to the actual endpoint, analysis plan and study design. Add a suitable effect estimate and confidence interval; do not treat this historical excerpt as a reporting standard by itself.

What Plotwright checks

Plotwright's release suite reruns these 42 observations through the production Kaplan-Meier and log-rank engine. The gate expects medians of 23 and 8 weeks, χ² = 16.79 and P = 4.17×10⁻⁵ within explicit tolerances. Separate tests compare each survival step, Greenwood confidence band, censor count and risk set with the independent lifelines implementation.

Numerical agreement does not define the endpoint, justify censoring, choose an estimand or establish a causal treatment effect. Those remain scientific and design decisions.

Sources and reproducibility

  1. University of Iowa Biostatistics: Freireich 1963 data—the canonical 21-per-arm dataset and event indicators used here.
  2. Freireich et al. (1963), Blood—the original trial report and its broader clinical context.
  3. Guidelines for Statistical Reporting in Medical Journals—risk tables, event totals and Kaplan-Meier figure reporting.
  4. NCBI Bookshelf: Survival Analysis—censoring, Kaplan-Meier estimation and log-rank interpretation.
  5. Plotwright statistical validation—the published result, tolerance and evidence limitations for this benchmark.

Keep event codes, risk sets and the curve inspectable.

Plotwright turns a survival table into Kaplan-Meier curves, censor marks, confidence bands, risk counts and curve comparisons in one project.