Log-Rank Test Calculator

Advanced Statistical Tests

Compare the survival distributions of two independent groups.

Practical Examples

Use these examples to see how the Log-Rank Test Calculator works.

New Drug vs. Placebo

Clinical Trial

Comparing the survival time (in months) of patients on a new cancer drug versus a placebo.

Group 1:

6 1
7 1
10 1
15 0
16 1
20 0
22 1

Group 2:

8 1
9 0
11 1
12 1
18 0
25 1
30 0

Component Reliability

Engineering

Comparing the failure time (in hours) of two different types of mechanical components.

Group 1:

150 1
200 1
250 0
300 1
350 0

Group 2:

175 1
225 1
275 1
325 0
400 1

Customer Churn

Business

Comparing subscription duration (in days) for customers on two different pricing plans.

Group 1:

30 1
60 1
90 0
120 1
180 0
200 1

Group 2:

45 1
75 0
100 1
150 1
190 0
210 0

Post-Surgery Recovery

Medical Research

Comparing time to recovery (in days) for two different surgical procedures.

Group 1:

5 1
7 1
8 0
10 1
12 0

Group 2:

6 1
9 1
11 1
14 0
15 0
Other Titles
Understanding the Log-Rank Test: A Comprehensive Guide
An in-depth look at comparing survival distributions in statistical analysis.

What is the Log-Rank Test?

  • Core Concept of Survival Analysis
  • The Role of Hypothesis Testing
  • Key Assumptions of the Test
The Log-Rank test is a non-parametric hypothesis test used to compare the survival distributions of two or more groups. It is particularly useful in clinical trials, medical research, and reliability engineering to determine if there is a statistically significant difference in the time-to-event outcomes between different interventions, treatments, or conditions. The 'event' can be death, disease recurrence, component failure, or any other binary outcome of interest.
Core Concept of Survival Analysis
Survival analysis focuses on the expected duration of time until an event occurs. A key feature of this analysis is 'censoring'. Censoring happens when the event of interest has not occurred for a subject by the end of the study, or if the subject is lost to follow-up. The Log-Rank test is designed to correctly handle censored data in its calculations.
The Role of Hypothesis Testing
Like other hypothesis tests, the Log-Rank test starts with a null hypothesis (H₀) and an alternative hypothesis (H₁). The null hypothesis states that there is no difference in the survival distributions between the groups being compared. The alternative hypothesis states that there is a difference. The test calculates a p-value, which helps decide whether to reject the null hypothesis.
Key Assumptions of the Test
The primary assumption of the Log-Rank test is that the hazard rates of the two groups are proportional over time. This means that the ratio of the hazard rates is constant. If the survival curves cross, this assumption may be violated, and other tests like the Wilcoxon test might be more appropriate. Additionally, it assumes that censoring is non-informative, meaning the reasons for censoring are unrelated to the event of interest.

Step-by-Step Guide to Using the Log-Rank Test Calculator

  • Data Preparation and Input
  • Performing the Calculation
  • Interpreting the Results
Data Preparation and Input
Your data for each group must be in a specific format: each line should contain a time value and a status value, separated by a space. The time value represents the number of days, months, or other units until the event or censoring. The status value indicates the outcome: '1' for an event that occurred, and '0' for a censored observation.
Performing the Calculation
Once your data is entered into the respective text areas for Group 1 and Group 2, simply click the 'Calculate' button. The calculator will process the data, construct a contingency table for each event time, and compute the final statistics.
Interpreting the Results
The calculator provides three key outputs: the Chi-Square (χ²) statistic, the degrees of freedom (df), and the p-value. The Chi-Square value is the test statistic calculated from the observed and expected event counts. The p-value is the probability of observing the data, or more extreme data, if the null hypothesis were true. A small p-value (typically < 0.05) suggests that you can reject the null hypothesis, indicating a significant difference between the survival curves.

Mathematical Derivation and Example

  • Constructing the Contingency Table
  • Calculating Observed and Expected Events
  • The Log-Rank Test Statistic Formula
Constructing the Contingency Table
For each distinct event time, a 2x2 contingency table is created. It tabulates the number of events (deaths) and the number of individuals at risk for each group at that specific time.
Calculating Observed and Expected Events
The test compares the observed number of events in each group with the number of events that would be expected if the null hypothesis were true. The expected number of events for a group at a given time is calculated as: (Total events at that time) * (Number at risk in the group) / (Total number at risk).
The Log-Rank Test Statistic Formula
The Log-Rank statistic is calculated by summing the (Observed - Expected) values over all event times for one group, squaring the result, and then dividing by the sum of the variances. The formula is a bit complex but can be summarized as: χ² = (Σ(O₁ᵢ - E₁ᵢ))² / Σ(Vᵢ), where O₁ᵢ is the observed events in group 1 at time i, E₁ᵢ is the expected events, and Vᵢ is the variance of the hypergeometric distribution for that time point. The resulting statistic approximately follows a Chi-Square distribution with 1 degree of freedom (for two groups).