Log-rank test
The log-rank test compares survival distributions by accumulating observed-minus-expected events over event-time risk sets.
For two groups, the null hypothesis is equality of their survival distributions. At each event time, expected events in group A equal total events times A's share of the risk set. Sum observed minus expected events and divide by its estimated standard deviation to obtain Z. [1]
Tied events use a hypergeometric variance. Z squared has an asymptotic chi-square reference distribution with one degree of freedom under the null; SciPy returns signed Z instead. A zero total variance leaves this standardized comparison undefined. [1] [4]
The ordinary comparison assumes independent units and non-informative right censoring within groups. Use a common event definition and time origin; repeated telemetry rows are not independent drives. Different censoring rates alone do not imply informative censoring. [2]
Crossing effects can cancel in the accumulated score, reducing power. Proportional hazards is not a universal requirement for asymptotic null validity, and a large p-value does not establish equal reliability. A test result is not an effect-size estimate. [2]
An unstratified comparison does not adjust for fleet composition or workload and does not establish causation. Stratification specifies a different comparison; complex covariate questions need an appropriate model. [3]
Relations
Citations
- SciPy 1.16.1: logrank, null hypothesis, tied-event variance and signed statistic
- Uno et al. (2015): A versatile test for equality of two survival functions based on weighted differences of Kaplan-Meier curves
- R survival: survdiff, ordinary log-rank and stratified comparisons
- R survival: survdiff2.c at 0605821347ef, tied observations and the one-unit variance boundary