The logrank test statistic compares estimates of the hazard functions of the two groups at each observed event time. It is constructed by computing the observed and expected number of events in one of the groups at each observed event time and then adding these to obtain an overall summary across all-time points where there is an event.
Consider two groups of patients, e.g., treatment vs. control. Let 1 , … , J {\displaystyle 1,\ldots ,J} be the distinct times of observed events in either group. Let N 1 , j {\displaystyle N_{1,j}} and N 2 , j {\displaystyle N_{2,j}} be the number of subjects "at risk" (who have not yet had an event or been censored) at the start of period j {\displaystyle j} in the groups, respectively. Let O 1 , j {\displaystyle O_{1,j}} and O 2 , j {\displaystyle O_{2,j}} be the observed number of events in the groups at time j {\displaystyle j} . Finally, define N j = N 1 , j + N 2 , j {\displaystyle N_{j}=N_{1,j}+N_{2,j}} and O j = O 1 , j + O 2 , j {\displaystyle O_{j}=O_{1,j}+O_{2,j}} .
The null hypothesis is that the two groups have identical hazard functions, H 0 : h 1 ( t ) = h 2 ( t ) {\displaystyle H_{0}:h_{1}(t)=h_{2}(t)} . Hence, under H 0 {\displaystyle H_{0}} , for each group i = 1 , 2 {\displaystyle i=1,2} , O i , j {\displaystyle O_{i,j}} follows a hypergeometric distribution with parameters N j {\displaystyle N_{j}} , N i , j {\displaystyle N_{i,j}} , O j {\displaystyle O_{j}} . This distribution has expected value E i , j = O j N i , j N j {\displaystyle E_{i,j}=O_{j}{\frac {N_{i,j}}{N_{j}}}} and variance V i , j = E i , j ( N j − O j N j ) ( N j − N i , j N j − 1 ) {\displaystyle V_{i,j}=E_{i,j}\left({\frac {N_{j}-O_{j}}{N_{j}}}\right)\left({\frac {N_{j}-N_{i,j}}{N_{j}-1}}\right)} .
For all j = 1 , … , J {\displaystyle j=1,\ldots ,J} , the logrank statistic compares O i , j {\displaystyle O_{i,j}} to its expectation E i , j {\displaystyle E_{i,j}} under H 0 {\displaystyle H_{0}} . It is defined as
It is easy to see that for all j {\displaystyle j} , O 2 , j − E 2 , j = − ( O 1 , j − E 1 , j ) {\displaystyle O_{2,j}-E_{2,j}=-(O_{1,j}-E_{1,j})} and V 2 , j = V 1 , j {\displaystyle V_{2,j}=V_{1,j}} , so Z 2 = − Z 1 {\displaystyle Z_{2}=-Z_{1}} .
By the central limit theorem, the distribution of each Z i {\displaystyle Z_{i}} converges to that of a standard normal distribution as J {\displaystyle J} approaches infinity and therefore can be approximated by the standard normal distribution for a sufficiently large J {\displaystyle J} . An improved approximation can be obtained by equating this quantity to Pearson type I or II (beta) distributions with matching first four moments, as described in Appendix B of the Peto and Peto paper.4
If the two groups have the same survival function, the logrank statistic is approximately standard normal. A one-sided level α {\displaystyle \alpha } test will reject the null hypothesis if Z > z α {\displaystyle Z>z_{\alpha }} where z α {\displaystyle z_{\alpha }} is the upper α {\displaystyle \alpha } quantile of the standard normal distribution. If the hazard ratio is λ {\displaystyle \lambda } , there are n {\displaystyle n} total subjects, d {\displaystyle d} is the probability a subject in either group will eventually have an event (so that n d {\displaystyle nd} is the expected number of events at the time of the analysis), and the proportion of subjects randomized to each group is 50%, then the logrank statistic is approximately normal with mean ( log λ ) n d 4 {\displaystyle (\log {\lambda })\,{\sqrt {\frac {n\,d}{4}}}} and variance 1.5 For a one-sided level α {\displaystyle \alpha } test with power 1 − β {\displaystyle 1-\beta } , the sample size required is n = 4 ( z α + z β ) 2 d log 2 λ {\displaystyle n={\frac {4\,(z_{\alpha }+z_{\beta })^{2}}{d\log ^{2}{\lambda }}}} where z α {\displaystyle z_{\alpha }} and z β {\displaystyle z_{\beta }} are the quantiles of the standard normal distribution.
Suppose Z 1 {\displaystyle Z_{1}} and Z 2 {\displaystyle Z_{2}} are the logrank statistics at two different time points in the same study ( Z 1 {\displaystyle Z_{1}} earlier). Again, assume the hazard functions in the two groups are proportional with hazard ratio λ {\displaystyle \lambda } and d 1 {\displaystyle d_{1}} and d 2 {\displaystyle d_{2}} are the probabilities that a subject will have an event at the two time points where d 1 ≤ d 2 {\displaystyle d_{1}\leq d_{2}} . Z 1 {\displaystyle Z_{1}} and Z 2 {\displaystyle Z_{2}} are approximately bivariate normal with means log λ n d 1 4 {\displaystyle \log {\lambda }\,{\sqrt {\frac {n\,d_{1}}{4}}}} and log λ n d 2 4 {\displaystyle \log {\lambda }\,{\sqrt {\frac {n\,d_{2}}{4}}}} and correlation d 1 d 2 {\displaystyle {\sqrt {\frac {d_{1}}{d_{2}}}}} . Calculations involving the joint distribution are needed to correctly maintain the error rate when the data are examined multiple times within a study by a Data Monitoring Committee.
The logrank test is based on the same assumptions as the Kaplan-Meier survival curve—namely, that censoring is unrelated to prognosis, the survival probabilities are the same for subjects recruited early and late in the study, and the events happened at the times specified. Deviations from these assumptions matter most if they are satisfied differently in the groups being compared, for example if censoring is more likely in one group than another.6
Mantel, Nathan (1966). "Evaluation of survival data and two new rank order statistics arising in its consideration". Cancer Chemotherapy Reports. 50 (3): 163–70. PMID 5910392. /wiki/Nathan_Mantel ↩
Peto, Richard; Peto, Julian (1972). "Asymptotically Efficient Rank Invariant Test Procedures". Journal of the Royal Statistical Society, Series A. 135 (2). Blackwell Publishing: 185–207. doi:10.2307/2344317. hdl:10338.dmlcz/103602. JSTOR 2344317. /wiki/Richard_Peto ↩
Harrington, David (2005). "Linear Rank Tests in Survival Analysis". Encyclopedia of Biostatistics. Wiley Interscience. doi:10.1002/0470011815.b2a11047. ISBN 047084907X. 047084907X ↩
Schoenfeld, D (1981). "The asymptotic properties of nonparametric tests for comparing survival distributions". Biometrika. 68 (1): 316–319. doi:10.1093/biomet/68.1.316. JSTOR 2335833. /wiki/Doi_(identifier) ↩
Bland, J. M.; Altman, D. G. (2004). "The logrank test". BMJ. 328 (7447): 1073. doi:10.1136/bmj.328.7447.1073. PMC 403858. PMID 15117797. /wiki/Martin_Bland ↩