Introduction to Survival Analysis

Survival analysis, also known as time-to-event analysis, is a branch of statistics that deals with the time until a specific event of interest occurs. This event could be death, disease recurrence, machine failure, or customer churn. Unlike standard regression methods, survival analysis accounts for censored data—situations where the event has not occurred by the end of the study period, a subject drops out, or is lost to follow-up. Ignoring censored observations can lead to severely biased results.

Two foundational tools in survival analysis are survival curves and the Kaplan-Meier (KM) estimator. These non-parametric methods allow researchers to estimate and visualize the survival function without assuming a particular statistical distribution for the survival times. This article expands on the basic concepts, explains how to construct and interpret KM curves, and discusses common extensions.

Understanding Survival Curves

A survival curve plots the proportion of subjects who have not yet experienced the event (surviving) at successive time points. The vertical axis typically runs from 0 to 1 (or 0% to 100%), representing the probability of survival. The horizontal axis represents time (days, months, cycles, etc.). The curve steps downward each time an event occurs, remaining flat during intervals when no events are observed. Censored observations are often marked with tick marks or small vertical lines on the curve.

Key Concepts

  • Survival function S(t): The probability that a subject survives longer than time t. Formally, S(t) = P(T > t), where T is the random variable for survival time.
  • Hazard function h(t): The instantaneous rate of experiencing the event at time t, conditional on having survived up to that time. It is not a probability but a rate (events per unit time).
  • Censoring types:
    • Right censoring: The most common; the event occurs after the study ends or the subject is lost.
    • Left censoring: The event occurred before the study start but the exact time is unknown.
    • Interval censoring: The event occurs within a known time window but the exact time is not recorded.

Survival curves are invaluable in clinical trials to compare treatment arms, in reliability engineering to assess product lifetimes, and in epidemiology to study disease progression. They provide an intuitive visual summary of the risk over time.

The Kaplan‑Meier Estimator

The Kaplan-Meier estimator, also called the product-limit estimator, was introduced by Edward L. Kaplan and Paul Meier in 1958. It is a non-parametric method, meaning it makes no assumptions about the underlying distribution of survival times. This flexibility makes it widely applicable.

Mathematical Definition

Let t1 < t2 < … < tk be the distinct ordered event times. For each time ti, let di be the number of events occurring at that time, and let ni be the number of subjects known to be at risk just before ti. The KM estimator of the survival function is:

Ŝ(t) = ∏i: ti ≤ t (1 − di / ni)

The product starts at time 0, where Ŝ(0) = 1. At each event time, the survival probability is reduced by a factor equal to the proportion of at-risk subjects who experience the event. Censored subjects are removed from the risk set at the time of censoring but do not contribute to events.

Step-by-Step Calculation Example

Consider a small study of 10 patients followed for recurrence of a disease:

  • Patient A: recurs at 3 months
  • Patient B: censored at 4 months
  • Patient C: recurs at 5 months
  • Patient D: recurs at 6 months
  • Patient E: censored at 6 months
  • Patient F: recurs at 8 months
  • Patients G, H, I, J: no events, followed until 12 months (censored at 12)

The ordered event times are 3, 5, 6, and 8 months. At time 3: n=10, d=1 → survival probability = 1 − 1/10 = 0.9 → Ŝ(3)=0.9. At time 5: risk set before 5 includes those still at risk after time 3 (9 subjects), but B was censored at 4, so risk set at time 5 is 8 (A, C, D, F, G, H, I, J – but A had event so cannot be at risk; careful: after event at 3, A is removed. So after time 3, risk set = 9 (B,C,D,E,F,G,H,I,J). B censored at 4 reduces risk set to 8 just before time 5). So n=8, d=1 → Ŝ(5)=0.9 × (1 − 1/8)=0.9×0.875=0.7875. At time 6: risk set after time 5 reduces by event at 5 (C) and censored? No new censorings between 5 and 6? Patient E censored at 6 exactly? Usually events before censorings at same time; but we can assume event occurs just before censoring. So after time 5, risk set = 7 (D,E,F,G,H,I,J). At time 6: d=1, n=7 → Ŝ(6)=0.7875× (1−1/7)=0.7875×0.8571≈0.675. At time 8: after time 6, risk set reduces by event (D) and censoring (E) → risk set before time 8 = 5 (F,G,H,I,J). d=1 → Ŝ(8)=0.675×(1−1/5)=0.675×0.8=0.54. The curve stays at 0.54 from month 8 onward because the remaining patients are censored at 12 without events. This stepwise drop pattern is typical of KM curves.

Constructing a Kaplan‑Meier Survival Curve

Most analyses use statistical software (R, SAS, Stata, Python lifelines, etc.) to compute KM estimates and plot curves. However, understanding the manual construction steps is important for interpretation.

