Get started
Greenwood turns time-to-event data into estimates, tests, models, and figures. It is built on Narwhals for backend-agnostic compute, validated against R’s survival package, and visualized with plotnine.
The pipeline
Every analysis starts from a Surv response and flows through a shared kernel:
- Surv response: captures the outcome and its censoring (right, left, interval, or the counting-process form with left truncation), plus optional weights and multi-state endpoints. It is validated eagerly, so downstream code can trust it.
- Risk-set / event-table kernel: at each unique event time, how many are at risk, how many had events, how many were censored. This single tabulation underlies Kaplan-Meier, the log-rank test, and Cox.
- Estimators and models: Kaplan-Meier and Nelson-Aalen, group tests, Cox regression, parametric models, competing risks, and multi-state models.
- Outputs: tidy frames, plotnine figures, and publication tables through Great Tables and Great Summaries.
Every statistic in Greenwood is validated to tolerance against R’s survival package, so results match the reference implementation the field already trusts.
How this guide is organized
The guide builds up from data to models. If you are new to survival analysis, read it in order; if you know what you need, jump straight to the relevant page.
- Foundations: Survival data and the Surv object explains censoring and how to represent it, and Data sources and formats covers loading data from any backend.
- Description and comparison: Kaplan-Meier, Comparing groups, and Visualizing survival.
- Regression: Cox regression, Cox model diagnostics, and Parametric models.
- Multiple event types: Competing risks and Multi-state models.
- Evaluation: Prediction performance.
Next steps
- New to the library? Start with Installation, then the Quick start for a fast tour.
- New to survival analysis? Begin with Survival data and the Surv object.