Logrank test
The logrank test, or log-rank 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 skewed and censored (technically, the censoring must be non-informative). It is widely used in clinical trials to establish the efficacy of a new treatment in comparison with a control treatment when the measurement is the time to event (such as the time from initial treatment to a heart attack). The test is sometimes called the Mantel–Cox test, named after Nathan Mantel and David  Cox. The logrank test can also be viewed as a time-stratified Cochran–Mantel–Haenszel test. The test was first proposed by Nathan Mantel and was named the "logrank test" by Richard and Julian Peto. Definition. 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 formula_1 be the distinct times of observed events in either group. Let formula_2 and formula_3 be the number of subjects "at risk" (who have not yet had an event or been censored) at the start of period formula_4 in the groups, respectively. Let formula_5 and formula_6 be the observed number of events in the groups at time formula_4. Finally, define formula_8 and formula_9. The null hypothesis is that the two groups have identical hazard functions, formula_10. Hence, under formula_11, for each group formula_12, formula_13 follows a hypergeometric distribution with parameters formula_14, formula_15, formula_16. This distribution  has expected value formula_17 and variance formula_18. For all formula_19, the logrank statistic compares formula_13 to its expectation formula_21 under formula_11. It is defined as By the central limit theorem, the distribution of formula_26 converges to that of a standard normal distribution as formula_27 approaches infinity and therefore can be approximated by the standard normal distribution for a sufficiently large formula_27. 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. Asymptotic distribution. If the two  groups have the same survival function, the logrank statistic is approximately standard normal. A one-sided level formula_29 test will reject the null hypothesis if formula_30 where formula_31 is the upper formula_29 quantile of the standard normal distribution. If the hazard ratio is formula_33, there are formula_34 total subjects, formula_35 is the probability a subject in either group will eventually have an event (so that formula_36 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 formula_37 and  variance 1. For a one-sided level formula_29 test with power formula_39, the sample size required is formula_40 where formula_31 and formula_42 are the quantiles of the standard normal distribution. Joint distribution. Suppose formula_43 and formula_44 are the logrank statistics at two different time points in the same study (formula_43 earlier). Again, assume the hazard functions in the two groups are proportional with hazard ratio formula_33 and formula_47 and formula_48 are the probabilities that a subject will have an event at the two time points where formula_49. formula_43 and formula_44 are approximately bivariate normal with means formula_52 and formula_53 and  correlation formula_54. 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. Test assumptions. 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.