Survival analysis
Kaplan–Meier curves with Greenwood confidence bands, median survival, a number-at-risk table, log-rank (and Gehan–Breslow, Tarone–Ware) tests for two or more groups, and Mantel–Haenszel hazard ratios — from a time, event, group CSV.
Added
How to use it
Data. One subject per line: time, event status, and an optional group. Status 1 means the event happened (death, relapse,
failure), 0 means censored (still event-free at the last follow-up); flip the coding if your file uses 1 for censored. Without a
status column, a ` after a time marks it censored (`7). Columns are guessed from the header and can be changed. The sample is
the classic Freireich et al. (1963) trial of 6-mercaptopurine against placebo for maintaining remission in acute leukaemia (weeks).
Kaplan–Meier. S(t) = ∏ (1 − di/ni) over event times up to t. Greenwood’s variance is Var S = S² Σ d/(n(n − d)). The
confidence interval can be plain (S ± z·SE), on the log scale (the default in R’s survfit), or log–log (always within 0–1).
The median is the first time S(t) ≤ 0.5 (the midpoint when the curve sits exactly at 0.5); its interval runs from where the lower
to where the upper confidence limit crosses 0.5, and "NR" means not reached. Restricted mean survival time (RMST) is the area
under the curve up to the chosen time. Ticks mark censored subjects; the number at risk is counted just before each axis time.
Comparing groups. The log-rank test sums observed minus expected events over all event times and gives χ² with k − 1 degrees of freedom; Gehan–Breslow (weight ni) and Tarone–Ware (weight √ni) emphasise early differences. With three or more groups, pairwise tests against the reference are Holm-adjusted. Hazard ratios are given three ways without fitting a Cox model: Mantel–Haenszel (Σ dbna/n ÷ Σ danb/n, Greenland–Robins variance), the log-rank ratio (Ob/Eb)/(Oa/Ea), and Peto’s exp((O − E)/V). All assume proportional hazards.
Validation. On the sample data the tool reproduces the textbook values (Kleinbaum & Klein, Survival Analysis): log-rank χ² = 16.793 with E = 19.25 and 10.75, Wilcoxon 13.458, Tarone–Ware 15.124, medians 23 and 8 weeks, and a Mantel–Haenszel hazard ratio of 4.82 (the Cox estimate is also 4.82). For general tests, regression and distributions, see the statistics tool.
| For learning and exploration — clinical or regulatory analyses need validated statistical software and a statistician. |
Feedback is a gift. Something to improve, a feature to add, or a bug? Tell me.
Runs entirely in your browser; nothing you type leaves this page.