Course contentsShow
← Data Science
Lesson 820 of 2,14521. Survival AnalysisFree lesson

Log-Rank Test Statistic

How the test statistic is calculated from observed versus expected events at each time point.

Log-Rank Test Statistic

You'll learn: How the log-rank test statistic measures the difference between observed and expected events across survival groups.

The Core Idea

The log-rank test statistic is a single number that tells you whether two (or more) survival curves are significantly different. It works by comparing what we actually observed at each event time versus what we would expect if the groups had identical survival patterns.

At every time point where an event occurs, the test:

  1. Counts how many events happened in each group (observed)
  2. Calculates how many events we'd expect in each group if survival were the same (expected), based on the risk set sizes
  3. Tracks the cumulative difference: (Observed - Expected)

Think of it like grading a coin flip: if you flip 100 times and get 75 heads, that's way more than the expected 50. The log-rank test does something similar across all time points in your survival data.

The Formula Structure

The test statistic combines these differences across all event times. For each group, you sum up:

(Total Observed events) - (Total Expected events)

This difference is then standardized by its variance to create a chi-square distributed statistic. The larger the statistic, the more the groups diverge from what we'd expect under identical survival.

Why Time Points Matter

Each event time contributes independently. Early events and late events both count, weighted by how many people are still "at risk" at that moment. This is why the risk set (the denominator from Kaplan-Meier calculations) is crucial—it tells us who could possibly have experienced the event at each time.

Key Takeaway: The log-rank test statistic quantifies how much observed events deviate from expected events across all time points, giving us a single number to test whether survival curves truly differ.