Changelog

This changelog is generated automatically from GitHub Releases.

v0.7.0

2026-09-10 · GitHub

Greenwood v0.7.0 pushes the Greenwood library well beyond classical Cox regression into machine learning, cure models, interval-censored data, and additive hazards. This release adds four families of survival ML estimators (RandomSurvivalForest, ExtraSurvivalTrees, SurvivalTree, and GradientBoostingSurvivalAnalysis), the Turnbull NPMLE for interval-censored outcomes, MixtureCure and AalenAdditive regression models, the BuckleyJames semiparametric AFT estimator, the IPCW-based IPCRidge, and the maxcombo_test weighted log-rank procedure for non-proportional hazards. Diagnostics get a big boost too: Weibull probability plots, Schoenfeld residual plots, AFT residual diagnostics, thresholded-Weibull MPS fitting, and Altair-based predicted-survival visualizations. The tidy/glance layer now covers AalenJohansen, MultiState, NelsonAalen, RoystonParmar, and CoxNet, and the user guide gains new chapters on machine learning, mixture cure models, additive hazards, and interval censoring.

New Features

  • Random Survival Forest, Extra Trees, and Survival Trees — Log-rank splitting tree ensembles (RandomSurvivalForest, ExtraSurvivalTrees, SurvivalTree) with an optional Numba-accelerated split kernel for large datasets. (#40)
  • Gradient Boosting Survival Analysis — Cox-loss gradient boosting with squared-error regression tree base learners, plus variable_importance for feature ranking. (#40)
  • Altair predicted-survival plots — New Altair-based visualization for predicted survival curves from ML estimators. (#40)
  • IPCRidge estimator — Ridge-regularized accelerated failure time regression using inverse-probability-of-censoring weights, with the underlying IPCW utilities exposed for reuse. (#41)
  • Aalen additive hazards model — New AalenAdditive estimator for time-varying additive hazard regression, including a predict() method for cumulative regression coefficients. (#42)
  • Mixture cure modelMixtureCure with EM estimation for populations containing a cured fraction, validated against R’s smcure. (#43)
  • Weibull diagnostic plots — New Weibull probability plotting utility for graphical assessment of Weibull AFT model fit. (#44)
  • AFT residual diagnostics — Comprehensive AFT residual types (Cox-Snell, martingale, deviance, standardized) with a log-density derivative helper backing them. (#45)
  • Turnbull interval-censored estimator — Self-consistent NPMLE Turnbull estimator for left-, right-, and interval-censored data, with RMST and RMRL support. (#46)
  • Thresholded Weibull AFT (MPS) — Maximum product-of-spacings fitting for three-parameter thresholded Weibull models, with matching visualization support. (#47)
  • Buckley-James AFT estimator — New BuckleyJames rank-based semiparametric AFT regression, complementing the parametric AFT family.
  • MaxCombo weighted log-rank test — New maxcombo_test procedure combining multiple Fleming-Harrington weights (early, mid, late, proportional) to detect survival differences under non-proportional hazards.
  • Schoenfeld residual plots — New diagnostic visualization for assessing the proportional-hazards assumption in Cox models.
  • Proportional-odds Royston-Parmar scaleRoystonParmar now supports a proportional-odds parameterization alongside the existing proportional-hazards scale.

Enhancements

  • Tidy/glance adapters added for AalenJohansen, MultiState, NelsonAalen, RoystonParmar, and CoxNet, extending broom-compatible summaries across nearly all estimators.
  • KaplanMeier.quantile() for computing median and arbitrary survival quantiles with confidence intervals.
  • FineGray.to_frame() for tabular output of Fine-Gray subdistribution hazards fits.
  • Cox influence-plotting utilities for identifying influential observations.
  • Expanded test coverage across forest estimators, Royston-Parmar, penalized Cox, GT-based risk tables, viz modules (Schoenfeld, forest plot, smoothed HR, predicted survival), and tidy/glance regressions.
  • New R-parity fixtures for Aalen additive hazards, IPCRidge, MaxCombo, cure models, Turnbull–KM equivalence, and thresholded Weibull, with all existing fixtures refreshed.

Documentation

  • New machine-learning chapter covering RSF, ExtraTrees, and gradient boosting.
  • New mixture cure model chapter in the user guide.
  • New Aalen additive hazards documentation.
  • New Buckley-James regression documentation.
  • New Turnbull interval-censoring section, plus expanded Kaplan-Meier guide coverage.
  • New MaxCombo non-proportional-hazards test documentation.
  • New Weibull diagnostic plot section in the visualization guide.
  • New parametric AFT residuals section in the Cox diagnostics guide.
  • Expanded CoxNet guidance in the Cox regression chapter.
  • Expanded AIC/BIC model-selection and summary documentation.
  • Cox influence-plotting docs added to the diagnostics guide.
  • Survival glossary expanded with modeling terms, AFT residual types, survival transforms, and ensemble concepts.

Maintenance

  • New parity CI job runs the heavy R-parity extras separately from the main test matrix.
  • Added numba as an optional dev dependency for the accelerated tree split kernel.
  • Datasets expanded with e1684 (used for cure-model validation).

v0.6.0

2026-08-13 · GitHub

Greenwood v0.6.0 is a major release focused on model diagnostics, flexible parametric modeling, and robust inference. It rounds out the Cox-diagnostics toolkit with leverage/hat-matrix influence measures, outlier visualization, spline-smoothed hazard-ratio curves, and time-stratified proportional-hazards tests. New RoystonParmar spline models and generalized gamma AFT regression add flexible alternatives to Weibull-based parametric fitting, while sandwich and clustered variance for Kaplan-Meier and a general-purpose bootstrap() utility extend confidence-interval support to previously unsupported quantities. Model evaluation also gains multi-metric cross-validation, an IPCW concordance index, AIC/BIC for CoxNet, and Gray’s test for comparing competing-risks CIFs.

New Features

  • Expected RMST predictionspredict_expectation() computes restricted mean survival time as the area under each subject’s predicted survival curve, available on CoxPH, AFT, and RoystonParmar, with ci=True support via integrated survival confidence bands. (#23)
  • Multi-metric cross-validationcross_validate() now accepts a metrics= list (e.g. ["concordance", "brier", "auc"]) to score several metrics per fold from a single model fit instead of refitting separately for each one. (#24)
  • Time transformations for cox_zphCoxPH.cox_zph() gains a transform= argument ("identity", "log", "km", "rank") controlling how event times are rescaled before testing for proportional-hazards violations, matching R’s survival::cox.zph(). (#25)
  • AIC and BIC for CoxNet — New CoxNet.aic() and CoxNet.bic() methods, built on an effective_df() estimate of penalized model complexity, allow comparing regularized Cox fits without cross-validation. (#26)
  • Sandwich variance for Kaplan-MeierKaplanMeier(robust=True) replaces the classic Greenwood variance with an infinitesimal-jackknife (sandwich) estimator, recommended whenever fitting with non-integer (IPW/survey) weights. (#27)
  • Clustered robust variance for Kaplan-Meier — Passing cluster= to KaplanMeier().fit() sums per-subject influence contributions within each cluster before computing standard errors, correctly widening CIs for correlated observations (e.g. multiple records per site or patient). (#28)
  • Bootstrap confidence intervals — New bootstrap() function provides percentile, normal, and BCa confidence intervals for quantities without closed-form standard errors, including medians, RMST, survival probabilities, and between-group differences. (#29)
  • Predictive intervals for conditional and trajectory predictionsCoxPH.predict(..., ci=True) now supports confidence intervals for landmark conditional survival (conditional_after=) and time-varying-covariate trajectory (trajectory=) predictions, closing a previous NotImplementedError gap. (#30)
  • Leverage and hat-matrix diagnostics — New CoxPH.residuals("leverage") and CoxPH.influence_diagnostics() combine leverage, martingale/deviance residuals, dfbeta(s), and likelihood displacement into a single influence-diagnostics table. (#31)
  • Influence/outlier visualization — New plot_influence() renders side-by-side diagnostic panels (deviance, leverage, likelihood displacement) against the linear predictor, automatically labeling the most influential observations. (#32)
  • Time-stratified proportional-hazards testsCoxPH.cox_zph(breaks=[...]) splits follow-up into time windows and runs the Schoenfeld-residual PH test within each, revealing whether PH violations concentrate in specific periods. (#34)
  • Smooth hazard-ratio curves — New CoxPH.smooth_hr() and plot_smooth_hr() fit a spline basis for a continuous covariate to reveal non-linear log-hazard-ratio shapes, with confidence bands. (#35)
  • Flexible parametric survival models — New RoystonParmar class fits restricted cubic splines on the log cumulative hazard scale, matching flexsurv::flexsurvspline()/Stata’s stpm2, for smooth non-Weibull hazard shapes while retaining proportional hazards. (#36)
  • Generalized gamma regressionAFT("gengamma") adds a shape parameter that nests Weibull, lognormal, and gamma as special cases; AFT.test_distributions() runs a likelihood-ratio test to check whether the added flexibility is warranted. (#37)
  • Gray’s test for comparing CIFs — New grays_test() is the competing-risks analogue of the log-rank test, comparing cumulative incidence functions across groups using the same IPCW weighting as the Fine-Gray model. (#38)
  • IPCW concordance index — New concordance_index_ipcw() implements the Uno et al. (2011) estimator, a consistent concordance measure under censoring via inverse-probability-of-censoring weighting, with an optional tau= horizon. (#39)

Enhancements

  • Cox partial-likelihood risk-set computation was rewritten to use cumulative sums over subjects sorted by exit time instead of a per-event boolean scan, substantially speeding up model fitting on large datasets and datasets with many unique event times. (#33)

v0.5.0

2026-07-29 · GitHub

Greenwood v0.5.0 adds first-class support for time-varying covariates. The new split_episodes() utility handles the data-wrangling step that has historically been a barrier to TVC analysis: it takes a subject-level baseline table and a long-format visits table and merges them into the counting-process (interval-per-row) format that Surv.counting() and CoxPH already accept.

New Features

  • Time-varying covariate support via split_episodes() — Converts repeated-measurement data into counting-process (episode-split) format. Accepts a baseline table (one row per subject with follow-up time, event indicator, and time-fixed covariates) and a visits table (one row per subject/visit with time-varying covariate values), and produces a (tstart, tstop, event, …) dataset ready to pass directly to Surv.counting() and CoxPH.fit(). Supports last-observation-carried-forward (LOCF) via carry_forward=True and returns output in Pandas, Polars, or PyArrow depending on the format= argument. (#21)

v0.4.0

2026-07-24 · GitHub

Greenwood v0.4.0 expands the existing Cox-modeling capabilities with stronger model selection, richer diagnostics, and broader support for clustered survival data. This release also introduces cross-validated penalizer selection for CoxNet, shared frailty modeling (now including lognormal frailty), and stratified survival prediction workflows. A major secondary focus was improved correctness for baseline hazard confidence intervals.

New Features

  • Cross-validated CoxNet penalizer selection (cv_coxnet()) — Added k-fold cross-validation over penalizer paths (including best and 1-SE choices) to help select regularization strength more robustly. (#13)
  • Initial shared frailty support in CoxPH — Introduced cluster-level frailty modeling to better handle within-group dependence in survival outcomes. (#14)
  • Cox residual diagnostics — Added diagnostic residual outputs (including martingale, deviance, Schoenfeld-family, and influence-style residuals) to support model checking and PH-assumption assessment. (#18)
  • Lognormal shared frailty — Added lognormal frailty as an additional shared frailty option for clustered Cox models. (#19)
  • Stratified survival predictions — Improved prediction workflows for stratified Cox models so survival predictions are aligned to per-stratum baseline hazards. (#20)

Enhancements

  • Expanded CI test coverage for AFT survival prediction confidence intervals to improve reliability. (#17)

Bug Fixes

  • Cox baseline hazard confidence interval behavior was corrected for improved accuracy and consistency. (#16)

Documentation

  • Improved docstrings across the codebase for clearer API usage and reference quality. (#15)

v0.3.0

2026-07-20 · GitHub

Greenwood v0.3.0 is a substantial release focused on model evaluation, visualization, and statistical inference. It introduces time-dependent AUC for discrimination assessment across multiple horizons, forest plots for Cox hazard ratios, cumulative incidence function (CIF) plots for competing risks, and stratified RMST comparisons with inverse-variance pooling. Univariate parametric distribution fitting and extended AFT predictions round out the modeling improvements, while stratified k-fold cross-validation ensures honest performance estimates even with imbalanced event rates.

New Features

  • Time-dependent AUC — The new time_dependent_auc() function computes the Uno IPCW-weighted cumulative/dynamic AUC at specified time horizons, providing a discrimination summary that accounts for the time-varying nature of survival predictions. (#8)

  • Forest plots — The new plot_forest() function renders hazard-ratio plots with confidence intervals from fitted CoxPH models or RMSTResult objects. Supports both the Altair and plotnine backends. (#6)

  • CIF plots — The new plot_cif() function visualizes cumulative incidence functions from fitted AalenJohansen objects, with optional risk tables and per-group stratification for competing-risks analyses. (#10)

  • Univariate parametric models — The new Parametric class fits a single parametric survival distribution (Weibull, exponential, log-normal, log-logistic) to right-censored data by maximum likelihood, without covariates. The companion compare_distributions() helper fits all four families and returns an AIC/BIC comparison table for distribution selection. (#9)

  • Stratified RMST comparisonrmst_test() and rmst_diff() now accept a strata= argument for stratified group comparisons. Per-stratum RMST estimates are combined via inverse-variance pooling, matching the survRM2 reference implementation. (#5)

Enhancements

  • AFT.predict() now supports three additional prediction types: "mean" (expected survival time), "mean_remaining" (mean residual life at a given time), and "rmst" (restricted mean survival time up to a user-supplied tau). (#7)

  • AalenJohansen now accepts a conf_type= parameter ("plain", "log", "log-log") to control the confidence interval transformation for cumulative incidence estimates, consistent with R’s survfit. (#11)

  • cross_validate() now uses stratified k-fold splitting by default (stratified=True), ensuring each fold preserves the overall event proportion. This prevents singular matrix errors and biased CV estimates on imbalanced survival data. (#12)

v0.2.0

2026-07-10 · GitHub

Greenwood v0.2 provides several expansions to statistical testing, visualization capabilities, and confidence interval support. This release introduces stratified cross-validation for model evaluation, powerful group comparison tools including linear trend tests and restricted mean survival time (RMST) comparisons, interactive publication-ready forest plots and cumulative incidence visualizations with Great Tables integration, and comprehensive confidence interval estimation for baseline hazard and survival predictions in both Cox and parametric AFT models.

New Features

  • Stratified cross-validationcross_validate() now supports stratified k-fold CV for survival data, ensuring balanced outcome distributions across folds for more reliable model evaluation. (#3)

  • Forest plot visualization — New forest_plot() function creates interactive publication-quality forest plots for displaying hazard ratios and confidence intervals across multiple strata or subgroups with aligned at-risk tables. (#3)

  • Cumulative incidence plots — New cif_plot() function visualizes competing risk cumulative incidence functions with competing event stacks, censoring indicators, and optional at-risk tables. (#3)

  • Risk table with Great Tables — Enhanced risk table visualization using Great Tables for improved styling. (#3)

  • Baseline hazard confidence intervalsCoxPH.baseline_hazard() now supports confidence intervals via the ci= and conf_level= parameters, enabling uncertainty quantification for baseline hazard estimates. (#4)

  • AFT survival prediction confidence intervalsAFT.predict() now includes ci= and conf_type= parameters for confidence intervals on survival predictions using delta-method standard error estimation. (#4)

  • Linear trend test — New trend_test() function tests for linear trends across ordered groups (e.g., disease stages or dose levels) with support for Fleming-Harrington weights and stratification, providing higher power when groups are naturally ordered.

  • RMST group comparison — New rmst_test() function performs hypothesis tests for restricted mean survival time (RMST) equality across groups, with confidence intervals for RMST differences and support for both ratio and percentage-difference estimands.

  • Pairwise RMST comparisons — New pairwise_rmst_test() function enables multiple pairwise RMST comparisons with adjustable p-value correction methods (Bonferroni, Holm, etc.).

  • RMST difference utility — New rmst_diff() function calculates RMST differences and ratios between two groups with full confidence interval and variance estimation.

Bug Fixes

  • CoxPH coefficients are now properly invariant to uniform weight scaling, fixing a numerical issue where coefficient estimates changed with different weight magnitudes. (#2)

Enhancements

  • AFT confidence interval calculations now use stabilized log-log transformations for improved numerical stability in edge cases.
  • Multiple improvements to baseline hazard CI bounds and test stability for Cox models.
  • Enhanced input validation and type checking for visualization functions.

Documentation

  • Added comprehensive guide section for baseline hazard confidence intervals in Cox models.
  • Added AFT survival CI prediction guide with examples.
  • Documented linear trend tests in the group comparisons user guide.
  • Added RMST comparison examples to group comparisons documentation.

v0.1.0

2026-07-07 · GitHub

Initial release : modern survival analysis for Python which is Narwhals-native, R-validated, and beautifully visualized.

Highlights

Greenwood brings production-ready survival analysis to the Python data ecosystem. It works with whatever dataframe library you use (Pandas, Polars, PyArrow, or any Narwhals-compatible frame), every statistic is validated to tolerance against R’s survival package, and interactive publication-quality plots come out of the box. From a single Kaplan-Meier curve to competing-risks regression and penalized Cox models, everything lives under a unified API.

Core Statistical Methods

  • Surv response object — Represents survival data in right-, left-, and interval-censored form, counting-process form, left truncation, case weights, and multi-state endpoints, with built-in validation.
  • Kaplan-Meier estimation (KaplanMeier) — Survival curves with Greenwood variance, multiple confidence interval types, median/quantile survival, restricted mean survival time (RMST), and step-function predictions at arbitrary times.
  • Nelson-Aalen estimator (NelsonAalen) — Cumulative hazard curves with the same tidy output conventions as KaplanMeier.
  • Log-rank tests (logrank_test(), pairwise_logrank_test()) — Standard log-rank and the full G-rho (Fleming-Harrington) family for two or more groups, plus pairwise comparisons with p-value adjustment.
  • Cox proportional hazards (CoxPH) — Hazard-ratio regression with stratification, robust/sandwich variance, cluster-robust standard errors, baseline hazard prediction, and full model diagnostics (Schoenfeld residuals, proportional-hazards test via cox_zph(), concordance index).
  • Penalized Cox regression (CoxNet) — Lasso, ridge, and elastic-net penalized Cox models for high-dimensional covariates.
  • Accelerated failure time models (AFT) — Parametric survival regression with Weibull, exponential, log-normal, and log-logistic distributions, validated against R’s survreg.
  • Flexible parametric models (RoystonParmar) — Royston-Parmar spline-based survival models.
  • Competing risks (AalenJohansen, FineGray) — Cumulative incidence functions via Aalen-Johansen, subdistribution hazard regression via Fine-Gray, and multi-state transition probabilities (MultiState).
  • Event table (EventTable, event_table()) — Raw risk-set and event counts at each unique time point.

Model Performance & Validation

  • Concordance index — Harrell’s C-statistic for evaluating discriminative ability.
  • Brier score & integrated Brier score — IPCW-weighted calibration metrics at arbitrary time points.
  • Calibration — Graphical and numeric calibration assessment.
  • Cross-validation (cross_validate()) — K-fold cross-validation pipeline for any Greenwood model.
  • Power analysis (logrank_power(), logrank_sample_size(), logrank_n_events()) — Prospective sample size and power calculations for log-rank tests.

Visualization

  • plot_survival() — Interactive survival curves with confidence bands, censoring tick marks, and optional aligned at-risk tables; choose between Altair and plotnine backends.
  • risk_table() — Standalone aligned at-risk table, composable with any plot.

Tidy & Reproducible Output

  • Tidy summaries (tidy(), glance(), augment()) — Broom-compatible model summaries that return tidy DataFrames with consistent column names across all estimators.
  • Built-in datasetslung, veteran, ovarian, pbc, colon, mgus2, and more, loadable in any supported backend via gw.load_dataset(name, backend=...).
  • R-parity test harness — Every statistic ships with fixtures validated against R’s survival package.

Dataframe Compatibility

Greenwood is built on Narwhals, so all methods accept and return Pandas DataFrames, Polars DataFrames, PyArrow Tables, or any other Narwhals-compatible frame. Use the format= argument on output methods to control which type of table you get back.

Requirements

  • Python >= 3.10
  • Core dependencies: narwhals>=2.0, numpy>=1.24, scipy>=1.11