Tutorials › Group Sequential Methods and Sample Size Re-Estimation › Deriving the Weighted Logrank Score

Non-Proportional Hazards and Delayed Effects · Tutorial 527 of 699

Deriving the Weighted Logrank Score

Learn how predictable time-dependent weights modify the logrank score and how to calculate its variance from the event-time risk sets under the null hypothesis.

Advanced 12 min read

What You'll Learn

  • Define weighted logrank contributions using treatment and control risk sets and event indicators.
  • Derive the null expected number of treatment events at each event time.
  • Calculate variance contributions for both single and tied events.
  • Explain why weights must be predictable and how this condition supports null calibration.
  • Interpret the sign and standardized value of a weighted score.
  • Recognize common failures in risk-set accounting, weight selection, and variance calculation.

Why Derive the Score?

The ordinary logrank test compares the observed number of treatment events with the number expected from the treatment fraction in each risk set. A weighted logrank test makes the same comparison but multiplies each event-time contribution by a prespecified or history-based weight. This changes how strongly different event times contribute to the total score; it does not change the need to construct the risk sets correctly.

The derivation matters especially when treatment effects may change over time. A weighted score is only useful if its expected value and variance under the null are understood. The key condition is that the weight at an event time is predictable: it can depend on time and information available just before that event time, but not on the event outcomes occurring at that time.

Definition: Consider two groups, treatment (group 1) and control (group 0), with event times \(t_1,\ldots,t_J\). Let \(Y_{1j}\) and \(Y_{0j}\) be the numbers at risk immediately before \(t_j\), and let \(d_{1j}\) and \(d_{0j}\) be the numbers of events at \(t_j\). Write \(Y_j=Y_{1j}+Y_{0j}\), \(d_j=d_{1j}+d_{0j}\), and \(w_j\) for the weight used at \(t_j\). The weighted logrank score through the final event time is $$ U_W=\sum_{j=1}^{J} w_j\left(d_{1j}-d_j\frac{Y_{1j}}{Y_j}\right). $$ The sign convention here is observed treatment events minus expected treatment events: a negative score means fewer weighted treatment events than expected under the null.

Risk sets are determined immediately before an event time. A participant who has already had the event or has been censored is not in a later risk set. At a tied event time, all participants who fail at that time are counted in \(d_j\), and the risk set is the one just before the tied failures.

From Event Indicators to the Score

For participant \(i\), let \(A_i=1\) for treatment and \(A_i=0\) for control. Let \(Y_i(t)\) indicate whether participant \(i\) is at risk just before time \(t\), and let \(N_i(t)\) count that participant’s events by time \(t\). At \(t_j\), the event indicator increment \(\Delta N_i(t_j)\) is 1 if participant \(i\) has an event then and 0 otherwise. Summing these increments within each group gives \(d_{1j}\) and \(d_{0j}\).

The treatment fraction in the risk set is \(\bar A_j=Y_{1j}/Y_j\). Thus the contribution at \(t_j\) can also be written as the sum, over those who have an event, of their treatment indicator minus the risk-set treatment fraction. The weighted score has the individual-event representation

$$ U_W=\sum_{j=1}^{J}w_j\sum_i\left(A_i-\bar A_j\right)\Delta N_i(t_j) =\sum_{j=1}^{J}w_j\left(d_{1j}-d_j\bar A_j\right). $$

Each treatment event contributes \(1-\bar A_j\), and each control event contributes \(-\bar A_j\), before multiplication by \(w_j\). This centering makes the contribution a comparison with the treatment share of the people still at risk, rather than with the treatment share originally randomized.

Null Expectation and Variance

Under the null hypothesis of equal event hazards in the two groups, condition on the risk set and on there being \(d_j\) events at \(t_j\). With no tied events, the event is from the treatment group with probability \(Y_{1j}/Y_j\). Hence the expected number of treatment events is \(d_jY_{1j}/Y_j\). When \(d_j=1\), the variance of the treatment event indicator is \((Y_{1j}/Y_j)(Y_{0j}/Y_j)\).

For tied events, a standard conditional calculation treats the \(d_j\) failing participants as a sample without replacement from the \(Y_j\) people at risk under the null. The number of treatment events then has a hypergeometric distribution. This gives the finite-population variance below. It is exact under the stated conditional allocation model; a common large-risk-set approximation omits its finite-population correction.

Result: If the weights \(w_j\) are predictable under the null, the conditional mean contribution at each event time is zero. The tied-event conditional variance estimate for the weighted score is $$ \widehat V_W=\sum_{j=1}^{J} w_j^2 \frac{Y_{1j}Y_{0j}}{Y_j^2} \frac{d_j(Y_j-d_j)}{Y_j-1}, $$ for \(Y_j>1\). When \(d_j=1\), this reduces to \(w_j^2Y_{1j}Y_{0j}/Y_j^2\). When ties are negligible relative to the risk sets, the factor \((Y_j-d_j)/(Y_j-1)\) is often approximated by 1.

