Ask Mallard
Analysis method

Log-rank test

4 min read

The log-rank test compares survival across groups using observed and expected events at each event time.

Fit

When to use it, and when not to

Use it when

  • You want an unadjusted test of equal survival distributions over follow-up.
  • Groups are defined at the start, with comparable event definitions and independent censoring within each group.

Not when

Before you start

What you need

Decide these first
  1. Groups fixed before follow-upassignmentRecord how people entered each group. Observational groups may differ in ways the test cannot adjust for.
  2. Times and statusKeep event times, censoring times and a common definition of time zero.
  3. A planned comparisonState the groups and any stratification before looking at results.
It rests on these
  1. Within each reported group, loss to follow-up is unrelated to future event times.How to check: Record why follow-up ended. Assess how results change if those lost have a worse outlook.
  2. Different people supply independent observations.How to check: For patients grouped within clinics or families, use inference that accounts for those groups.
  3. The null hypothesis is equal survival distributions.How to check: A constant hazard ratio is not required for the null test. Changing effects can weaken its ability to detect differences.

Plain language

How it works

At each event time, the null assigns expected events in proportion to the numbers at risk. The test sums observed minus expected events and scales the sum by its variance. For two groups, the usual large-sample statistic is compared with a chi-square distribution with one degree of freedom. Mantel develops the rank-statistic approach.

The method in steps
Group risk sets at each event. Then sum observed minus expected. Then test equal survival distributions.Log-rank testGroup risk sets at eacheventSum observed minusexpectedTest equal survivaldistributionsA log-rank test gives no effect size. Crossing curves can cancel differences and reduce power. AKaplan-Meier curve that censors a competing event overstates cumulative incidence when read as one minussurvival.
Conceptual diagram. It shows the structure of the idea, not data from any study.
Reading and reporting the result

For more than two groups, an overall test does not say which groups differ. Plan any pairwise comparisons and address multiple testing. Independent censoring may differ in amount between groups. Beltangady and Frankowski show that small samples and unequal censoring affect size and power. A log-rank result never removes confounding from an observational comparison.

Worked example

A worked example

Invented for illustration
Setting
Two groups each have ten people at risk at one event time.
Question
How does the test use this risk set?
Approach
Four events occur in group A and two in group B. There are no other events; remaining people are censored later.
Result
Of six total events, group A expects 3. Its observed-minus-expected count is 1. The variance is 1.1053; the chi-square statistic is 0.90.
What it means
This small example illustrates the calculation, not a reliable large-sample test. The statistic gives no survival difference or hazard ratio.

In practice

Recent studies PubMed search · not vetted

Searching PubMed…

Watch out

Common mistakes

The one to remember

A log-rank test gives no effect size. Crossing curves can cancel differences and reduce power. A Kaplan-Meier curve that censors a competing death or another event overstates cumulative incidence when read as one minus survival.

  • Reading a small P value as a large treatment effect.Instead: Report survival estimates and uncertainty as well as the test.
  • Reading a large P value as proof of equal survival.Instead: Check precision, event counts and the pattern of the curves.

Inside Mallard

How Mallard uses this

Learn search lists Log-rank test. Plans do not link to the standalone article yet.

No Mallard code example points to this page.
Calculators: Kaplan–Meier & log-rank (§5.1).
Atlas node analysis.log_rank_test, the id a plan cue records.

Work it out

Related Learn pages

Related designs and methods

Evidence

Sources & further reading

  1. Evaluation of survival data and two new rank order statistics arising in its consideration. (opens in a new tab) · Cancer Chemother Rep
  2. Effect of unequal censoring on the size and power of the logrank and Wilcoxon types of tests for survival data. (opens in a new tab) · Stat Med · doi 10.1002/sim.4780080805
Source records, titles, authors, years and available DOIs checked against PubMed on 2026-11-06. Prepared with AI assistance; no independent professional approval is claimed. Mantel develops survival rank statistics. Beltangady and Frankowski simulate censoring patterns, size and power; their small-sample findings support caution about the asymptotic test. Mantel has no DOI in the retrieved PubMed record.
Last source review: 2026-11-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.