Log-Rank Test
The log-rank test (Mantel–Cox test) is a non-parametric hypothesis test in survival analysis that compares the time-to-event distributions of two or more right-censored cohorts by summing observed-minus-expected failure counts across all ordered event times.
Log-rank test (also known as the Mantel–Cox test or Peto–Peto log-rank statistic) is the foundational non-parametric hypothesis test in biostatistics, randomized clinical trials, and longitudinal epidemiology for testing whether the time-to-event distributions of two or more independent groups are identical in the presence of right-censored observations. First derived by Nathan Mantel in 1966 as a time-stratified extension of the Cochran–Mantel–Haenszel test and subsequently named and proved to be locally most powerful under proportional hazards alternatives by Richard Peto and Julian Peto in 1972, the log-rank test serves as the inferential companion to the Kaplan–Meier estimator. By constructing a conditional 2 × 2 contingency table at every distinct failure time and comparing the observed event count in each arm against its hypergeometric expectation under the null hypothesis of equal hazard rates, the log-rank test evaluates whole-curve survival differences without assuming any parametric form for the underlying baseline hazard function.
Mathematical Formulation and Hypergeometric Contingency Structure
Risk-Set Stratification at Ordered Event Times
Suppose two independent treatment or exposure groups—Group 1 (experimental intervention) and Group 2 (control or standard of care)—are followed prospectively over time t ≥ 0 in a clinical trial or cohort study. Individual failure times are subject to independent, non-informative right-censoring (administrative study termination, withdrawal, or loss to follow-up). Let the pooled sample across both arms exhibit J distinct, ordered failure times t1 < t2 < ··· < tJ.
At each distinct event time tj (j = 1, …, J), the investigator constructs a 2 × 2 contingency table conditioned on the marginal risk set just prior to tj (tj−) and the total number of failures occurring at tj:
- Let n1j and n2j denote the number of individuals still at risk (alive and uncensored) just prior to time tj in Group 1 and Group 2, respectively, with total risk set nj = n1j + n2j.
- Let d1j and d2j denote the observed number of failure events occurring at time tj in Group 1 and Group 2, respectively, with total events dj = d1j + d2j.
Under the null hypothesis H0 : S1(t) = S2(t) for all t ≥ 0 (equivalently, equal instantaneous hazard rates h1(t) = h2(t)), every individual in the pooled risk set nj shares the same conditional probability of failing at tj. Conditioned on the fixed row margins (dj total events and nj − dj survivors) and column margins (n1j and n2j), the random variable O1j = d1j follows a central hypergeometric distribution with conditional expectation E1j and conditional hypergeometric variance V1j:
When survival times are continuous and untied (dj = 1 at every event time tj), the finite-population tie-correction factor (nj − dj) / (nj − 1) simplifies to unity, reducing V1j to the Bernoulli variance (n1j n2j) / nj2 = p1j (1 − p1j), where p1j = n1j / nj is the proportion of the active risk set belonging to Group 1.
Summing Observed-Minus-Expected Increments and Martingale Interpretation
Summing the discrepancy O1j − E1j across all J ordered failure times yields the unstandardized log-rank score statistic UL = ∑j=1J (d1j − E1j). In the counting-process and martingale framework formalized by Per Kragh Andersen and Richard D. Gill (1982), UL is a stochastic integral of predictable risk-set processes with respect to a zero-mean counting-process martingale under H0. Consequently, the increments (d1j − E1j) at distinct failure times t1 < ··· < tJ are uncorrelated, and the variance of their sum equals the sum of their conditional hypergeometric variances VL = ∑j=1J V1j.
Standardizing UL yields the two-sided Mantel–Cox log-rank test statistic:
A simpler conservative approximation often used in descriptive epidemiology replaces the hypergeometric denominator with the Poisson expected counts E1 = ∑ E1j and E2 = ∑ E2j, giving χ2approx = (O1 − E1)2 / E1 + (O2 − E2)2 / E2, though the hypergeometric denominator VL is always preferred because it remains unbiased when tied events occur or when group risk sets become unbalanced late in follow-up.
Equivalence to the Cox Score Test and Extensions
Local Optimality Under Lehmann Alternatives
Peto and Peto (1972) derived the name log-rank test by connecting the rank order of censored observations to the score function of the exponential and Weibull family under Lehmann alternatives, where the survival functions of two groups satisfy S1(t) = [S0(t)]ψ for a constant hazard ratio ψ = h1(t) / h0(t) = exp(β). In the proportional hazards model introduced by David R. Cox in 1972, h(t | X) = h0(t) exp(β X) with a single binary group indicator X ∈ {0, 1}, the partial log-likelihood score function U(β) evaluated at the null value β = 0 is identical to the Mantel–Cox numerator:
and the observed Fisher information I(β = 0) under the discrete-time Cox partial likelihood equals ∑j=1J V1j. Thus, the log-rank test is the Rao score test of β = 0 in a univariate Cox regression model. By the Neyman–Pearson theory of rank-invariant tests, the log-rank test is asymptotically Pitman-efficient (locally most powerful) whenever the true data-generating mechanism obeys proportional hazards.
K-Sample, Stratified, and Trend Log-Rank Tests
When comparing K > 2 treatment arms, the scalar difference O1j − E1j generalizes to a (K − 1)-dimensional vector uj with components Okj − Ekj (k = 1, …, K − 1) and a (K − 1) × (K − 1) multivariate hypergeometric covariance matrix Vj whose diagonal entries are Vkk,j and off-diagonal entries are:
The quadratic form U⊤ V−1 U follows an asymptotic χ2 distribution with K − 1 degrees of freedom. In multicenter trials or observational studies confounded by baseline prognostic strata s = 1, …, S (such as clinical tumor stage or age decile), the stratified log-rank test computes Us and Vs separately within each stratum s and sums them prior to squaring: χ2strat = (∑s=1S Us)2 / (∑s=1S Vs). If the K groups represent ordered dose levels z1 < z2 < ··· < zK, the 1-degree-of-freedom log-rank test for trend evaluates whether hazard rates increase or decrease monotonically across doses.
Comparison with Weighted Non-Parametric Survival Tests
Because the standard log-rank test assigns weight wj = 1 to every failure time tj regardless of how many subjects remain at risk, its statistical power degrades markedly when the proportional hazards assumption fails—such as when two Kaplan–Meier survival curves cross, when a surgical procedure carries early perioperative mortality followed by long-term cure, or when an immunotherapy agent exhibits a delayed onset of clinical benefit. In those settings, investigators choose members of the Fleming–Harrington test family or summary metrics such as restricted mean survival time (RMST).
| Test Procedure | Weight Function wj at Event Time tj | Primary Sensitivity Regime | Optimal Hazard Ratio Structure | Vulnerability / Failure Mode |
|---|---|---|---|---|
| Mantel–Cox Log-Rank Test | wj = 1 (equal weight at all tj) | Uniform sensitivity across entire follow-up horizon | Proportional hazards: h1(t) / h0(t) = exp(β) constant | Low power under crossing survival curves or early transient effects |
| Gehan–Breslow Generalized Wilcoxon | wj = nj (total number at risk at tj) | Early failure times when nj is large | Early hazard separation that attenuates over time | Weight depends on administrative censoring pattern as well as survival |
| Tarone–Ware Test | wj = √nj | Intermediate early-to-mid follow-up | Moderate early-to-mid hazard divergence | Still influenced by unequal censoring distributions across arms |
| Peto–Peto / Prentice–Wilcoxon | wj = Ŝ(tj−1) (pooled Kaplan–Meier survival) | Early failure times, invariant to censoring rates | Proportional odds survival alternatives | Reduced sensitivity to late tail separation |
| Fleming–Harrington G(ρ, γ) | wj = [Ŝ(tj−1)]ρ [1 − Ŝ(tj−1)]γ | Tunable: early (ρ > 0, γ = 0), mid (ρ > 0, γ > 0), or late (ρ = 0, γ > 0) | Delayed treatment effect (immuno-oncology, vaccines) when γ > 0 | Pre-specification of (ρ, γ) required to avoid Type I error inflation |
Sample Size Determination and Clinical Trial Design
Schoenfeld's Event-Driven Power Formula
In randomized controlled trials with a time-to-event primary endpoint, statistical power is governed by the total number of observed events (D) rather than the total number of enrolled patients (N) alone. Using the asymptotic distribution of the log-rank statistic under local proportional hazards alternatives with true log hazard ratio θ = ln(HR), David A. Schoenfeld (1981) derived the required total event count D for a two-sided significance level α and statistical power 1 − β:
where p is the allocation proportion randomized to Group 1 (for 1:1 randomization, p (1 − p) = 0.25, so the numerator is multiplied by 4). For example, detecting a hazard ratio of HR = 0.75 (ln 0.75 = −0.2877) with 80% power (z0.80 = 0.8416) at a two-sided α = 0.05 (z0.975 = 1.9600) under 1:1 randomization requires D = 4 × (1.9600 + 0.8416)2 / (−0.2877)2 ≈ 380 total observed events across both arms. Once D is fixed, trialists choose total enrollment N and accrual/follow-up duration to achieve D expected failures given the anticipated baseline hazard and dropout rate.
Validity Conditions and Competing Risks
Like the Nelson–Aalen estimator and the Kaplan–Meier curve, the log-rank test requires independent (non-informative) censoring within each group: patients censored at time t must carry the same conditional hazard of subsequent failure as uncensored patients remaining in the risk set. When a secondary event precludes observation of the primary endpoint (such as non-cancer mortality in an oncology relapse trial), applying the standard log-rank test to cause-specific censoring tests only the cause-specific hazard functions rather than the cumulative probability of the event; comparing cumulative incidence across groups in the presence of competing risks requires Gray's test (1988) on subdistribution hazards.
References
- Mantel, N. (1966). "Evaluation of survival data and two new rank order statistics arising in its consideration." Cancer Chemotherapy Reports, 50(3), 163–170. https://pubmed.ncbi.nlm.nih.gov/5910392/
- Peto, R., & Peto, J. (1972). "Asymptotically efficient rank invariant test procedures." Journal of the Royal Statistical Society: Series A (General), 135(2), 185–207. https://doi.org/10.2307/2344317
- Cox, D. R. (1972). "Regression models and life-tables." Journal of the Royal Statistical Society: Series B (Methodological), 34(2), 187–220. https://doi.org/10.1111/j.2517-6161.1972.tb00899.x
- Schoenfeld, D. (1981). "The asymptotic properties of nonparametric tests for comparing survival distributions." Biometrika, 68(1), 316–319. https://doi.org/10.1093/biomet/68.1.316
- Andersen, P. K., & Gill, R. D. (1982). "Cox's regression model for counting processes: A large sample study." The Annals of Statistics, 10(4), 1100–1120. https://doi.org/10.1214/aos/1176345976