The square on \(w_j\) is essential: multiplying a score contribution by \(w_j\) multiplies its variance by \(w_j^2\). Contributions at distinct event times are martingale differences under the null, so their cross-products have conditional expectation zero. Adding the event-time conditional variances therefore gives the variance of the cumulative score. In large samples, when the total variance is not dominated by a few event times, \(U_W/\sqrt{\widehat V_W}\) is approximately standard normal under the null.

Why Predictability Is Required

A weight is predictable when its value at \(t_j\) is determined by time and information available strictly before the event outcomes at \(t_j\) are observed. A fixed function of time is predictable. So is a weight calculated from a pooled survival estimate using only event and censoring history before \(t_j\). Such a weight is fixed when the conditional null expectation of the current event contribution is taken, preserving its mean-zero property.

In counting-process terms, under equal hazards and independent censoring, the event increment for a participant at risk has conditional event rate \(\lambda_0(t)\). The centered group indicator sums to zero over the risk set:

$$ \sum_iY_i(t)\{A_i-\bar A(t)\} =Y_1(t)-\frac{Y_1(t)}{Y(t)}Y(t)=0. $$

Consequently, multiplying the centered event increments by a weight known just before \(t\) leaves a score with conditional mean zero under the null. If the weight is chosen using which group has more events at \(t_j\), it is no longer fixed under that conditional expectation. The score can then be biased away from zero even when the null is true, and the usual variance formula does not repair that problem.

Worked Example: A Weighted Score With Single Events

Consider a hypothetical randomized trial with three event times and no tied failures. At the first time, \(Y_{1,1}=6\), \(Y_{0,1}=4\), and the treatment group has the event. At the second time, \(Y_{1,2}=5\), \(Y_{0,2}=4\), and the control group has the event. At the third time, \(Y_{1,3}=3\), \(Y_{0,3}=4\), and the treatment group has the event. The later risk sets are consistent with two treatment participants being censored between the second and third event times. Suppose the weights are \(1\), \(2\), and \(0.5\), respectively.

There is one event at each time, so \(d_j=1\). The unweighted observed-minus-expected contributions are:

$$ 1-\frac{6}{10}=0.4,\qquad 0-\frac{5}{9}=-0.5556,\qquad 1-\frac{3}{7}=0.5714. $$

Multiplying each by its weight and adding gives

$$ U_W=1(0.4)+2(-0.5556)+0.5(0.5714) =0.4-1.1111+0.2857=-0.4254. $$

For single events, each variance contribution is \(w_j^2(Y_{1j}/Y_j)(Y_{0j}/Y_j)\). Thus

$$ \widehat V_W= 1^2\frac{6(4)}{10^2} +2^2\frac{5(4)}{9^2} +0.5^2\frac{3(4)}{7^2} =0.2400+0.9877+0.0612=1.2889. $$

The standardized score is \(Z=-0.4254/\sqrt{1.2889}=-0.3747\). Its negative sign indicates fewer weighted treatment events than expected under the null; this example does not provide strong evidence of a difference. The standard-normal two-sided approximation gives a p-value of about 0.708. All event-time weights are treated as fixed or known from the history before their respective events.

Worked Example: Variance With Tied Events

In a hypothetical study, suppose that immediately before one event time there are \(Y_1=4\) treatment participants and \(Y_0=6\) control participants at risk. Three participants fail at that time, including two from treatment, so \(Y=10\), \(d=3\), and \(d_1=2\). Let the predictable weight at this time be \(w=1.5\).

The expected number of treatment events under the null is \(dY_1/Y=3(4/10)=1.2\). The weighted score contribution is therefore

$$ w\left(d_1-d\frac{Y_1}{Y}\right) =1.5(2-1.2)=1.20. $$

The hypergeometric variance of the unweighted treatment event count is

$$ \frac{Y_1Y_0}{Y^2}\frac{d(Y-d)}{Y-1} =\frac{4(6)}{10^2}\frac{3(7)}{9} =0.24\left(\frac{7}{3}\right)=0.56. $$

After applying the weight, the variance contribution is \(w^2(0.56)=1.5^2(0.56)=1.26\). Omitting the finite-population correction would give \(w^2d(Y_1/Y)(Y_0/Y)=2.25(3)(0.4)(0.6)=1.62\), a larger approximation in this example. The exact conditional variance accounts for sampling without replacement from the risk set.

Weights Based on Prior Event History

