Skills
A skill is a package of structured files that teaches an AI coding agent how to work with a specific tool or framework. The skill below was generated by Great Docs from this project’s documentation. Install it in your agent and it will be able to run commands, edit configuration, write content, and troubleshoot problems without step-by-step guidance from you.
Any agent — install with npx:
npx skills add https://rich-iannone.github.io/greenwood/Codex / OpenCode
Tell the agent:
Fetch the skill file at https://rich-iannone.github.io/greenwood/skill.md and follow the instructions.Manual — download the skill file:
curl -O https://rich-iannone.github.io/greenwood/skill.mdOr browse the SKILL.md file.
SKILL.md
--- name: greenwood description: > Modern survival analysis for Python: Narwhals-native, R-validated, beautifully visualized. Use when writing Python code that uses the greenwood package. license: MIT compatibility: Requires Python >=3.10. --- # greenwood Modern survival analysis for Python: Narwhals-native, R-validated, beautifully visualized. ## Installation ```bash pip install greenwood ``` ## API overview ### The response The Surv object, the spine of every analysis. - `Surv`: A validated time-to-event response for survival analysis - `CensoringType`: The censoring mechanism of a `Surv` response ### Non-parametric estimators Kaplan-Meier survival and Nelson-Aalen cumulative hazard. - `KaplanMeier`: Kaplan-Meier product-limit estimator of the survival function - `NelsonAalen`: Nelson-Aalen estimator of the cumulative hazard ### Univariate parametric models Standalone parametric distributions for data exploration and model selection. - `Parametric`: Univariate parametric survival distribution - `compare_distributions`: Fit multiple parametric distributions and return an AIC/BIC comparison table ### Regression Cox proportional hazards, parametric AFT models, and time-varying covariate utilities. - `split_episodes`: Convert repeated-measurement data into counting-process (episode-split) format - `CoxPH`: Cox proportional hazards model - `CoxNetCVResult`: Result of cross-validated penalizer selection for `CoxNet` - `cv_coxnet`: Select the `CoxNet` penalizer by k-fold cross-validation - `CoxNet`: Elastic-net penalized Cox proportional hazards model - `ZPHResult`: Proportional-hazards test results (Grambsch-Therneau) - `AFT`: Parametric accelerated failure time model - `RoystonParmar`: Royston-Parmar flexible parametric survival model (proportional hazards scale) ### Competing risks & multi-state Cumulative incidence, the Fine-Gray model, and multi-state transition probabilities. - `AalenJohansen`: Aalen-Johansen estimator of cumulative incidence functions for competing risks - `FineGray`: Fine-Gray subdistribution hazard model for a competing-risks endpoint - `MultiState`: Aalen-Johansen estimator of multi-state transition and occupancy probabilities ### Group comparisons The log-rank test, trend tests for ordered groups, the G-rho (Fleming-Harrington) family, and restricted mean survival time (RMST) comparisons. - `logrank_test`: Compare survival across groups using the weighted log-rank (G-rho) test - `trend_test`: Test for linear trend across ordered groups using the log-rank test family - `pairwise_logrank_test`: Pairwise log-rank tests for all group pairs with multiple-comparison correction - `TestResult`: The outcome of a log-rank group comparison test - `rmst_test`: Test for equality of RMST across two or more groups - `rmst_diff`: Compute the RMST difference between two groups and return a tidy DataFrame - `pairwise_rmst_test`: Pairwise RMST tests for all group pairs with multiple-comparison correction - `RMSTResult`: Results of an RMST comparison test or difference calculation - `logrank_n_events`: Number of events needed for the log-rank test to reach a target power - `logrank_power`: Power of the log-rank test given the number of observed events - `logrank_sample_size`: Total sample size needed for the log-rank test to reach a target power ### Prediction performance Concordance, IPCW Brier score, time-dependent AUC, calibration, and k-fold cross-validation. - `concordance_index`: Harrell's concordance index: discrimination of risk scores against observed survival - `brier_score`: IPCW (Graf) Brier score of predicted survival probabilities at specified times - `integrated_brier_score`: Integrated (time-averaged) Brier score across multiple time points - `time_dependent_auc`: IPCW (Uno) time-dependent AUC at specified times - `integrated_auc`: Time-averaged IPCW AUC across multiple time points - `calibration`: Assess calibration of predicted survival probabilities at a fixed time - `cross_validate`: Evaluate a survival model's out-of-sample performance using k-fold cross-validation ### Visualization Interactive survival curves, forest plots, and cumulative incidence visualizations with aligned numbers-at-risk tables. - `plot_survival`: Plot Kaplan-Meier survival curve(s) - `plot_forest`: Forest plot of hazard ratios (or other contrasts) with confidence intervals - `plot_cif`: Plot cumulative incidence functions from a fitted Aalen-Johansen estimator - `risk_table`: Return the numbers-at-risk table as a Great Tables object ### Core kernel The risk-set / event-table tabulation shared by KM, log-rank, and Cox. - `EventTable`: Per-time risk-set tabulation (optionally within strata) - `event_table`: Tabulate the event history: risk sets and events at each observed time ### Data access Built-in datasets and dataset discovery helpers. - `load_dataset`: Load a bundled dataset by name - `available_datasets`: Return the names of all bundled datasets ### Tidy summaries Broom-style model summaries and extension points. - `tidy`: Return a standardised term-level DataFrame for a fitted model - `glance`: Return a one-row model-summary DataFrame for a fitted model - `augment`: Return an observation-level DataFrame for a fitted model ### Visualization helpers Low-level plotting helpers exported at the top level. - `get_risk_table_frame`: Return a tidy frame of the number at risk per stratum at each of `times` - `theme_forest`: A minimal plotnine theme for forest plots ### Package namespaces Exported subpackages for direct access to grouped functionality. - `data.available_datasets` - `data.load_dataset` - `summaries.augment` - `summaries.glance` - `summaries.register_augment` - `summaries.register_glance` - `summaries.register_tidier` - `summaries.tidy` - `viz.plot_survival` - `viz.plot_cif` - `viz.plot_forest` - `viz.theme_forest` - `viz.risk_table` - `viz.get_risk_table_frame` ## Resources - [Full documentation](https://rich-iannone.github.io/greenwood/) - [llms.txt](llms.txt) — Indexed API reference for LLMs - [llms-full.txt](llms-full.txt) — Comprehensive documentation for LLMs - [Source code](https://github.com/rich-iannone/greenwood)