Nonparametric
Survival analysis (Kaplan–Meier)
Analyses censored time-to-event data with the Kaplan–Meier method.
Variables
- Time (to event)Continuous — 1
- Event status (0/1)Nominal · Ordinal — 1
- Grouping variableNominal · Ordinal — 0–1
Options
- Event coding1 = event, 0 = censored · 1 = censored, 0 = event
What it reports
Estimates censored time-to-event data with the Kaplan–Meier curve; when groups are assigned, compares them with the log-rank test.
statsmodels · Open the accuracy report
When does this apply?
For a design in which the outcome is time to an event and some observations are censored. Three columns are used: time, event status (a 0/1 code) and — optionally — a group. Which of 1 and 0 marks the event is stated by you in the “Event coding” option; it is never inferred from the data, because the reversed coding yields a wholly plausible and wholly wrong curve. With no group, one Kaplan–Meier curve; with a group, a curve per group plus the log-rank comparison.