# The logrank test statistic is equivalent to the score of a Cox regression. Is there an advantage of using a logrank test over a Cox regression?

I have understood the logrank test as a "safe" or "conservative" way to check for a difference between two survival curves. It is "safe" in the sense that it is a nonparametric test of $$h_1(t) = h_2(t)$$, where $$h_i( \cdot)$$ is the hazard function of the $$i^{th}$$ group. I can't find sources that support this claim of "safety", so I've either invented this interpretation myself or observed it from others over the years.

I have seen sources that say that the logrank test statistic is equivalent to the score test (also called the Legrange multiplier test). I am pulling definitions from these course notes (pg. 14) for anyone who wants to look. The score of a Cox model is $$\sum_{i=1}^{n} \delta_{i}\left\{Z_{i}-E\left(Z ; T_{i}\right)\right\},$$ where $$\delta_i$$ is an indicator of whether the subject $$i$$ has an event, $$T_i$$ is the possibly-censored survival time, $$Z_i$$ is a covariate like treatment assignment, and $$E\left(Z ; T_{i}\right)$$ is the expectation of $$Z_i$$. This is equivalent (or analogous??) to the "Observed - Expected" form of the logrank test.

I have two related questions:

1. Since the logrank test and Cox regression have this equivalence, is my perception incorrect that the logrank test is "safer" than Cox regression?
2. A cox model assumes that the hazard functions are proportional with the same baseline hazard: $$h(t | Z_i) = h_0(t) * \exp(Z_i \times \beta)$$. I am not aware of any assumptions for the logrank test. My perception has always been that a logrank test statistics must be better than Cox regression in terms of power or asymptotic efficiency or something since it is not making an assumption of proportional hazards. Is this actually true?
• A good discussion, but not a complete answer to your questions, here: discourse.datamethods.org/t/… Commented Sep 9, 2020 at 18:46
• Could you please let me know where I can find the references for the presented notes? I've searched on books and articles but I haven't been able to find the sources for pages 26, 27 and 28. Thank you so in advance! Commented Aug 11, 2021 at 10:08
• @Raquel course notes like these often don't include references. The content on pages 26-28 is based on standard log-partial-likelihood formulas for a Cox model, to be found starting on page 13 of those notes and in most survival-analysis texts, and its score test. What's missing is direct comparison to the equivalent form of the usual logrank test, in the notes for lecture 3 in this course.
– EdM
Commented Aug 11, 2021 at 16:54

There is no advantage to using the log-rank statistic and several disadvantages:

• Unlike the Cox model, log-rank does not generalize to a Bayesian framework
• the log-rank test only works for mutually exclusive categories and does not handle a continuous exposure variable
• log-rank does not allow for general covariate adjustment

Since the log-rank test is a special case of the Cox model, it does not have fewer assumptions or more power. IMHO we no longer need to be using or teaching the log-rank test.

• Thank you. I was never concerned about those disadvantages, though a reminder is helpful. I thought of log-rank as a barebones Frequentist test when you only had a covariate for treatment assignment. I have been genuinely surprised to see it is equivalent to Cox regression.
– Eli
Commented Sep 9, 2020 at 19:29
• Two advantages of the log-rank statistic over traditional Cox PH: it can give you a p-value if one of the groups has zero events while Cox PH cannot (perfect separation = unbounded MLE's). Second, if a priori we believe the difference should be heaviest at a certain time, we can upweight that region of time for more power. Commented Jan 3 at 17:11
• Beg to differ. Nothing is wrong with the likelihood ratio $\chi^2$ tests in the Cox model if there is perfect separation. And yes you can change weights if not using likelihood-based inference (which is quite a loss) but the estimand becomes impossible to describe. Commented Jan 4 at 7:45
• Both our statements are correct: likelihood ratio test is statistical valid in the case of perfect separation...but numerical errors will occur, i.e. survival's coxph will throw a warning about failure to converge. You and I may be fine ignoring that warning, but biologists who did not publish a book on regression models may be more cautious ;) Commented Jan 5 at 3:17
• No, that is only a warning and can be completely ignored. Commented Jan 5 at 7:08

The relation between the log-rank test and the Cox PH model is very similar to that of the two-sample t-test and linear regression. That is, for a standard log-rank test, it is roughly equivalent to fitting a Cox-PH model with an indicator for group. There is a corner case in which the standard log-rank has some advantage: if one of the groups events are earlier than all of the other (or all censored), this causes perfect separation of the data and can lead to unbounded MLE's, causing numeric issues.

But similar to the two sample t-test with unequal variances and linear regression, log rank statistics can be generalized in ways that are not so simple (or at least, not readily implemented) for regression models. In particular, the weighted log-rank statistic allows us to upweight parts of the survival curve where we suspect the hazard ratios to differ the most and thus regain power in the case of non-proportional hazards.

For some discussion, see "Is it time for the weighted log-rank test to play a more important role in confirmatory trials?" by Zheng Su (2018).

• This is problematic. Please see my comment above. Commented Jan 4 at 7:45
• A better approach which is powerful and much more interpretable is here. Commented Jan 4 at 7:58
• You know better than to flatly say "more powerful". You mean "more powerful under certain conditions". Weighted log-rank statistics are all about getting closer to those conditions by using a priori information about where the hazards differ the most. In the case something like cancer treatments, the medical researchers are very likely to have a very good idea a priori about when the hazards between the groups should change the most based on their knowledge of cancer mechanisms. Weighted log-rank statistics is still a fairly active area of statistical research. Commented Jan 5 at 3:21
• Weighted analyses are attempts at keeping the treatment comparison at one degree of freedom to preserve power. But when the analyst uses the data to select the weight, the type I assertion probability $\alpha$ is not preserved. The 2 d.f. accelerated test (Cox model with one time-dependent covariate that involves log(t)) has a perfect multiplicity adjustment and unlike weighted tests provide interpretable estimates. And weighted methods don't extend to handle things like multiple levels of clustering. Commented Jan 5 at 7:30
• Yep, agreed that standard weight log rank is about getting back that df via prior knowledge. Fwiw, a recent review finds the Breslow test to be generally have less power than recent adaptive weighted log-rank tests, such as MaxCombo: arxiv.org/pdf/1909.09467.pdf Commented Jan 5 at 7:48