API Reference
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
Survresponse.
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
CoxNetpenalizer 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.
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()
-
Return the names of all bundled datasets.
- data.load_dataset()
-
Load a bundled dataset by name.
- summaries.augment()
-
Return an observation-level DataFrame for a fitted model.
- summaries.glance()
-
Return a one-row model-summary DataFrame for a fitted model.
- summaries.register_augment()
-
Register an
augmentadapter for a model class. - summaries.register_glance()
-
Register a
glanceadapter for a model class. - summaries.register_tidier()
-
Register a
tidyadapter for a model class. - summaries.tidy()
-
Return a standardised term-level DataFrame for a fitted model.
- viz.plot_survival()
-
Plot Kaplan-Meier survival curve(s).
- viz.plot_cif()
-
Plot cumulative incidence functions from a fitted Aalen-Johansen estimator.
- viz.plot_forest()
-
Forest plot of hazard ratios (or other contrasts) with confidence intervals.
- viz.theme_forest()
-
A minimal plotnine theme for forest plots.
- viz.risk_table()
-
Return the numbers-at-risk table as a Great Tables object.
- viz.get_risk_table_frame()
-
Return a tidy frame of the number at risk per stratum at each of
times.