Biostatistics Study NotesFrom concepts and derivations to interpretation

CHAPTER 09 · TOPIC 02

Comparing Survival Curves

Compare overall survival between groups with the log-rank test and understand observed and expected events, variance, limitations, and Cox regression.

On this page
  1. Hypotheses
  2. Allocating Events under H₀
  3. Hypergeometric Distribution and Variance
  4. Accumulating across All Event Times
  5. Z, Chi-Square, and the p Value
  6. Continuity Correction
  7. Interpretive Limitations

The log-rank test compares the overall survival experience of two or more groups. At each event time, it accumulates the difference between the observed and expected event counts under the null hypothesis.

Hypotheses#

null hypothesisH0:S1(t)=S2(t)for every tH_0:S_1(t)=S_2(t)\quad\text{for every }t
alternative hypothesisH1:S1(t)S2(t)for at least one tH_1:S_1(t)\ne S_2(t)\quad\text{for at least one }t

Allocating Events under H₀#

combined risk setnj=nAj+nBjn_j=n_{Aj}+n_{Bj}
combined event countdj=dAj+dBjd_j=d_{Aj}+d_{Bj}
expected events in group AeAj=djnAjnje_{Aj}=d_j\frac{n_{Aj}}{n_j}
observed minus expecteduj=dAjeAju_j=d_{Aj}-e_{Aj}

Under H₀, the groups have the same event rate within each risk set. The combined event count dⱼ is therefore allocated in proportion to the number at risk in each group.

Hypergeometric Distribution and Variance#

conditional distributionDAjnAj,nBj,dj,H0Hypergeometric(nj,nAj,dj)D_{Aj}\mid n_{Aj},n_{Bj},d_j,H_0\sim\operatorname{Hypergeometric}(n_j,n_{Aj},d_j)
probabilityP(DAj=x)=(nAjx)(nBjdjx)(njdj)P(D_{Aj}=x)=\frac{\binom{n_{Aj}}x\binom{n_{Bj}}{d_j-x}}{\binom{n_j}{d_j}}
variancevj=djnAjnjnBjnjnjdjnj1v_j=d_j\frac{n_{Aj}}{n_j}\frac{n_{Bj}}{n_j}\frac{n_j-d_j}{n_j-1}

The finite population correction (nⱼ−dⱼ)/(nⱼ−1) reflects that the total number of events dⱼ at the same time is fixed.

Accumulating across All Event Times#

log-rank scoreUL=j(dAjeAj)U_L=\sum_j(d_{Aj}-e_{Aj})
mean under H₀E(ULH0)=0E(U_L\mid H_0)=0
cumulative varianceVar(ULH0)=jvj\operatorname{Var}(U_L\mid H_0)=\sum_jv_j
standardizationZ=ULjvjN(0,1)Z=\frac{U_L}{\sqrt{\sum_jv_j}}\approx N(0,1)

Only event times contribute observed-minus-expected terms. A censoring-only time contributes no O−E term, but it still affects later calculations by removing the censored participant from subsequent risk sets.

Z, Chi-Square, and the p Value#

example cumulative valuesUL=6.572,Var(UL)=7.884U_L=6.572,\quad\operatorname{Var}(U_L)=7.884
Zz=6.5727.884=2.341z=\frac{6.572}{\sqrt{7.884}}=2.341
equivalent statisticχ2=z2=5.479,df=1\chi^2=z^2=5.479,\quad df=1
two-sided p-valuep0.019p\approx0.019

With two groups there is one independent comparison, so Z² is approximately χ² with 1 degree of freedom. A positive U_L indicates more observed events in group A than expected under H₀. Clinical magnitude should be described with time-specific survival estimates or a hazard ratio and confidence interval.

Continuity Correction#

zcc=UL0.5sd(UL)z_{cc}=\frac{|U_L|-0.5}{sd(U_L)}

Although the continuity correction is more conservative, modern survival-analysis software usually reports the uncorrected log-rank chi-square statistic. State which version was used and do not mix corrected and uncorrected results.

Interpretive Limitations#

  • Participants are independent between groups, with consistent definitions of the time origin, event, and censoring
  • Censoring is approximately noninformative
  • The test assesses an overall difference between curves; it does not imply a difference at every time point
  • Power is usually greatest when hazards are approximately proportional
  • When curves cross, early and late differences may cancel
  • The tail is unstable when few participants remain at risk