= Solution
The <log-rank test> compares survival experience through the allocation of events within the successive <risk sets>. Its null is equal <hazard functions> between the groups over follow-up, with independent individuals and noninformative censoring within groups. At each distinct event time $t_j$, let $n_{Aj},n_{Bj}$ be the numbers at risk immediately before that time, and let $d_{Aj},d_{Bj}$ be event counts. Under the null, conditional on the total $d_j=d_{Aj}+d_{Bj}$, the expected number of A events is $e_{Aj}=d_jn_{Aj}/(n_{Aj}+n_{Bj})$.
The signed <log-rank statistic> is the observed-minus-expected score
$$
U_A=\sum_j(d_{Aj}-e_{Aj}).
$$
A positive score indicates relatively more A events than expected, hence a higher event hazard for A; B's score is its negative. Censoring times do not produce score terms, but remove people from all later <risk sets>.
At each event time the conditional null allocation is <hypergeometric>, as if the $d_j$ events were sampled without replacement from the <risk set>. Its <variance> gives the score-increment <variance>, with the finite-population correction for ties. Summing these conditional <variances> gives $V$, since distinct-time martingale score increments have zero cross covariance under the null. For sufficiently many informative events, $U_A/\sqrt V$ is approximately standard normal and $U_A^2/V$ approximately chi-squared with one degree of freedom. In the no-tie case, each <variance> contribution is $n_{Aj}n_{Bj}/(n_{Aj}+n_{Bj})^2$. A time at which only one group remains at risk contributes no comparative information.
The numerical parts below report signed-score and <variance> contributions after day 160. They cannot be added as separate chi-squared statistics to the earlier follow-up: \b[add the scores and <variances> first, and standardize once for the complete dataset]. The <log-rank test> is particularly effective for proportional hazards alternatives; crossing hazards can produce cancelling score contributions.
Back to article page