In statistics, the logrank test (sometimes called the MantelCox test) is a hypothesis test to compare the survival distributions of two samples. It is a nonparametric test and appropriate to use when the data are right censored (technically, the censoring must be noninformative). It is widely used in clinical trials to establish the efficacy of a new treatment compared to a control treatment when the measurement is the time to event (such as the time from initial treatment to a heart attack).
The test was first proposed by Nathan Mantel and was named the logrank test by Richard and Julian Peto.^{[1]}^{[2]}^{[3]}
Contents 
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.
Let j = 1, ..., J be the distinct times of observed events in either group. For each time j, let N_{1j} and N_{2j} be the number of subjects "at risk" (have not yet had an event or been censored) at the start of period j in the groups respectively. Let N_{j} = N_{1j} + N_{2j}. Let O_{1j} and O_{2j} be the observed number of events in the groups respectively at time j, and define O_{j} = O_{1j} + O_{2j}.
Given that O_{j} events happened across both groups at time j, under the null hypothesis (of the two groups having identical survival and hazard functions) O_{1j} has the hypergeometric distribution with parameters N_{j}, N_{1j}, and O_{j}. This distribution has expected value and variance .
The logrank statistic compares each O_{1j} to its expectation E_{1j} under the null hypothesis and is defined as
If the two groups have the same survival function, the logrank statistic is approximately standard normal. A onesided level α test will reject the null hypothesis if Z > z_{α} where z_{α} is the upper α quantile of the standard normal distribution. If the hazard ratio is λ, there are n total subjects, d is the probability a subject in either group will eventually have an event (so that 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 and variance 1.^{[4]} For a onesided level α test with power 1 − β, the sample size required is where z_{α} and z_{β} are the quantiles of the standard normal distribution.
Suppose Z_{1} and Z_{2} are the logrank statistics at two different time points in the same study (Z_{1} earlier). Again, assume the hazard functions in the two groups are proportional with hazard ratio λ and d_{1} and d_{2} are the probabilities that a subject will have an event at the two time points. Z_{1} and Z_{2} are approximately bivariate normal with means and and correlation . 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.