A history-based weight must be calculated in a way that does not use the current event outcomes. For example, a pooled Kaplan–Meier survival estimate immediately before \(t_j\) uses only earlier event and censoring information, and can therefore define a predictable weight. The calculation below illustrates the timing requirement; it does not prescribe a particular weighting strategy.

Worked Example: Checking a History-Based Weight

Suppose a hypothetical trial begins with five treatment and five control participants at risk. There are two single-event times. The first event is in control. Immediately before the second event, the risk set is five treatment and four control participants, and the second event is in treatment. Define \(w_j\) as the pooled Kaplan–Meier survival estimate just before event time \(t_j\).

Before the first event, the pooled survival estimate is 1, so \(w_1=1\). The first event occurs with ten people at risk, making the pooled survival estimate after that event \(1-1/10=0.9\). Thus, using only prior history, \(w_2=0.9\).

At the first time, the score contribution is \(1(0-1/2)=-0.5\). At the second time, it is \(0.9(1-5/9)=0.9(4/9)=0.4\). Hence \(U_W=-0.5+0.4=-0.1\). The variance is

$$ \widehat V_W= 1^2\frac{5(5)}{10^2} +0.9^2\frac{5(4)}{9^2} =0.25+0.20=0.45. $$

The standardized value is \(-0.1/\sqrt{0.45}=-0.1491\). Both weights were known before their event outcomes: \(w_2\) used the first event but not the second. Defining \(w_2\) from the treatment-versus-control event difference at the second time would violate predictability.

Assumptions, Diagnostics, and Alternatives

The derivation relies on correctly recorded event times and group membership, valid risk sets, and a null model in which the two groups have equal event hazards conditional on being at risk. Censoring must not be informative about the event process in a way that invalidates the risk-set comparison. In a randomized trial, randomization supports treatment-group comparability, but does not excuse incorrect handling of censoring, ties, or stratification.

  • Check the risk-set arithmetic. After each event time, remove the participants who failed, and remove censored participants before the next event time. Risk-set counts should reconcile with the data.
  • Check tie handling. Use one consistent convention for the risk set immediately before tied failures, the number of events \(d_j\), and the variance calculation. A single-event variance formula is not the exact tied-event variance.
  • Check the weights’ timing. Document the information used to calculate every \(w_j\). A weight using current treatment-specific event outcomes is not predictable.
  • Check variance contributions. Each contribution is nonnegative and includes \(w_j^2\). A zero total variance means the standardized statistic is undefined, not zero.
  • Check the normal approximation. A few very large weighted contributions, few total events, or very small estimated variance can make the normal approximation unreliable.

With \(w_j=1\) at every event time, the score reduces to the ordinary logrank score. The weighted version retains the same risk-set comparison but changes the relative contribution of event times. A Cox score test under the proportional-hazards model is closely related to the unweighted logrank test; a weighted score is not automatically a test of one constant hazard ratio. In group sequential use, cumulative weighted scores and their corresponding variance estimates can be monitored, but changing weights or recalculating them using current outcomes can undermine the intended null calibration.

Weights do not create information where few events occur, and an unsuitable weighting pattern can reduce power. Their interpretation also depends on the weighting rule: a weighted score summarizes departures from the null according to that rule, rather than providing a universal summary of treatment effect. Selection of weights for a particular delay or time pattern is a design decision that should be made before examining the treatment contrast.

Common mistake: “The treatment group had more events at this time, so I should increase the weight on this event time to reflect that.” This uses the current outcome to select its own weight and can destroy the null mean-zero property. Instead, specify the weight in advance or calculate it only from time and history available just before the event time; then use \(w_j^2\) in the variance contribution.

Check Your Understanding

Answer each question, then compare your reasoning with the brief solutions.

  1. At an event time, \(Y_1=8\), \(Y_0=12\), and \(d=1\), with a treatment event and weight \(w=2\). Find the score contribution and its variance contribution.
  2. Why does a tied-event variance include a finite-population correction?
  3. A weight at time \(t_j\) is calculated from the treatment-control difference in events observed at \(t_j\). Is it predictable, and why does that matter?
  4. What does a negative weighted logrank score mean under the sign convention used here?

Solutions. (1) The treatment risk-set fraction is \(8/20=0.4\), so the score contribution is \(2(1-0.4)=1.2\). For one event, its variance contribution is \(2^2(8/20)(12/20)=4(0.24)=0.96\). (2) Conditional on \(d\) failures, tied failures are sampled without replacement from the risk set under the null; the factor \((Y-d)/(Y-1)\) adjusts for this dependence. (3) No. It uses current event outcomes, so the weight is not fixed when conditioning on those outcomes; the usual mean-zero derivation does not apply. (4) It means fewer weighted treatment events occurred than expected from the treatment share of the risk sets. It does not, by itself, establish a treatment benefit or identify a causal effect.

Clinical Biostats