Introduction
Clinical studies frequently compare treatments using a time-to-event endpoint. Examples include overall survival, progression-free survival, time to relapse, time to treatment failure, and time to cardiovascular hospitalization.
These endpoints differ from ordinary continuous or binary outcomes because not every patient necessarily experiences the event during follow-up. A patient may complete the study without an event, withdraw, or remain event-free when the database is locked. Such an observation is censored.
The Kaplan–Meier estimator is commonly used to describe the survival experience within each treatment group. The natural next question is whether the observed survival curves provide statistical evidence that the groups differ.
The Clinical Question
Suppose a randomized clinical trial compares an experimental treatment with control and follows patients until death, disease progression, or censoring. Let \(S_1(t)\) and \(S_2(t)\) denote the survival functions for the two groups. The log-rank test evaluates the null hypothesis:
against the alternative that the survival distributions differ.
In a two-group comparison, the test is typically presented as a two-sided test. The direction of the difference is then examined using the Kaplan–Meier curves and other effect estimates such as a hazard ratio.
Why Ordinary Tests Are Not Enough
A standard comparison of mean survival time is often inappropriate because survival data are usually censored and may be highly skewed.
For example, suppose one treatment group has several patients who are still alive at the end of follow-up. Their exact survival times are unknown. We know only that their survival exceeds their observed follow-up time.
Simply treating those patients as if their observed follow-up time were their true survival time would bias the analysis.
The log-rank test avoids this problem by using the information available at each observed event time while properly accounting for patients who are still at risk and those who have already been censored.
Relationship to the Kaplan–Meier Curve
The Kaplan–Meier estimator describes survival within each group:
where \(n_i\) is the number at risk immediately before event time \(t_i\), and \(d_i\) is the number of events at that time.
The log-rank test uses a related risk-set framework, but instead of estimating a survival probability, it asks whether the pattern of events differs between groups.
The Basic Log-Rank Idea
At every time at which an event occurs, we know how many patients are still at risk in each treatment group. Suppose at one event time:
| Quantity | Treatment | Control | Total |
|---|---|---|---|
| Patients at risk | 40 | 60 | 100 |
| Observed events | 2 | 3 | 5 |
If the two groups have identical survival distributions, the five events should be distributed approximately in proportion to the numbers at risk.
The expected number of events in the treatment group is therefore:
The control group would have:
In this particular risk set, the observed and expected event counts are identical.
The log-rank test repeats this calculation across all event times and combines the differences between observed and expected events.
Observed and Expected Events
For a two-group comparison, define:
- \(O_1\) = total observed events in Group 1
- \(E_1\) = total expected events in Group 1 under the null hypothesis
- \(O_2\) = total observed events in Group 2
- \(E_2\) = total expected events in Group 2
At event time \(t_j\), let:
- \(n_{1j}\) = Group 1 patients at risk
- \(n_{2j}\) = Group 2 patients at risk
- \(n_j=n_{1j}+n_{2j}\) = total patients at risk
- \(d_j\) = total events at \(t_j\)
The expected number of Group 1 events at that time is:
The expected total for Group 1 is obtained by summing over all event times:
The same calculation applies to Group 2.
A Small Worked Risk-Set Example
Suppose a trial has the following risk set at a particular event time.
| Quantity | Experimental | Control |
|---|---|---|
| At risk | 50 | 50 |
| Events at this time | 1 | 4 |
| Total at risk | 100 | |
| Total events | 5 | |
Under the null hypothesis, the expected number of experimental events is:
The observed number is only 1. Therefore, the experimental group has:
A negative difference is consistent with fewer events than expected in the experimental group.
The log-rank test accumulates this type of discrepancy over all event times. One isolated event time is not enough to establish a treatment effect.
The Log-Rank Test Statistic
For two groups, the basic log-rank statistic can be expressed as:
Under the null hypothesis and with a sufficiently large number of events, the statistic is approximately standard normal.
An equivalent chi-square formulation is:
For a two-group comparison, this statistic has approximately a chi-square distribution with:
The p-value is obtained by comparing the observed statistic with the corresponding reference distribution.
Variance of the Observed-minus-Expected Difference
For a simple two-group setting with one event at each event time, the variance contribution can be written approximately as:
The total variance is obtained by summing the contributions over event times:
The log-rank statistic can then be written as:
In practice, statistical software performs these calculations automatically, including appropriate handling of tied event times.
Complete Clinical Example
Consider a randomized Phase III oncology trial comparing an experimental treatment with control. The primary time-to-event endpoint is progression-free survival. The analysis includes:
| Parameter | Value |
|---|---|
| Experimental group | 100 patients |
| Control group | 100 patients |
| Total sample size | 200 patients |
| Primary endpoint | Progression-free survival |
| Analysis | Kaplan–Meier + log-rank test |
| Hypothesis | Two-sided |
Suppose that by database lock:
| Outcome | Experimental | Control | Total |
|---|---|---|---|
| Patients | 100 | 100 | 200 |
| Observed progressions/deaths | 60 | 75 | 135 |
| Censored | 40 | 25 | 65 |
The experimental group has fewer events than the control group. However, comparing the raw event counts alone is not sufficient.
A patient who remains event-free for a long period contributes information before censoring. The log-rank test therefore evaluates events in relation to the risk sets at each event time.
Step 1: Construct the Risk Sets
Imagine that the event history produces several distinct event times. At each event time, patients who have already experienced the event or have already been censored are no longer included in the risk set.
For illustration, consider three representative event times.
| Event Time | Experimental at Risk | Control at Risk | Total Events |
|---|---|---|---|
| \(t_1\) | 100 | 100 | 1 |
| \(t_2\) | 94 | 97 | 1 |
| \(t_3\) | 88 | 94 | 1 |
At \(t_1\), for example, the expected number of experimental events is:
If the event occurred in the experimental group, its contribution to \(O-E\) would be:
If the event occurred in the control group, the contribution would instead be:
The actual test uses the entire sequence of event times rather than only these three illustrative times.
Step 2: Sum Observed and Expected Events
Suppose the complete event-time calculation gives:
| Quantity | Experimental | Control |
|---|---|---|
| Observed events \(O\) | 60 | 75 |
| Expected events \(E\) | 67.5 | 67.5 |
| Observed − Expected | -7.5 | +7.5 |
The experimental group experienced fewer events than expected under the null hypothesis.
Step 3: Calculate the Test Statistic
Suppose the variance of the observed-minus-expected difference is:
The log-rank chi-square statistic is then:
which gives approximately:
With one degree of freedom, this corresponds to a two-sided p-value of approximately:
This illustrative result would not meet the conventional 0.05 significance threshold.
What a Significant Log-Rank Test Means
Suppose instead that the analysis produced:
A conventional interpretation would be:
There is statistically significant evidence that the survival distributions differ between the treatment groups.
If the experimental group also has fewer observed events than expected and its Kaplan–Meier curve lies above the control curve, the result would be consistent with better survival under the experimental treatment.
However, the log-rank p-value should not be interpreted as a measure of effect size.
What the Log-Rank Test Does Not Tell You
A p-value does not tell you:
- How large the treatment effect is
- Whether the effect is clinically meaningful
- The median survival time by itself
- The hazard ratio
- Whether the proportional hazards assumption is satisfied
- Whether the treatment is beneficial at every point in time
For these questions, the log-rank test should be considered alongside the Kaplan–Meier estimates, confidence intervals, and an appropriate effect measure such as a hazard ratio.
Log-Rank Test and the Hazard Ratio
The log-rank test and Cox proportional hazards regression are closely related, but they answer somewhat different questions.
| Method | Primary role |
|---|---|
| Kaplan–Meier | Describe survival over time |
| Log-rank test | Test whether survival distributions differ |
| Cox regression | Estimate hazard ratios and adjust for covariates |
A typical clinical trial presentation therefore includes all three components.
Why Censoring Matters
Censoring is one of the defining features of survival analysis. Suppose a patient enters a study and remains progression-free for 18 months, but the study ends at that point. We know that the patient's progression time is greater than 18 months, but we do not know the exact progression time.
The patient therefore contributes information to the risk sets for the period during which the patient is known to be event-free.
When the patient is censored, the patient leaves the risk set.
Assumptions Behind the Log-Rank Test
The log-rank test relies on the validity of the survival-analysis framework, including appropriate handling of censoring.
A particularly important assumption is that censoring is appropriately independent of the future event process, conditional on the information used in the analysis.
In practical terms, informative censoring can bias survival comparisons.
The log-rank test also has an important relationship with the proportional hazards framework.
It is generally most powerful when the groups differ through a reasonably consistent hazard ratio over time.
Crossing Survival Curves
Consider a situation in which Treatment A has better survival early but worse survival later. The Kaplan–Meier curves may cross.
In that setting, positive and negative contributions to the log-rank statistic can partially cancel.
Consequently, a nonsignificant log-rank test does not necessarily mean that the treatments behave identically throughout follow-up.
If crossing curves are anticipated, investigators should consider whether alternative approaches are more appropriate, such as weighted log-rank tests, restricted mean survival time, or other prespecified estimands.
Weighted Log-Rank Tests
The ordinary log-rank test gives broadly similar weight to event times through the risk-set comparison.
Weighted log-rank tests modify this weighting. Depending on the weighting scheme, more emphasis can be placed on early or late differences.
| Situation | Potential consideration |
|---|---|
| Proportional hazards approximately plausible | Ordinary log-rank test |
| Early treatment effect is especially important | Consider an appropriate weighted test |
| Late separation is especially important | Consider an appropriate weighted test |
| Substantial curve crossing | Consider RMST or other prespecified alternatives |
The choice should be specified before examining treatment differences whenever possible.
Stratified Log-Rank Tests
Randomized trials may contain important stratification factors such as disease stage, geographic region, prior therapy, or baseline risk group.
A stratified log-rank test compares treatment groups while accounting for predefined strata.
Within each stratum, the observed and expected event counts are calculated using the relevant risk sets. The contributions are then combined across strata.
where \(s\) indexes the strata.
More Than Two Treatment Groups
The log-rank framework can also compare more than two groups. For example, a three-arm trial might compare:
- Experimental Treatment A
- Experimental Treatment B
- Control
The overall test asks whether there is evidence that at least one survival distribution differs from the others.
If the overall test is significant, investigators may perform prespecified pairwise comparisons, with appropriate consideration of multiplicity.
| Analysis | Question |
|---|---|
| Overall log-rank test | Do any groups differ? |
| Pairwise log-rank tests | Which specific groups differ? |
| Adjusted pairwise analysis | How should multiplicity be controlled? |
How Statistical Software Reports the Test
Most statistical software reports the log-rank test directly from the survival
data.
For example, in R, a typical analysis uses the survival
package.
library(survival) fit <- survdiff( Surv(time, status) ~ treatment, data = trial_data ) fit
Here:
timecontains the observed follow-up time.statusindicates whether the event occurred.treatmentidentifies the treatment group.
The resulting object contains the observed and expected event counts and the log-rank test statistic.
Example in SAS
In SAS, the log-rank test is commonly requested through
PROC LIFETEST.
proc lifetest data=trial_data
plots=survival;
time time*status(0);
strata treatment;
run;
The value specified in parentheses identifies the censoring value in this example.
The procedure produces Kaplan–Meier estimates and the corresponding survival-curve comparison tests.
How to Read a Kaplan–Meier + Log-Rank Result
Suppose a clinical trial reports:
| Result | Experimental | Control |
|---|---|---|
| Median PFS | 14.8 months | 10.2 months |
| Hazard ratio | 0.72 (95% CI 0.56–0.93) | |
| Log-rank p-value | 0.009 | |
A concise interpretation would be:
The experimental treatment was associated with longer progression-free survival than control, with a statistically significant difference in the survival distributions based on the log-rank test (p=0.009).
The hazard ratio and its confidence interval provide additional information about the magnitude and precision of the treatment effect.
Common Mistakes
- Comparing raw event counts. Having fewer events in one group does not automatically establish better survival because group sizes and risk sets change over time.
- Ignoring censoring. Censored observations contain partial survival information and should not simply be treated as events or discarded.
- Interpreting the p-value as the treatment effect. The log-rank p-value describes statistical evidence against the null hypothesis; it does not quantify the magnitude of benefit.
- Assuming a nonsignificant result proves equality. A nonsignificant result means that the analysis did not provide sufficient evidence to reject the null. It does not prove that the survival curves are identical.
- Ignoring crossing curves. The ordinary log-rank test may not be the most informative analysis when the survival curves cross substantially.
- Using the log-rank test without considering the prespecified analysis. If the trial was randomized with stratification factors or a particular primary estimand, the analysis should follow the statistical analysis plan.
- Reporting only the median survival times. Median survival can be unavailable or unstable when substantial censoring occurs before the median is reached.
- Forgetting the number-at-risk display. The number of patients contributing information can become small late in follow-up, making the tail of a Kaplan–Meier curve unstable.
- Confusing survival probability with hazard. A Kaplan–Meier curve describes survival probability over time, whereas a hazard ratio compares instantaneous event rates under the proportional hazards framework.
A Practical Survival-Curve Analysis Workflow
What Should Be Reported in a Statistical Analysis Plan?
For a clinical trial using a log-rank test as a primary or important time-to-event analysis, the statistical analysis plan should make the analysis reproducible.
At minimum, specify:
- Time origin
- Time-to-event endpoint definition
- Event definition
- Censoring rules
- Analysis population
- Treatment comparison
- One-sided or two-sided significance level
- Unstratified or stratified log-rank test
- Stratification factors, if applicable
- Handling of tied event times
- Kaplan–Meier estimation method
- Method for estimating treatment effect
- Confidence interval method
- Handling of missing or inconsistent dates
- Rules for follow-up and administrative censoring
Relationship to Sample Size and Power
For time-to-event studies, statistical power is driven strongly by the number of events, not simply by the number of enrolled patients.
This is an important distinction from ordinary fixed-sample continuous outcomes.
A trial may enroll hundreds of patients but have limited power if relatively few events occur. Conversely, a trial with substantial event information may achieve strong power with fewer patients.
Under a proportional hazards framework, a commonly used approximation for the required number of events is related to the expected hazard ratio.
where \(D\) is the required number of events and \(p\) is the allocation proportion to one treatment group.
The exact sample-size calculation depends on the design, allocation ratio, accrual pattern, follow-up, censoring, effect size, and other assumptions.
When the Log-Rank Test Is a Good Choice
The ordinary log-rank test is particularly useful when:
- The endpoint is time to an event.
- Censoring is present.
- There are two or more groups to compare.
- The survival curves are not expected to cross substantially.
- A nonparametric comparison of survival distributions is desired.
- The proportional hazards framework is reasonably appropriate.
When to Consider Other Methods
The log-rank test is not universally optimal. Alternative or complementary analyses may be preferable when:
| Situation | Possible approach |
|---|---|
| Need an adjusted treatment effect | Cox proportional hazards regression |
| Important baseline covariates | Adjusted survival model |
| Strongly crossing survival curves | RMST or other prespecified alternatives |
| Nonproportional hazards | Time-varying or alternative estimands/models |
| More emphasis on a particular time period | Restricted mean survival or milestone survival |
The appropriate method should be determined by the clinical question and estimand rather than selected after seeing which test produces the smallest p-value.
The Most Important Concept
The most important conceptual point is that the log-rank test does not simply compare how many events occurred in each treatment group.
Instead, it repeatedly asks: given the patients who were still at risk at each event time, how many events would we expect in each group if the survival distributions were the same?
The observed-minus-expected differences are then accumulated across the entire follow-up period.
Thus, the analysis naturally incorporates:
- Different numbers of patients remaining at risk over time
- Censoring
- The timing of events
- The allocation of patients between treatment groups
References
Mantel, N. (1966).
Evaluation of survival data and two new rank order statistics arising
in its consideration.
Cancer Chemotherapy Reports, 50, 163–170.
Peto, R. & Peto, J. (1972).
Asymptotically efficient rank invariant test procedures.
Journal of the Royal Statistical Society: Series A, 135, 185–207.
Kaplan, E.L. & Meier, P. (1958).
Nonparametric estimation from incomplete observations.
Journal of the American Statistical Association, 53, 457–481.
Cox, D.R. (1972).
Regression models and life-tables.
Journal of the Royal Statistical Society: Series B, 34, 187–220.
Fleming, T.R. & Harrington, D.P. (1991).
Counting Processes and Survival Analysis.
Wiley.