Survival analysis: Kaplan-Meier curves and Cox regression
An advanced guide to time-to-event data, censoring, Kaplan-Meier curves, log-rank tests, Cox regression, hazard ratios and careful interpretation in medical research.
Structure
Problem, intuition, method, working, limitations and discussion.
Best for
Students preparing for coursework, analysis, interpretation or revision.
Use with
Learning Hub lessons, tutoring sessions or dissertation planning.
Resource guide
Problem
Many health and biomedical studies do not simply ask whether an event happened. They ask when the event happened. Examples include time to death, time to relapse, time to hospital readmission, time to pregnancy, time to infection or time to treatment failure. Standard methods such as t-tests, chi-square tests and ordinary regression are often inappropriate because they ignore follow-up time and censoring. Survival analysis is designed for outcomes where both event status and event timing matter.
- The outcome is time until an event, not just event yes or no.
- Some participants do not experience the event before follow-up ends.
- Censoring must be handled properly.
- Comparing only proportions ignores different follow-up durations.
- Comparing mean times can be misleading when many observations are censored.
- Kaplan-Meier curves are often shown but not interpreted carefully.
- Hazard ratios are often misinterpreted as risk ratios.
Resource guide
Intuition
Survival analysis follows people over time and updates the probability of remaining event-free as events occur. Censoring means that a participant's exact event time is unknown, but we still know they were event-free up to a certain time. Kaplan-Meier curves describe survival experience over time. Cox regression compares hazards between groups while allowing adjustment for covariates.
- The event must be clearly defined.
- Time zero must be clearly defined.
- Follow-up time must be measured consistently.
- Censored participants still contribute information until their censoring time.
- Kaplan-Meier curves estimate the probability of remaining event-free over time.
- The log-rank test compares survival curves between groups.
- Cox regression estimates hazard ratios and allows adjustment.
Resource guide
Method
A survival analysis workflow begins by defining the event, start time and follow-up time. The analyst then describes the number of events and censored observations. Kaplan-Meier curves can be used to show event-free probability over time. A log-rank test can compare unadjusted survival curves. Cox regression can estimate associations with the hazard of the event while adjusting for covariates, provided the proportional hazards assumption is reasonable.
- Step 1: Define the event clearly.
- Step 2: Define time zero, such as diagnosis, randomisation or treatment start.
- Step 3: Define follow-up time and censoring rules.
- Step 4: Count events and censored observations.
- Step 5: Plot Kaplan-Meier curves for important groups.
- Step 6: Use the log-rank test for unadjusted comparison of survival curves.
- Step 7: Fit Cox regression when adjustment is needed.
- Step 8: Interpret hazard ratios with confidence intervals.
- Step 9: Check the proportional hazards assumption.
- Step 10: Discuss censoring, follow-up length and possible bias.
Resource guide
Working
Suppose a cancer study compares time to recurrence between two treatment groups. A Kaplan-Meier curve can show the estimated recurrence-free survival over time in each group. If one group has a lower curve, recurrence tends to occur earlier or more often in that group. A Cox model can estimate the hazard ratio comparing treatment groups, possibly adjusting for age, stage and tumour grade.
- Event: cancer recurrence.
- Time zero: date of treatment or diagnosis.
- Follow-up time: months from time zero to recurrence or censoring.
- Censored: participants without recurrence by the end of follow-up.
- Kaplan-Meier curve: visualises recurrence-free survival over time.
- Log-rank test: compares curves without covariate adjustment.
- Cox regression: estimates adjusted hazard ratios.
- Hazard ratio above 1 suggests higher instantaneous event rate in the exposed group.
- Hazard ratio below 1 suggests lower instantaneous event rate in the exposed group.
Resource guide
Limitations
Survival analysis relies on assumptions that must be considered. Censoring should be non-informative, meaning censored participants should not systematically differ in unobserved event risk compared with those remaining under follow-up. Cox regression also relies on the proportional hazards assumption. If hazards cross or effects change over time, a single hazard ratio may be misleading.
- Informative censoring can bias results.
- Short follow-up may miss important long-term events.
- Few events can produce unstable estimates.
- The median survival time may not be reached.
- The log-rank test does not adjust for covariates.
- The Cox model assumes proportional hazards unless modified.
- Hazard ratios are not the same as risk ratios or survival probabilities.
Resource guide
Discussion
A good survival analysis report should define the event, time origin, censoring and follow-up clearly. It should present the number of participants, number of events, median follow-up where appropriate, Kaplan-Meier curves and hazard ratios with confidence intervals. Interpretation should avoid saying that a hazard ratio directly equals a difference in probability.
- State the event and time origin.
- Report the number of events and censored observations.
- Show Kaplan-Meier curves when comparing groups over time.
- Report hazard ratios with 95% confidence intervals.
- Clarify whether Cox models are adjusted or unadjusted.
- Discuss proportional hazards and censoring assumptions.
- Avoid interpreting hazard ratios as simple risk ratios.
Practical checklist
Before you apply this topic
- Have you defined the event clearly?
- Have you defined time zero?
- Have you defined censoring rules?
- Have you reported follow-up time?
- Have you counted events and censored observations?
- Have you plotted Kaplan-Meier curves where useful?
- Have you used the log-rank test only for unadjusted comparison?
- Have you used Cox regression when adjustment is needed?
- Have you interpreted hazard ratios correctly?
- Have you checked proportional hazards?
- Have you considered informative censoring?
- Have you discussed survival-analysis limitations?
Common mistakes
What to avoid
- Treating time-to-event outcomes as simple binary outcomes.
- Ignoring different follow-up durations.
- Ignoring censoring.
- Calling Kaplan-Meier curves simple line graphs without explaining survival probability.
- Using the log-rank test when adjusted analysis is required.
- Interpreting hazard ratios as risk ratios.
- Ignoring proportional hazards.
- Reporting Cox output without defining the event.
- Failing to report the number of events.
- Making strong causal claims from observational survival data.
How this connects to learning
Use the guide as a bridge between theory and application.
A resource guide should not replace a full course or live teaching session. Instead, it helps you organise your thinking. Use it to identify what you understand, what feels unclear, and what questions you should ask before applying a method to real data.
Before a lesson
Read the intuition and problem sections to prepare.
During analysis
Use the method and checklist to guide decisions.
When writing
Use limitations and discussion to improve interpretation.
Related guides
