# Log-Rank Test Calculator

Compare two survival curves using the log-rank (Mantel-Cox) test. Enter event times and censoring indicators to get the test statistic and p-value.

## What this calculates

Enter event times and censoring indicators for two groups to compare their survival curves. The log-rank test (also called the Mantel-Cox test) determines whether the two groups have statistically different survival experiences.

## Inputs

- **Group 1 Times** — Comma-separated event/censoring times for group 1.
- **Group 1 Events (1=event, 0=censored)** — 1 if the event occurred, 0 if censored. Same length as times.
- **Group 2 Times** — Comma-separated event/censoring times for group 2.
- **Group 2 Events (1=event, 0=censored)** — 1 if the event occurred, 0 if censored. Same length as times.

## Outputs

- **Log-Rank χ²** — The log-rank test statistic.
- **P-Value** — P-value from chi-square distribution with 1 df.
- **Observed Events (Group 1)** — Total observed events in group 1.
- **Expected Events (Group 1)** — Expected events under the null hypothesis for group 1.
- **Observed Events (Group 2)** — Total observed events in group 2.
- **Expected Events (Group 2)** — Expected events under the null hypothesis for group 2.
- **Significant at α = 0.05?** — formatted as text — Whether the survival curves differ significantly.
- **Calculation** — formatted as text — Step-by-step log-rank test computation.

## Details

**What is the Log-Rank Test?**

The log-rank test is the most widely used method for comparing survival curves between two or more groups. It is a non-parametric test that works well even with censored data, which is common in clinical trials and time-to-event studies.

**How it works:**

1. At each distinct event time, count observed events and subjects at risk in each group
2. Calculate expected events for each group under the null hypothesis (equal survival)
3. Sum the observed-minus-expected differences across all event times
4. Compute the test statistic: χ² = [Σ(O - E)]² / Σ Variance

**Key features:**

- Handles right-censored data (subjects lost to follow-up or still event-free at study end)
- Non-parametric: no assumption about the shape of the survival distribution
- Tests the null hypothesis that both groups have the same survival function
- Most powerful when the hazard ratio is constant over time (proportional hazards)

**Interpreting results:**

A significant result (p < 0.05) means the survival experiences of the two groups are statistically different. It does not tell you which group survives longer; compare the observed vs. expected events to determine direction.

**Common applications:**

- Clinical trials comparing treatments
- Oncology studies comparing cancer therapies
- Engineering reliability testing
- Any study measuring time until an event

## Frequently Asked Questions

**Q: What does censored data mean in survival analysis?**

A: Censored data occurs when the event of interest has not happened by the time of observation. For example, a patient might still be alive when the study ends, or a patient might drop out of the study. We know they survived at least until their last observed time, but we do not know when (or if) the event will occur. This partial information is still valuable and the log-rank test properly accounts for it.

**Q: When should I use the log-rank test vs. a Cox regression?**

A: Use the log-rank test when you simply want to compare survival curves between groups without adjusting for other variables. Use Cox proportional hazards regression when you need to control for covariates (age, gender, stage) or when you want to estimate a hazard ratio with confidence intervals.

**Q: What are the assumptions of the log-rank test?**

A: The main assumption is that censoring is independent of the event (non-informative censoring). The test also has the most power when hazards are proportional across groups, meaning the ratio of hazard rates is roughly constant over time. If hazards cross (one group does better early but worse later), the log-rank test may miss the difference.

---

Source: https://vastcalc.com/calculators/statistics/log-rank
Category: Statistics
Last updated: 2026-04-08
