Modern survival analysis for Python and R: R-validated, one response model across both languages.
Greenwood is a survival analysis library for the study of time-to-event outcomes. This repository holds both language implementations:
| Package | Directory | Status |
|---|---|---|
| Python | python/ |
Feature-rich. See the Python README and the documentation site. |
| R | r/ |
Early. Surv() and kaplan_meier(), held to the same contracts as Python. See the R README. |
Both packages are native implementations, validated against R's survival package. They replay the same cases, so they agree on inputs and results.
spec/holds the language-neutral contracts (Surv(),event_time(), formulas, Kaplan-Meier) and their conformance cases as JSON.fixtures/r/holds numeric fixtures exported from R for the parity tests.scripts/holds the R scripts that generate both.
The R package replays the Surv() conformance cases and the Kaplan-Meier fixtures so far. The
Python package replays all of them.
Shared functions keep the same names in both languages (Surv(), metrics). Estimators follow each
language's idiom: classes in Python (KaplanMeier) and lower snake case functions returning S3
objects in R (kaplan_meier()). Language-level conventions follow each language (for example, 0-based error locations and NaN/None in Python), and any differences are
recorded as adaptations in spec/.
From the repository root:
make install # Python package (dev extras, into .venv) and R dependencies
make test # both test suites (make py-test, make r-test)
make check # both gates: ruff, pyright, pytest, and R CMD check
make py-check # one package only (or make r-check)Run make help for every target, and see CONTRIBUTING.md.
MIT (c) Richard Iannone. See the LICENSE file.