Comparing survival between groups: the log-rank test A p-value tells you whether two survival curves differ. Which test you use decides where along the follow-up a difference has to appear to count — and that choice can change the answer.

After estimating a Kaplan–Meier curve for two or more groups, the obvious question is whether they really differ, or whether the separation you see is noise. You cannot answer it with a t-test or a chi-square on the survival times. Most of those times are censored. The log-rank test and its weighted relatives are built for exactly this. They compare the groups using every subject for as long as they were observed, and handle censoring correctly.

What the log-rank test does

At each time an event occurs, the test works out how many events you would expect in each group if survival were identical. The expected number is the group’s share of the subjects still at risk at that instant, and the test compares it with how many events actually occurred.

Summing the observed-minus-expected difference across all event times gives a statistic that is large when one group consistently has more events than its share, and small when the groups track each other. The risk set is recomputed at every event time. Censored subjects drop out cleanly and contribute for exactly as long as they were followed. Under the null hypothesis of equal survival, the statistic follows a chi-square distribution.

The weighting decides what you can detect

The log-rank test weights every event time equally. That makes it most powerful when the hazard ratio between groups is roughly constant over follow-up, when the curves separate steadily. Real differences are not always like that. Two treatments may diverge sharply early and then converge. A delayed effect may show nothing for a year and then pull apart. A test that weights all times equally can miss a difference concentrated at one end.

The weighted tests re-weight the same observed-minus-expected contributions. The Wilcoxon (Breslow) test weights early event times more heavily, which makes it sensitive to early separation. Tarone–Ware sits between the two. The Fleming–Harrington family lets you set the weight function explicitly, emphasising early, late, or middle differences as the clinical question demands.

Two Kaplan-Meier step curves for groups A and B that separate early and stay apart, with the early region shaded to show where the Wilcoxon test weights most heavily and the late region shaded to show where a Fleming-Harrington weighting can emphasise.
The same two curves, weighted differently. The log-rank test weights every event time equally. Wilcoxon emphasises early differences. Fleming–Harrington can be pointed at late ones. When a difference is concentrated at one end of follow-up, the weighting you choose can change whether the test reaches significance.

The choice of test is a decision about the clinical question, not a technicality, and it should be made before you see the data. Picking the test that gives the smallest p-value after the fact is the survival-analysis version of choosing a diagnostic cut-off on the same sample you evaluate it on. Either practice manufactures significance out of freedom.

Reading the result

A group-comparison test answers one question: is there a difference? What it does not tell you is how large the difference is, in which direction, or whether it matters clinically. A significant log-rank test with two curves a hair apart across a huge cohort is real but trivial. A non-significant test on a small study may simply be underpowered.

Always read the test alongside the curves themselves and, where you need an effect size, a hazard ratio from a Cox model. The p-value is the beginning of the interpretation, not the end of it.

Kaplan-Meier survival curves for two treatment groups with simultaneous confidence bands, and below them a log-rank test table reporting a chi-square statistic and a p-value of 0.3472.
Two groups compared with the log-rank test. The curves separate visibly (median survival is 258 days against 488), yet with only 19 and 11 patients the confidence bands overlap throughout and the test does not reject (p = 0.3472). Read that as “no difference detected in this sample”, not as proof the treatments are equivalent.

Common mistakes

Using a test that ignores censoring. A t-test or chi-square on survival times is wrong when observations are censored. The log-rank family is built to handle it.

Choosing the test after seeing the data. Running all four weightings and reporting the one that reaches significance inflates the false-positive rate. Choose the weighting from the clinical question, in advance.

Reading a p-value as an effect size. The test says whether the curves differ, not by how much. Pair it with the curves and a hazard ratio.

Treating “not significant” as “equivalent”. A non-significant comparison may be underpowered. Absence of a detected difference is not evidence of no difference.

Compare survival between groups with Analyse-it

Analyse-it tests the equality of survival functions on your own data, inside Excel:

  • Log-rank, Wilcoxon (Breslow), Tarone–Ware and Fleming–Harrington tests — four weightings for different clinical questions
  • Alongside Kaplan–Meier estimation and Cox regression, in the same workbook
  • So the weighting is a choice about where the difference matters, not whatever the software offered

Every feature from all five editions for 15 days. Survival analysis is in the Medical and Ultimate editions, from US$ 340 a year.