Durgical
EN
Open the app

Log-rank test

  • Statistical test

It compares whole survival curves: at each event it checks whether a group had more events than its size would predict.

Updated

What it is

The log-rank test compares the survival of two or more groups over the whole follow-up, not at a single point. At each event time it calculates how many events each group would be expected to have if the risk were equal, given how many people it has at risk, and then compares the observed total with the expected total through a χ² statistic. It weighs all times equally and is most powerful when hazards are proportional.

When to use it

  • Comparing time to an event between two or more groups, with censoring.
  • It goes with Kaplan-Meier curves in almost every trial with a time-to-event outcome.
  • To adjust for other variables, the Cox model is used.

Worked example

  1. Data: group A (4 patients): deaths at 3 and 9 months, censored at 7 and 12. Group B (4): deaths at 2, 4 and 6, censored at 8.
  2. Month 2: at risk A 4, B 4; one B patient dies. Expected in A = 1 × 4/8 = 0.50.
  3. Month 3: A 4, B 3; one A patient dies. Expected in A = 4/7 = 0.57.
  4. Month 4: A 3, B 3; one B dies: 3/6 = 0.50. Month 6: A 3, B 2; one B dies: 3/5 = 0.60.
  5. Month 9: A 2, B 0; one A dies: expected in A = 2/2 = 1.00.
  6. A: observed 2, expected 0.50 + 0.57 + 0.50 + 0.60 + 1.00 = 3.17. B: observed 3, expected 5 − 3.17 = 1.83.
  7. χ² ≈ (2 − 3.17)² / 3.17 + (3 − 1.83)² / 1.83 = 0.43 + 0.75 = 1.18 with 1 df; p ≈ 0.28.
  8. Reading: B had more deaths than expected, but with 8 patients the difference is compatible with chance.

Markers

  • O
  • E
  • χ²
  • log-rank

Assumptions and pitfalls

  • Using log-rank when the curves cross without noting the loss of power.
  • Reporting only the log-rank p value without the HR and its CI.
  • Comparing the share who died by the end with a χ² test, ignoring time and censoring.

Test yourself

Think of the answer, then tap the question to see it.

What does the log-rank test compare?

The whole survival curves of two or more groups, using every event time and the censoring.

How is the expected number of events in a group at a given time calculated?

Total events at that time multiplied by the share of people at risk who belong to that group.

What does the log-rank test not tell?

The size of the difference: the hazard ratio (HR) with its confidence interval reports that.

When does the log-rank test lose power?

When hazards are not proportional, for example when the survival curves cross.

Add to my cards (4)

Connections

← All of epidemiology

Educational content on epidemiological and statistical methods; the examples use made-up numbers to teach the calculation. Not a clinical or legal guide: current Colombian rules are in the official sources.

Sources: How do you compare reliability between two or more populations? (NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology, 2012); Empirical model fitting - distribution free (Kaplan-Meier) approach (NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology, 2012); Chapter 6: Choosing effect measures and computing estimates of effect (Cochrane, 2024).

Spotted a mistake?We are always improving for the community. Tell us what is wrong and our team will review it.Report a mistake

Representative model, for educational purposes only.