Log-rank test
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
- You need adjustment for other factors. Consider Cox regression when its assumptions fit. Read: Cox proportional hazards regression
- Curves cross and your question concerns average survival through a chosen time. Consider restricted mean survival time. Read: Choosing a survival measure beyond the hazard ratio
Before you start
What you need
- Groups fixed before follow-upassignmentRecord how people entered each group. Observational groups may differ in ways the test cannot adjust for.
- Times and statusKeep event times, censoring times and a common definition of time zero.
- A planned comparisonState the groups and any stratification before looking at results.
- 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.
- Different people supply independent observations.How to check: For patients grouped within clinics or families, use inference that accounts for those groups.
- 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.
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
- 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
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.
analysis.log_rank_test, the id a plan cue records.Work it out
Related Learn pages
Related designs and methods
Evidence
Sources & further reading
- Evaluation of survival data and two new rank order statistics arising in its consideration. (opens in a new tab) · Cancer Chemother Rep
- 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