What Is Survival Analysis?
Survival analysis is a branch of statistics that models the time until a specified event occurs. Despite the clinical name, the "event" does not need to be death it can be disease recurrence, hospital readmission, treatment failure, first seizure, or any other binary outcome that occurs at a point in time during follow-up.
The defining characteristic of survival data is that the event may not happen to every subject before the study ends. Some patients are still alive, still in remission, or still event-free when the observation window closes. This creates a fundamental analytical problem: you cannot simply average times-to-event across all patients, because you do not know the final times for subjects who have not yet experienced the event. Standard parametric tests the t-test, ANOVA, or even linear regression have no mechanism to account for this reality, which is why they cannot validly analyze survival outcomes.
When to Use Survival Analysis
Use survival analysis whenever your research question involves time-to-event data and any of the following conditions apply:
- Not every participant experiences the event before the study ends (administrative censoring)
- Some participants drop out of the study before experiencing the event (loss to follow-up)
- Participants are enrolled at different calendar times and followed for different durations
- You need to compare the timing of events between two or more groups
Common applications in medical research include: overall survival (OS) in oncology trials, disease-free survival (DFS) after surgical resection, progression-free survival (PFS) in chemotherapy studies, time to hospital readmission, time to treatment response, and time to first cardiovascular event in cardiology cohort studies.
The Kaplan-Meier Estimator: How It Works
The Kaplan-Meier (KM) estimator, introduced by Edward Kaplan and Paul Meier in 1958, is a non-parametric method that estimates the survival function S(t) the probability that a subject survives beyond time t directly from the observed data, without assuming any particular distribution (exponential, Weibull, log-normal, etc.).
The KM Formula
At each time point t where at least one event occurs, the KM estimator multiplies the conditional probabilities of surviving each successive interval:
The result is a step function a staircase that drops at each time point where an event (not a censoring) occurs. Between events, the curve is perfectly flat. The horizontal axis represents time (days, months, or years); the vertical axis represents the estimated probability of surviving (or remaining event-free) to that point.
What the Kaplan-Meier Curve Looks Like
The chart below shows two typical KM curves from a hypothetical stage III non-small cell lung cancer (NSCLC) trial comparing immunotherapy plus chemotherapy (treatment group) against chemotherapy alone (control group). Each downward step represents one or more deaths at that time point. The vertical tick marks () on the curve indicate censored observations patients who left the study before experiencing the event.
Understanding Censored Data
Censoring is one of the most important and most misunderstood concepts in survival analysis. A subject is censored when their follow-up ends before the event of interest occurs, and you therefore do not know when (or whether) they would have experienced the event.
Types of Censoring
Right censoring (most common in clinical trials)
The event has not yet occurred when observation ends. The subject's true event time is somewhere to the right of the last known contact date. Examples: the study ends on a fixed calendar date and the patient is still alive; the patient is lost to follow-up at month 18; the patient withdraws consent.
Left censoring
The event is known to have occurred before a certain time, but the exact time is unknown. Example: a patient has an HIV infection of unknown duration at enrollment they were infected before study entry but the date is unknown. Less common in clinical trials.
Interval censoring
The event is known to have occurred between two observation time points, but the exact time within that interval is unknown. Example: a prostate cancer patient has PSA measured every 6 months recurrence occurred sometime between month 18 and month 24 visits.
Censoring Is Not Missing Data
This is perhaps the single most important conceptual point for new researchers: censoring is informative data, not missing data. A censored observation tells you definitively that the subject survived at least until their last known contact date. This information is incorporated into the KM calculation by keeping the subject in the "at-risk" group up until their censoring time, then removing them from subsequent calculations contributing their known survival time to the analysis without assuming they experienced the event.
The Non-Informative Censoring Assumption
The Kaplan-Meier method assumes that censoring is non-informative meaning that subjects who are censored have the same underlying survival prospects as those who remain under observation. If patients are lost to follow-up specifically because they are healthier and chose to stop treatment (or conversely, because they died unreported), the censoring mechanism is informative and violates this assumption. Sensitivity analyses, such as worst-case or best-case scenarios for censored outcomes, should be reported when this assumption is uncertain.
Median Survival Time
The median survival time is the point at which the Kaplan-Meier curve crosses the 0.5 probability line the time by which exactly half the subjects have experienced the event. It is the standard summary statistic for survival data and should be the default value reported in clinical publications.
Why Median, Not Mean?
Survival time distributions are almost universally right-skewed: a small number of long-term survivors can dramatically inflate the arithmetic mean, making it an unrepresentative and unreliable summary measure. In studies where the event is death, a handful of patients who survive for decades can pull the mean survival far above what most patients actually experience. The median is resistant to this distortion and is always interpretable as the time at which 50% of your cohort has experienced the event.
Additionally, the mean overall survival cannot even be calculated unless all subjects have experienced the event by the end of follow-up. In most clinical trials with reasonable follow-up periods, a substantial proportion of patients are still alive, making the mean incalculable. The median only requires that the curve crosses 0.5 which occurs as long as at least 50% of subjects eventually experience the event.
A phase III NSCLC trial enrolls 420 patients: 210 receiving pembrolizumab + carboplatin and 210 receiving carboplatin + paclitaxel alone. After 36 months of follow-up, the KM analysis shows:
- Immunotherapy group: the curve crosses 0.5 at month 28.4 median OS = 28.4 months (95% CI: 24.132.7)
- Chemotherapy group: the curve crosses 0.5 at month 14.9 median OS = 14.9 months (95% CI: 12.317.5)
The 95% CI is calculated using the Brookmeyer-Crowley method and reflects the precision of the median estimate. The wider the CI, the fewer events contributed to that part of the curve.
The Log-Rank Test
The KM curve tells you what the survival pattern looks like in each group. The log-rank test (also called the Mantel-Cox test) tells you whether the observed differences between groups are statistically significant i.e., whether they are unlikely to have arisen by chance under the null hypothesis that all groups have identical survival distributions.
How the Log-Rank Test Works
At each time point where an event occurs, the log-rank test calculates the observed number of events (O) in each group and compares it to the expected number of events (E) under the null hypothesis of equal survival. The expected count in each group is proportional to how many subjects were at risk in that group at that particular time. The test statistic combines these observed-minus-expected discrepancies across all event times:
The resulting p-value is compared to the pre-specified alpha level (usually 0.05) to determine statistical significance. A log-rank p-value below 0.05 provides evidence that the survival distributions differ between groups.
The Proportional Hazards Assumption
The log-rank test is most powerful when the hazard ratio between groups is constant over time the proportional hazards (PH) assumption. Intuitively, this means the survival curves should not cross and the relative risk of the event should remain the same early and late in follow-up. The PH assumption is satisfied when the KM curves separate cleanly and maintain a roughly consistent distance throughout follow-up.
When survival curves cross, or when one treatment has an early benefit that disappears over time (as seen with some immunotherapies), the log-rank test can produce misleadingly high p-values and miss a real treatment effect. In these situations, the weighted log-rank test (Fleming-Harrington with adjustable weights) or restricted mean survival time (RMST) are better alternatives.
Stratified Log-Rank Test
When important prognostic variables exist (ECOG performance status, disease stage, center in a multicenter trial), the stratified log-rank test controls for these variables by performing the observed-vs-expected comparison separately within each stratum and pooling the results. This is analogous to adjusted analysis in linear regression and is often specified in advance in the statistical analysis plan of a randomized controlled trial.
Oncology Examples: Reading Survival Analysis in Practice
Survival analysis is the backbone of oncology clinical trial reporting. Understanding how to read and critically appraise a published KM curve is an essential skill for any clinician or medical researcher working in cancer medicine.
Example 1: Immunotherapy vs Chemotherapy in Advanced NSCLC
A phase III randomized controlled trial compares pembrolizumab plus platinum-based chemotherapy (n=210) versus chemotherapy alone (n=210) in treatment-naive stage IV NSCLC patients with PD-L1 TPS 1%.
Primary endpoint: Overall survival (OS) defined as time from randomization to death from any cause.
KM findings: At 36 months of follow-up, 68 events had occurred in the immunotherapy group versus 112 in the chemotherapy group. Median OS was 28.4 months (95% CI 24.132.7) versus 14.9 months (12.317.5). The log-rank test yielded p < 0.001. Cox regression gave HR = 0.58 (95% CI 0.470.72), indicating a 42% reduction in the hazard of death with immunotherapy.
Example 2: Disease-Free Survival in Early Breast Cancer
A multicenter retrospective cohort study compares 5-year disease-free survival (DFS) in 860 women with stage II HER2-positive breast cancer treated with: (A) trastuzumab + chemotherapy (n=430) versus (B) chemotherapy alone (n=430). DFS is defined as time from surgery to local or distant recurrence, contralateral breast cancer, or death from any cause whichever occurs first.
KM findings: 5-year DFS was 82.4% (95% CI 78.186.7%) in group A versus 63.2% (95% CI 58.368.1%) in group B. Median DFS was not reached in the trastuzumab group (50%+ were still event-free at 60 months) versus 51.3 months (95% CI 46.855.8) in the chemotherapy group. Log-rank p < 0.001; HR = 0.51 (95% CI 0.400.65).
Example 3: Time to Biochemical Recurrence in Prostate Cancer
A single-center cohort of 312 patients with localized prostate cancer receiving radical prostatectomy are followed for biochemical recurrence (BCR), defined as two consecutive PSA values 0.2 ng/mL. Patients are stratified by Gleason score: Gleason 6 (n=124), Gleason 7 (n=118), and Gleason 810 (n=70).
KM findings: 5-year BCR-free survival was 91.2% for Gleason 6, 74.6% for Gleason 7, and 49.3% for Gleason 810. The stratified log-rank test was highly significant (p < 0.001 with 2 degrees of freedom), indicating that Gleason score significantly predicts time to biochemical recurrence.
Interpreting Kaplan-Meier Curves: What to Look For
Reading a KM curve critically requires examining several features beyond the p-value alone.
The Number-at-Risk Table
Every published KM figure should include a number-at-risk table below the x-axis showing how many subjects remain under observation at each time point. As time progresses, this number decreases due to events and censorings. When few subjects remain at risk (typically fewer than 1015 per group), the KM curve becomes highly unstable each additional event causes a disproportionately large downward jump. The number-at-risk table allows readers to judge which parts of the curve are reliably estimated and which represent sparse data.
Confidence Interval Width
The shaded confidence interval bands around each KM curve (usually representing the 95% CI using Greenwood's formula) widen progressively toward the right tail of the curve. This widening visually communicates increasing statistical uncertainty as fewer subjects remain at risk. Two curves whose confidence intervals substantially overlap in a region of follow-up suggest that the survival difference in that region is not reliably estimated, regardless of the overall p-value.
Crossing Survival Curves
When two KM curves cross, the treatment effect is not constant over time there may be an initial benefit with one treatment and a late benefit with the other. Crossing curves are common with immunotherapies, which may initially appear to have worse early outcomes (immune-related adverse events, early progression) before demonstrating durable long-term benefit. As discussed above, crossing curves violate the proportional hazards assumption and make the log-rank test unreliable. Never apply a log-rank test uncritically when curves cross report restricted mean survival time (RMST) instead.
Clinical vs Statistical Significance
A statistically significant log-rank p-value in a large trial can correspond to a survival difference of a few weeks not clinically meaningful. Conversely, a borderline p-value in a small trial may correspond to a large absolute difference in median survival with wide confidence intervals. Always assess the absolute difference in median survival, the hazard ratio, and whether the effect size meets established thresholds for clinical significance in the relevant disease area before drawing conclusions.
Common Mistakes Researchers Make in Survival Analysis
Mistake 1: Using a t-test or Mann-Whitney to compare survival times
Some researchers apply a t-test directly to survival times (months to event), treating them like any other continuous outcome. This fails on two counts: it cannot account for censored observations (which are excluded, biasing the comparison), and survival times are rarely normally distributed, violating the t-test's core assumption.
Mistake 2: Treating censored observations as events
Assigning the censoring date as the event date "they left the study, so I'll count that as the time of death" dramatically underestimates survival and inflates event counts. This error is particularly serious when censoring is common or when the censored group has systematically different characteristics from those who experienced the event.
Mistake 3: Omitting the number-at-risk table
Publishing a KM curve without a number-at-risk table beneath it makes it impossible for readers to judge the reliability of the right-tail estimate. Most major oncology journals (JCO, Lancet Oncology, NEJM) require this table as standard. Without it, a curve showing "70% survival at 5 years" could be based on 200 patients or on 3 patients readers cannot tell.
Mistake 4: Truncating the curve when few subjects remain at risk
Researchers sometimes extend the KM curve all the way to the last observed event, even when only 12 subjects remain at risk. This gives the false impression of a reliable long-term survival estimate. The final few steps of the curve each representing a survival probability of 1/(small number) are extremely imprecise and can be visually dramatic without being informative.
Mistake 5: Applying the log-rank test when curves cross
The log-rank test assumes proportional hazards (constant hazard ratio over time). When two survival curves cross one group initially better, the other group better later this assumption is violated. The log-rank test in this setting is underpowered, gives a p-value biased toward the null, and may miss a real but time-varying effect.
Mistake 6: Performing landmark analysis post hoc
A "landmark analysis" excludes subjects who experienced the event before a specified time point (the "landmark") and examines subsequent survival from that point forward. This is legitimate when pre-specified, but performing it post hoc especially after examining the data introduces selection bias because it removes early events from one or both groups in a non-random way.
Frequently Asked Questions
Use KM for visualization and unadjusted comparisons; use Cox regression when you need to control for confounding variables, estimate an adjusted hazard ratio, or identify independent prognostic factors.
For pairwise comparisons, perform post-hoc log-rank tests with a Bonferroni correction (alpha / number of pairs) to control the family-wise error rate. For example, with 3 groups (3 pairwise comparisons), use a threshold of +/- = 0.05/3 = 0.017 for each pairwise test.
Crossing curves violate the core assumption of the log-rank test, which assumes a constant hazard ratio over the entire follow-up period. When curves cross, the log-rank test is underpowered and may produce misleadingly high p-values. Better alternatives include: the weighted log-rank test (Fleming-Harrington weights), restricted mean survival time (RMST), or fitting a parametric survival model with time-varying hazard ratios.
1. Median survival time with 95% CI (Brookmeyer-Crowley method) for each group
2. Log-rank test p-value
3. Hazard ratio and 95% CI from Cox regression (adjusted if confounders exist)
4. KM figure with confidence interval shading and number-at-risk table
5. Total follow-up time and median follow-up duration
Example sentence: "Median overall survival was 28.4 months (95% CI 24.132.7) in the immunotherapy group versus 14.9 months (95% CI 12.317.5) in the chemotherapy group (log-rank p < 0.001; HR 0.58, 95% CI 0.470.72)."
For formal sample size calculation, specify: expected event rate in each group, median survival in each group, desired power (typically 8090%), alpha level (usually 0.05, two-sided), and expected censoring rate. Statistical software (R's survminimax, PASS, or the StatClinic sample size calculator) can compute the required number of events and corresponding sample size for the primary endpoint.
- Time to disease recurrence after surgery or chemotherapy
- Time to hospital readmission after discharge
- Time to treatment response or first complete remission
- Time to first seizure in patients with epilepsy risk
- Time to pregnancy in fertility research
- Time to surgical complication after elective procedures
- Time to ICU discharge in critical care research
For the log-rank test, the Peto-Peto (Breslow) method handles ties. In Cox regression, the Efron approximation is preferred when ties are common, as it is more accurate than the Breslow approximation in that setting. Using exact event dates whenever possible reduces the frequency of ties and eliminates the need for tie-breaking assumptions.
Run Kaplan-Meier Survival Analysis Free
StatClinic's survival analysis tool generates KM curves, log-rank test results, median survival with 95% CI, and a number-at-risk table automatically. Paste your data and get publication-ready output in seconds no software to install, no login required.
Open Kaplan-Meier Tool