Concept Architecture
Log-Rank Test: Concept Architecture
Orientation and learning roadmap
The log-rank test compares time-to-event experience using the risk sets available whenever an event occurs. This page develops its observed-versus-expected calculation, variance, assumptions, censoring requirements, relationship to Kaplan–Meier curves and Cox regression, and behavior under non-proportional hazards. It then covers stratification, competing risks, design, a worked calculation, software checks, health-economic relevance, and reproducible reporting.
Time-to-event data require risk-set comparisons
Ordinary tests of proportions ignore when events occur and how long event-free participants were observed. The log-rank test instead compares groups at each distinct event time among participants who remain at risk immediately before that time.
An event must be defined in advance, such as death, progression, relapse, or device failure. Participants without an observed event may contribute information until censoring, after which they leave later risk sets.
The null hypothesis concerns the full event-time distributions
The conventional null hypothesis states that the groups have the same survival experience over follow-up. In a two-group setting, it may be expressed as equality of survival functions or, under regular conditions, equality of hazard functions across time.
[ H_0:S_1(t)=S_0(t)\quad\text{for all relevant }t. ]
Rejecting this null indicates evidence of a difference somewhere in the event-time distributions. The test alone does not identify the size, clinical importance, direction at every time, or causal interpretation of that difference.
Each event time supplies an observed and expected count
At distinct event time (t_j), let (n_{1j}) and (n_{0j}) be the group-specific numbers at risk, and let (d_{1j}) and (d_{0j}) be the numbers of events. Under the null, the total events at that time are allocated in proportion to the risk set.
[ n_j=n_{1j}+n_{0j},\qquad d_j=d_{1j}+d_{0j}, ]
[ E_{1j}=d_j\frac{n_{1j}}{n_j}. ]
The expected count is conditional on the risk set and total number of events at that time. It is not a predicted lifetime event count for the group.
Observed-minus-expected values accumulate across follow-up
The two-group log-rank score adds the difference between observed and expected group-1 events over all distinct event times. Positive or negative contributions can offset one another when the direction of separation changes.
[ U=O_1-E_1=\sum_j(d_{1j}-E_{1j}). ]
The group label determines the sign of (U), but the usual two-sided chi-square statistic removes that sign. A signed standardized statistic may still be useful for checking direction when the event coding is clear.
The variance accounts for tied events at a time
When several events occur at the same recorded time, their conditional allocation follows a hypergeometric variance under the null. This finite-population adjustment recognizes that the event count is fixed within the risk set. The usual contribution for two groups is:
[ V_j=\frac{n_{1j}n_{0j}d_j(n_j-d_j)} {n_j^2(n_j-1)}, ]
provided (n_j>1). The total variance is (V=\sum_jV_j), with times contributing no usable variance omitted by the implementation.
The test statistic has an asymptotic reference distribution
For two groups, the squared standardized score is compared with a chi-square distribution with one degree of freedom. The large-sample result depends on adequate information in the risk sets, so sparse-event settings may require exact or permutation-based procedures.
[ Z=\frac{U}{\sqrt V}, \qquad \chi^2=\frac{U^2}{V}. ]
For (G) groups, a vector of observed-minus-expected counts and its covariance matrix produce an asymptotic chi-square statistic with up to (G-1) degrees of freedom. Rank or empty-group problems can reduce the effective degrees of freedom.
Right censoring preserves partial follow-up information
A right-censored participant is known to remain event-free through the censoring time but has an unobserved event time thereafter. The participant remains in each earlier risk set and leaves before later event times according to the study's time-ordering convention.
Independent or non-informative censoring within comparison groups is central to standard interpretation. If censoring depends on unobserved prognosis after conditioning on modeled information, the comparison may be biased.
Event and censoring times must be ordered consistently
When events and censorings share a recorded time, software must apply a defined convention for who is considered at risk at that event time. A common convention counts events before censorings at the same time, but analysts should confirm the implementation and data precision.
Rounding continuous times to days or months can create many artificial ties. Reproducing results requires the original time scale, event indicator, tie convention, and any entry time used for delayed entry.
Delayed entry changes who belongs in each risk set
Participants with left truncation enter observation only after becoming eligible and surviving to an entry time. They should contribute to risk sets only after entry, not from a common time zero they were not observed to reach under the sampling design.
Ignoring delayed entry can create immortal-time and selection distortions. The analysis data therefore need both entry and exit times when the risk origin and observation origin differ.
Kaplan–Meier curves describe what the test compares
Kaplan–Meier estimators display group-specific survival probabilities over time, while the log-rank test provides a global hypothesis test. Curves, numbers at risk, censoring marks, and confidence intervals reveal timing and precision that a p-value alone cannot show.
Two visually separated curves can produce an imprecise test when few events occur, and crossing curves can yield a weak global statistic despite important time-specific differences. Descriptive estimation and hypothesis testing should therefore be reported together.
Proportional hazards give the ordinary test its strongest interpretation
The standard log-rank test is particularly efficient against alternatives in which the hazard ratio is approximately constant over time. Proportional hazards are not required to calculate the statistic, but departures affect power and the meaning of a single global comparison.
When hazards are proportional, the log-rank score test aligns closely with the score test for a treatment indicator in a Cox proportional hazards model. This connection does not make the log-rank test an estimate of the hazard ratio.
Crossing hazards can conceal meaningful differences
If one group has higher early risk but lower later risk, positive and negative observed-minus-expected contributions may cancel. A nonsignificant log-rank result can then coexist with clinically important differences in timing, restricted mean survival time, or milestone survival.
Non-proportional hazards should be anticipated from the mechanism and assessed using plots and suitable diagnostics. Alternative estimands and prespecified analyses should address the scientific question rather than selecting a favorable test after seeing the curves.
Weighted log-rank tests emphasize selected time regions
Weighted log-rank procedures multiply each event-time contribution by a prespecified weight. Different weights can prioritize early, late, or middle follow-up, which changes the alternative against which the test has greatest power.
[ U_w=\sum_j w_j(d_{1j}-E_{1j}). ]
Weights must be selected before unblinding and justified by the expected treatment-effect pattern. Data-driven selection among several weighted tests inflates false-positive risk unless the multiplicity is controlled.
Stratification preserves planned comparisons within strata
A stratified log-rank test computes observed-minus-expected scores and variances within prespecified strata, then combines them across strata. It can improve precision and respect randomization strata without estimating a separate coefficient for every stratum.
[ U_{strat}=\sum_s U_s, \qquad V_{strat}=\sum_s V_s. ]
Strata should be prognostically relevant, defined before outcome review, and not so numerous that risk sets become sparse. The stratified test assumes a common directional treatment comparison across strata for its usual interpretation.
The test is unadjusted unless a structured extension is used
The ordinary log-rank test compares groups without adjusting for participant-level prognostic covariates. Stratification adjusts the risk-set comparison categorically, while a Cox model can incorporate covariates and estimate conditional hazard ratios under its assumptions.
Covariate adjustment should follow the design and statistical analysis plan. In observational studies, neither an unadjusted test nor a covariate-adjusted model automatically resolves confounding or selection bias.
Competing risks require a different question
When another event prevents the event of interest, treating the competing event as ordinary independent censoring changes the estimand and may misrepresent real-world event probability. Cause-specific hazard comparisons and cumulative-incidence comparisons answer different questions.
The log-rank test may be used for a cause-specific hazard analysis when other causes are censored under appropriate interpretation. Gray-type tests compare cumulative incidence functions and should not be described as ordinary log-rank tests.
Recurrent events are not handled by a first-event test alone
Standard log-rank analysis usually reduces each participant to the time until a first qualifying event. It discards subsequent events and does not represent within-person recurrence dependence.
Recurrent-event rate models, gap-time approaches, marginal models, or composite estimands may be more suitable depending on the question. The event process and intercurrent-event strategy must be defined before choosing the test.
A worked risk-set calculation shows the mechanics
Consider two groups followed over three distinct event times. The table supplies the numbers at risk and events immediately before each event-time comparison, allowing every expected count and variance contribution to be audited.
| Time | Group 1 at risk (n_{1j}) | Group 0 at risk (n_{0j}) | Group 1 events (d_{1j}) | Group 0 events (d_{0j}) | Expected group 1 events (E_{1j}) | Variance (V_j) |
|---|---|---|---|---|---|---|
| 1 | 5 | 5 | 1 | 1 | 1.0000 | 0.4444 |
| 2 | 4 | 4 | 0 | 1 | 0.5000 | 0.2500 |
| 3 | 4 | 3 | 2 | 0 | 1.1429 | 0.4082 |
Across the three times, (O_1=3), (E_1=2.6429), (U=0.3571), and (V=1.1026). The resulting statistic is (\chi^2=0.1157) with one degree of freedom, giving a two-sided asymptotic p-value of approximately (0.7338); this small illustration does not provide evidence of different survival distributions.
The p-value does not measure the treatment effect
The log-rank p-value quantifies compatibility of the observed risk-set imbalance with the null model and analysis plan. It is not the probability that survival is equal, the probability the result occurred by chance, or an estimate of clinical benefit.
Effect estimates should accompany the test, such as survival probabilities at meaningful times, median survival when estimable, restricted mean survival time, or a hazard ratio when interpretable. Absolute effects and their confidence intervals are often more useful for economic modeling than a significance label.
Sample size is driven mainly by events
Power for a conventional proportional-hazards log-rank comparison depends strongly on the number of observed events, allocation ratio, significance level, target hazard ratio, and desired power. Enrollment rate, accrual duration, follow-up, dropout, and baseline event-time distribution determine how many randomized participants are needed to obtain those events.
Event-driven designs should prespecify the triggering event count and data-cut rules. Underestimated dropout, delayed treatment effects, cure fractions, non-proportional hazards, or treatment switching can make standard proportional-hazards calculations unreliable.
Interim looks require sequential error control
Repeated log-rank testing as events accumulate increases the chance of a false-positive conclusion if ordinary fixed-sample thresholds are reused. Group-sequential boundaries and alpha-spending methods preserve a planned overall Type I error rate.
Information time is commonly linked to accumulated events or log-rank information rather than calendar time alone. Independent monitoring, prespecified stopping rules, and careful data-cut procedures protect trial integrity.
Multiplicity extends beyond interim analyses
Multiple endpoints, populations, doses, pairwise comparisons, weighted tests, and analysis times create multiple opportunities for a positive result. A testing hierarchy, gatekeeping rule, adjustment method, or clearly exploratory designation should match the claims intended.
Choosing between stratified and unstratified analyses after seeing results is also a form of analysis selection. The primary test, strata, sidedness, and tie handling should be fixed in the protocol or statistical analysis plan.
Missingness and treatment switching threaten interpretation
Loss to follow-up can violate independent censoring when it is related to prognosis, treatment tolerability, or access to care. Treatment switching and other intercurrent events can also change what a randomized group comparison estimates.
The estimand should specify population, treatment condition, endpoint, summary measure, and handling of intercurrent events. Sensitivity analyses may use inverse-probability weighting, multiple imputation, structural models, or alternative censoring rules, but each requires additional assumptions.
Health-economic models need estimates rather than only tests
Economic evaluation typically requires survival probabilities or expected survival over a model horizon, not merely evidence that two curves differ. Kaplan–Meier data may inform observed follow-up, while parametric or flexible extrapolation is often needed beyond it.
The log-rank result does not select an extrapolation distribution, validate proportional hazards, or quantify mean survival. Analysts should propagate parameter and structural uncertainty from survival modeling into costs, quality-adjusted life-years, and net benefit.
Restricted mean survival can clarify time-limited benefit
Restricted mean survival time is the area under a survival curve up to a prespecified horizon (\tau). Its group difference provides an absolute time-scale estimand that remains interpretable when hazards are non-proportional, provided the horizon is supported by follow-up.
[ RMST(\tau)=\int_0^{\tau}S(t),dt. ]
An RMST comparison answers a different question from the log-rank test and should not be presented as a replacement p-value with identical meaning. The horizon and censoring support must be justified before outcome review.
Excel can audit a small test but is not the production default
A worksheet can reproduce the event-time table by calculating total risk, total events, expected events, and variance in separate columns. This is useful for teaching and independent verification, but survival software is preferable for participant-level data, strata, delayed entry, many ties, exact procedures, or regulated analyses.
If B2:C2 contain group risk counts and D2:E2 contain group event counts, group-1 expected events are =(D2+E2)*B2/(B2+C2). The variance is =B2*C2*(D2+E2)*(B2+C2-D2-E2)/((B2+C2)^2*(B2+C2-1)), and the final statistic is the squared sum of observed-minus-expected contributions divided by the summed variance.
A disciplined log-rank workflow
Reliable testing begins with the estimand and event definition and ends with effect estimates and diagnostics that explain the global comparison. The data-cut and analysis rules should be fixed before unblinding. A practical sequence is:
- Define the endpoint. Specify the event, time origin, population, censoring rules, and handling of intercurrent events.
- Choose the comparison. Prespecify groups, allocation, sidedness, significance level, strata, and any weight function.
- Plan information. Calculate required events and model accrual, follow-up, dropout, interim looks, and multiplicity.
- Construct analysis times. Verify entry, exit, event indicators, units, duplicates, impossible times, and data-cut rules.
- Build risk sets. Confirm who is at risk immediately before every event time and how ties are ordered.
- Calculate the statistic. Accumulate observed-minus-expected events and the matching covariance or variance.
- Check assumptions. Assess censoring, proportionality, sparse strata, competing events, switching, and missing follow-up.
- Estimate effects. Report survival curves, numbers at risk, clinically meaningful time points, and suitable effect measures.
- Run sensitivity analyses. Examine prespecified alternatives for non-proportional hazards, censoring, estimands, and data definitions.
- Preserve reproducibility. Record software, code, versions, options, data provenance, outputs, and deviations from plan.
Common errors and safeguards
The log-rank calculation is compact, but its validity depends on the risk sets, censoring process, and analysis plan. The most consequential errors either misconstruct the comparison or ask the test to answer a question it does not address.
- Comparing crude event proportions instead of using event times and risk sets.
- Excluding censored participants entirely rather than retaining their observed follow-up.
- Treating informative loss to follow-up as ordinary independent censoring.
- Ignoring delayed entry or assigning participants to risk sets before observation begins.
- Interpreting a nonsignificant result as proof that survival distributions are equivalent.
- Reporting the p-value without survival curves, numbers at risk, effect estimates, and confidence intervals.
- Treating the log-rank statistic as an estimate of a hazard ratio or survival difference.
- Relying on the ordinary test when strongly crossing hazards make its global weighting unsuitable for the question.
- Selecting strata, weights, time cutoffs, or sidedness after viewing outcomes.
- Treating competing events as ordinary censoring without stating the cause-specific estimand.
- Reusing fixed-sample significance thresholds at interim analyses.
- Using a significant randomized comparison to justify an unsupported survival extrapolation.
Reproducible reporting makes the comparison auditable
A complete report identifies the endpoint, time origin, event and censoring definitions, analysis population, group coding, data-cut date, follow-up distribution, delayed-entry rules, strata, weights, sidedness, alpha, multiplicity control, and interim boundaries. It should state the exact test statistic, degrees of freedom, p-value, software and version, tie convention, and deviations from the analysis plan.
Kaplan–Meier curves should include confidence intervals, censoring marks where useful, and numbers at risk at meaningful times. Effect estimates and sensitivity analyses should explain the magnitude, timing, uncertainty, and decision relevance of the survival difference rather than leaving the log-rank p-value to carry the interpretation alone.
Related Concepts (3)
Library
Publications
1
NICE DSU Technical Support Document 15: Cost-effectiveness modelling using patient-level simulation — Davis, Stevenson, Tappenden & Wailoo, TSD 15 ed., 2014 (NICE Decision Support Unit (University of Sheffield))
Guidance on individual patient-level (microsimulation) cost-effectiveness modelling — when to use it in preference to cohort models, how to structure it, and how to handle the associated computational and uncertainty challenges.
Frequently Asked Questions (6)
What is the log-rank test?
A hypothesis test comparing survival distributions between groups by comparing observed and expected event counts at each event time.
Source: Mantel 1966
Why is the log-rank test most powerful under proportional hazards?
The log-rank test gives equal weight to differences between the groups at every event time, which makes it most sensitive when the gap between the groups is consistent throughout, the situation described by proportional hazards. When the curves cross or the difference is concentrated in one period, this even weighting can dilute a real effect, and the test loses power. It is therefore well matched to steadily separating curves and less suited to other patterns. Bland and Altman (2004) explain this property.
Source: Bland & Altman 2004
How does the log-rank test work?
The log-rank test works by, at each event time, computing the number of events expected in each group under the null hypothesis of equal survival, based on the numbers at risk, and comparing these with the observed events. The differences are accumulated across all event times into a test statistic that, under the null, follows a chi-squared distribution. A large statistic indicates the observed events depart from those expected under equal survival, so the survival distributions differ between the groups.
Source: Mantel 1966
What assumptions underlie the log-rank test?
The log-rank test assumes that censoring is non-informative and that, for greatest power, the hazards are proportional between groups, meaning the ratio of hazards is roughly constant over time. It gives equal weight to events at all times. When hazards are proportional, the log-rank test is the most powerful rank test for detecting a difference, but when they are not, for instance if survival curves cross, it can lose power, so its assumptions and the pattern of the curves are considered.
Source: Kalbfleisch & Prentice 2002
When is the log-rank test used?
The log-rank test is used to compare survival between groups, such as treatment arms in a clinical trial, when a non-parametric test of whether the survival distributions differ is wanted. It is the standard test accompanying Kaplan-Meier curves. It is most appropriate when hazards are proportional, and it tests for a difference without quantifying its size, for which the Cox model is used. Where the treatment effect varies over time or curves cross, weighted variants may be preferred.
Source: Mantel 1966
What are the limitations of the log-rank test?
The log-rank test tests whether survival distributions differ but does not quantify the size of the difference, for which a measure such as a hazard ratio is needed. It is most powerful under proportional hazards and can lose power when hazards are non-proportional or survival curves cross, since its equal weighting of events may then miss differences concentrated in a period. It also assumes non-informative censoring. These limitations mean it is complemented by regression models and, where appropriate, weighted tests.
Source: Mantel 1966
Trust Record
Verified by Dr Darrin Baines
British health economist
Professional identity: darrinbaines.org
Verification date: 24 Sep 2026
Content version: 1.0.0
Canonical Identity
- Persistent URI
- https://healtheconomics.wiki/concept/log-rank-test
- Term code
- HE-EM-SM-049
Stable URI · Machine-readable · Resolvable · CC BY 4.0