Steps to Create the Curve

  1. Sort data by time: Arrange all observations (event or censoring times) in ascending order.
  2. Determine risk sets: For each distinct event time, count the number of subjects still under observation before that time.
  3. Calculate survival probability: Multiply the step-wise conditional probabilities as shown above.
  4. Plot: On the x-axis plot time; on the y-axis plot Ŝ(t). Draw a horizontal line at the current survival level until the next event time, then drop vertically to the new survival level. Add tick marks for censored observations.
  5. Add confidence intervals: The Greenwood formula estimates the variance of the KM estimator, allowing calculation of pointwise confidence intervals, typically shown as dashed lines or shaded bands around the curve.

Software Implementations

In R, the survival package provides the survfit() function. In Python, the lifelines library offers the KaplanMeierFitter class. For a quick online calculator, resources like Vanderbilt’s Biostatistics Wiki provide examples. The NIST Engineering Statistics Handbook also includes a section on Kaplan-Meier with formulas and assumptions.

Comparing Survival Curves: The Log‑Rank Test

Often researchers want to formally test whether two or more Kaplan-Meier curves are statistically different (e.g., treatment vs. placebo). The log‑rank test is the most common method. It compares the observed number of events in each group to the expected number under the null hypothesis of identical survival. The test statistic follows a chi-squared distribution.

Assumptions of the Log‑Rank Test

  • Independent observations.
  • Non-informative censoring (unrelated to future survival).
  • Hazard functions are proportional over time (the ratio of hazards is constant). When hazards cross, the log-rank test loses power; alternative tests like the Wilcoxon (Breslow) test may be used.

The log‑rank test is the basis for many clinical trial analyses and is reported alongside KM curves. However, it only tests for a difference over the entire follow-up period, not at specific time points.

Limitations and Assumptions of Kaplan‑Meier

Key Assumptions

  1. Non-informative censoring: The reason for censoring should be unrelated to the event. For example, if sicker patients drop out, the KM estimate may be biased.
  2. Independent survival times: The event times of subjects are assumed independent.
  3. No secular trends: The survival experience does not change over calendar time during the study (stable conditions).

Common Pitfalls

  • Small risk sets: When few subjects remain at risk (e.g., late in follow-up), the curve becomes very imprecise. Always examine the number at risk table below the curve.
  • Ignoring competing risks: If subjects can experience other events that preclude the event of interest (e.g., death before recurrence), KM may overestimate the cumulative incidence. Cause-specific analysis or the Aalen-Johansen estimator should be used in such cases.
  • No adjustment for covariates: KM is univariate. To adjust for confounding variables, a Cox proportional hazards model or other regression methods are needed.

Nelson‑Aalen Estimator

An alternative to KM for the cumulative hazard function is the Nelson‑Aalen estimator, which sums the hazard increments: Ĥ(t) = ∑ (di/ni) for event times ≤ t. The survival function can be derived as Ŝ(t) = exp(−Ĥ(t)).

Cox Proportional Hazards Model

Often called the “semi‑parametric” extension, the Cox model allows the inclusion of multiple predictors (covariates) while assuming that the hazard functions for different groups are proportional over time. It estimates hazard ratios, which are widely used in medical literature.

Parametric Survival Models

If the survival times follow a known distribution (exponential, Weibull, log-normal), parametric models can be more efficient. The KM estimator serves as a model‑free baseline to check parametric fits.

Applications Across Disciplines

Medicine and Public Health

Survival curves are ubiquitous in oncology trials to compare time to progression or overall survival. KM plots are required by the FDA for many drug applications. In epidemiology, they help estimate the probability of developing a disease over time.

Engineering and Reliability

Manufacturers use survival analysis to estimate the failure time distribution of components. The Kaplan‑Meier estimator can be used to compute the survival function of a system from field failure data, accounting for units that are still functioning (censored).

Finance and Economics

In finance, survival analysis models the time to default on loans or the time until a customer closes an account. The “survival” of a business or investment can be visualized with KM curves.

Practical Considerations for Reporting

  • Always include a number at risk table below the survival curve at several time points (e.g., 0, 6, 12, 18 months). This table documents how many subjects are still followed and prevents overinterpretation of the right tail.
  • Report median survival time (the time at which survival probability drops to 0.5) along with a confidence interval.
  • If comparing groups, provide the log‑rank test p-value and the hazard ratio from a Cox model.
  • Use the Greenwood formula to compute confidence intervals for the survival curve; consider using the log‑log transformation to keep intervals within [0,1].

Conclusion

Survival curves and the Kaplan‑Meier estimator are indispensable tools for analyzing time-to-event data. Their non-parametric nature, ability to handle censoring, and clear visual interpretation make them the first choice for many researchers. By understanding how to construct, interpret, and compare KM curves—along with their underlying assumptions and limitations—you can draw robust conclusions from survival data. For further reading, the BMJ series on survival analysis by Bland and Altman (part 1: Kaplan‑Meier and part 2: the log‑rank test) provides an excellent clinical perspective. A comprehensive textbook is Survival Analysis: A Self-Learning Text by Kleinbaum and Klein (Springer). Master these basics, and you will be well prepared to move onto more advanced methods like the Cox proportional hazards model and competing risks analysis.