Why derive the logrank score from the Cox model?
In a two-arm survival trial, the logrank score accumulates, at each event time, the observed treatment-group event indicator minus the treatment-group proportion at risk. The Cox proportional hazards model gives a direct derivation of that quantity: it is the score for the treatment coefficient when the coefficient is evaluated at the null value. This link explains why a logrank calculation uses risk sets and why the null hazard ratio is central.
The derivation here concerns the score itself, not its variance or the standardized test statistic. A score indicates the direction and amount of departure from the null on the partial-likelihood scale. To conduct a test, it must also be paired with an appropriate variance estimate.
Model, notation, and assumptions
Let \(Z_i=1\) denote a participant in the treatment group and \(Z_i=0\) a participant in the control group. Use the Cox model
where \(\lambda_i(t\mid Z_i)\) is participant \(i\)'s hazard at time \(t\), \(\lambda_0(t)\) is an unspecified baseline hazard, and \(\beta\) is the log hazard ratio for treatment versus control. Thus, the hazard ratio is \(\exp(\beta)\). The null hypothesis of equal hazards in this model is \(H_0:\beta=0\), or equivalently a hazard ratio of one.
For the basic derivation, assume event times are distinct, so exactly one participant fails at each \(t_j\). The partial-likelihood contribution at an event time compares the event participant with everyone in that event's risk set. The calculation assumes participants are independent and censoring is noninformative conditional on the modeled group. For the Cox model's hazard-ratio interpretation, assume proportional hazards: the treatment-to-control hazard ratio is constant over time. In a randomized trial, random assignment supports a causal treatment comparison, subject to adherence to the trial's design and analysis assumptions. The algebraic identity below can still be calculated when proportional hazards is questionable, but its interpretation as a constant log hazard-ratio score then requires care.
The risk sets must be defined using the event and censoring histories: a participant contributes while at risk, and not after an event or censoring time. A group with no members at risk at an event time contributes no treatment-versus-control contrast there. Tied event times require a specified Cox tie method; the single-event derivation below does not silently determine how ties should be handled.
Differentiating the partial likelihood
For distinct event times \(t_1,\ldots,t_D\), the Cox partial likelihood for \(\beta\), with the treatment indicator as the sole covariate, is
The numerator is the relative hazard of the participant who failed. The denominator sums the relative hazards of all participants in that event's risk set. Taking logarithms turns the product into a sum; differentiating gives the partial-likelihood score:
The fraction in each summand is a risk-set weighted mean of the treatment indicator. The weights depend on \(\beta\); at a general value of \(\beta\), participants in the two groups need not receive equal relative-hazard weights.
At the null value \(\beta=0\), every participant in the risk set has relative hazard \(\exp(0)=1\). The weighted mean therefore reduces to the proportion of that risk set assigned to treatment:
Since \(Z_{(j)}\) is 1 for a treatment event and 0 for a control event, each summand is the observed treatment event indicator minus its null risk-set expectation. Summing the observed indicators gives the number of treatment-group events, while summing \(Y_{1j}/Y_j\) gives the corresponding expected count under the null risk-set allocation. This is precisely the two-arm logrank score under the distinct-event convention.
Worked risk-set calculations
Worked Example: Accumulating the Null Score
Consider a hypothetical trial with five distinct event times. The table gives the numbers at risk immediately before each event and the group in which that event occurs. These risk sets are consistent with sequential removal of event participants and censoring between some event times.
| Event time | Treatment at risk \(Y_{1j}\) | Control at risk \(Y_{0j}\) | Event group | Contribution \(Z_{(j)}-Y_{1j}/Y_j\) |
|---|---|---|---|---|
| 1 | 4 | 4 | Treatment | \(1-4/8=0.5000\) |
| 2 | 3 | 3 | Control | \(0-3/6=-0.5000\) |
| 3 | 2 | 2 | Treatment | \(1-2/4=0.5000\) |
| 4 | 1 | 2 | Control | \(0-1/3=-0.3333\) |
| 5 | 1 | 1 | Treatment | \(1-1/2=0.5000\) |
There are three treatment events, so the observed treatment-event count is 3. The null expected count, computed from the risk-set treatment proportions, is
Therefore,
The positive score indicates more treatment-group events than expected under the null risk-set calculation. It does not, by itself, establish statistical significance or show that treatment increases the hazard; that requires the score's variance and an appropriate test.
Worked Example: The Risk-Set Term Away From the Null
Suppose that at one hypothetical event time, two treatment participants and three control participants are at risk, and the event occurs in the treatment group. Consider the contribution to the Cox score at \(\beta=\log(2)\), corresponding to a model-implied treatment hazard ratio of 2.
The event indicator is \(Z_{(j)}=1\). Treatment participants have relative hazard \(\exp(\beta)=2\), while control participants have relative hazard 1. Thus, the score contribution is
At the null value \(\beta=0\), the same risk set gives
The difference illustrates why the logrank score uses the treatment proportion at risk: that is the Cox score's risk-set term specifically when the hazard ratio is one. At other values of \(\beta\), the term is weighted by the model-implied relative hazards instead.
Worked Example: Unequal Risk-Set Sizes and Censoring
In another hypothetical trial, suppose three successive event-time risk sets and event groups are as follows: first, 3 treatment and 5 control participants are at risk and a control participant has the event; second, 3 treatment and 4 control participants are at risk and a treatment participant has the event; third, 2 treatment and 3 control participants are at risk and a control participant has the event. The change from the second to the third risk set can occur if one control participant is censored before the third event.
The score contributions are
With denominator 280, this becomes
There is one observed treatment event. Its null expected count is \(3/8+3/7+2/5=337/280\approx1.204\), so observed minus expected is \(1-1.204\approx-0.2036\). The unequal group sizes are handled event by event through each risk set's treatment proportion; the calculation does not substitute the trial's overall allocation proportion for those changing proportions.
Justification of the observed-minus-expected interpretation
Under \(H_0:\beta=0\), the Cox model assigns the same instantaneous hazard to every participant in a risk set, regardless of group. Conditional on one event occurring at a particular time and on the risk set just before it, each member has the same event-hazard weight. Consequently, the treatment event indicator has null conditional expectation \(Y_{1j}/Y_j\). Subtracting that expectation from the observed indicator gives the event-time score contribution.
This argument explains the logrank score's construction without requiring equal numbers randomized to each arm. It also shows why the risk set must reflect who is actually still at risk at each event time. Censoring changes later risk-set composition, and therefore can change later expected treatment event counts even when the original allocation ratio was fixed.
The equality is an identity between the null Cox score and the distinct-event two-arm logrank score. It is not a claim that the score alone is a standardized statistic, a p-value, or an estimated hazard ratio. In a group sequential analysis, the same event-level terms can be accumulated through an interim look using the risk sets available up to that look. The inferential procedure still needs a suitable variance and the design's specified monitoring rule.
Diagnostics, alternatives, and limitations
Before using the derivation, check that each event's risk set is defined immediately before the event, that the treatment indicator is coded consistently, and that the event-time convention matches the calculation. A useful arithmetic check is to compare the sum of the event indicators with the total observed treatment events, and the sum of risk-set proportions with the null expected count. Their difference must equal the sum of the displayed contributions.
- Incorrect risk sets. Counting participants after censoring or an earlier event can distort the expected counts. Reconstruct each risk set from entry, event, and censoring histories.
- Reversing the treatment code. If treatment is coded 1, a positive score indicates excess treatment events. Reversing the coding reverses the score's sign.
- Using the overall allocation ratio at every event. The null expectation is \(Y_{1j}/Y_j\) at that event, not necessarily the proportion randomized to treatment at enrollment.
- Ignoring ties. The derivation assumes one event at a time. With tied events, the Cox partial likelihood depends on the chosen tie method; a tied-event calculation should not be justified by applying the distinct-event formula without qualification.
- Confusing score direction with evidence strength. The sign gives a direction, not a measure of statistical significance. A test also requires the score variance.
- Over-interpreting a constant hazard ratio. If proportional hazards is implausible, the score remains a defined null-risk-set contrast, but a single constant hazard ratio may not summarize the treatment effect adequately. The logrank test can also have limited power when effects change direction over time.
A Cox Wald test instead uses the fitted coefficient divided by its estimated standard error; a likelihood-ratio test compares fitted partial likelihoods. The logrank score calculation evaluates the score at the null and does not require first estimating the treatment coefficient. These procedures are related but are not numerically identical in every finite sample. The score's usefulness in sequential monitoring comes from its event-by-event construction; its variance, standardization, and monitoring calibration must be handled separately.
Check Your Understanding
Work through the questions, then compare your reasoning with the solutions below.
- At one event time, 4 treatment and 6 control participants are at risk, and the event is in the control group. What is the null score contribution?
- At a second event time, 2 treatment and 5 control participants are at risk, and the event is in the treatment group. Calculate its contribution and explain its sign.
- Why does the Cox score at \(\beta=0\) use \(Y_{1j}/Y_j\) rather than a treatment probability weighted by a fitted hazard ratio?
- Does a positive value of \(U(0)\) alone establish that treatment is harmful or that the result is statistically significant? Explain.
Solutions. (1) The event indicator is 0 and the treatment risk-set proportion is \(4/10\), so the contribution is \(0-4/10=-0.4000\). (2) The contribution is \(1-2/7=5/7\approx0.7143\). It is positive because a treatment event occurred when treatment participants made up only \(2/7\) of the risk set. (3) At \(\beta=0\), all relative hazards are \(\exp(0)=1\), so the weighted treatment proportion in the Cox score reduces to the unweighted risk-set proportion \(Y_{1j}/Y_j\). (4) No. A positive score means treatment events exceeded the null risk-set expectation, but statistical significance requires a variance-based test, and the sign alone does not quantify uncertainty or establish a causal conclusion.