API Reference
The response
Surv() and event_time() build a response from values (Surv() mirrors R’s survival::Surv()). Outcome, the structured form of a formula response such as “Surv(time, status == 2)”, names columns instead and is evaluated against data= at fit time, on any DataFrame backend.
- Surv
-
A survival response, built exactly as R’s
survival::Surv()builds one. - event_time()
-
Create a vector of event times.
- new_event_time()
-
Create an event-time vector with only minimal type checks.
- EventTime
-
A vector of event times that may be exact, or right-, left-, or interval-censored.
- extract_time()
-
Extract the times from an event-time vector.
- extract_status()
-
Extract the status codes from an event-time vector.
- as_surv()
-
Convert an event-time vector to a Surv response.
- first_event()
-
Build a competing-risks response from several endpoints: the earliest observed event wins.
- Outcome
-
A reusable description of a survival response: column names and expressions, no data.
- duration()
-
Describe a time as the elapsed time between two date or datetime columns.
- Duration
-
A time argument computed as the elapsed time between two date or datetime columns.
- CensoringType
-
The type of a Surv response, using R’s type names.
Non-parametric estimators
Kaplan-Meier survival, Nelson-Aalen cumulative hazard, and Turnbull’s NPMLE for interval-censored data.
- KaplanMeier
-
Kaplan-Meier product-limit estimator of the survival function.
- NelsonAalen
-
Nelson-Aalen estimator of the cumulative hazard.
- Turnbull
-
Turnbull’s self-consistent NPMLE for interval-censored survival data.
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, rank-based Buckley-James regression, Aalen additive hazards, mixture cure models, IPC-weighted ridge regression, 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).
- ZPHWindowResult
-
Test results for a single time window within a windowed proportional-hazards test.
- SmoothHRResult
-
Smooth non-linear hazard ratio curve for a continuous covariate.
- AFT
-
Parametric accelerated failure time model.
- BuckleyJames
-
Buckley-James rank-based accelerated failure time regression.
- PiecewiseExponential
-
Piecewise exponential survival model.
- AalenAdditive
-
Aalen additive hazards model with time-varying coefficients.
- MixtureCure
-
Mixture cure model with logistic incidence and Cox PH latency.
- IPCRidge
-
IPC-weighted ridge regression for survival data.
- RoystonParmar
-
Royston-Parmar flexible parametric survival model (hazard or odds scale).
Machine learning
Tree-based ensemble survival models grown with the log-rank splitting rule, producing per-subject survival and cumulative-hazard functions.
- SurvivalTree
-
A survival decision tree grown with the log-rank splitting rule.
- RandomSurvivalForest
-
A random survival forest: a bagged ensemble of log-rank survival trees.
- ExtraSurvivalTrees
-
An extremely-randomized survival forest (extra survival trees).
- GradientBoostingSurvivalAnalysis
-
Gradient-boosted survival model minimizing the Cox partial-likelihood loss.
Competing risks & multi-state
Cumulative incidence, the Fine-Gray subdistribution hazard model (with elastic-net penalization), cause-specific Cox regression, a competing-risk random forest, gradient-boosted cumulative incidence, multi-state transition probabilities, and simulated competing-risks data.
- AalenJohansen
-
Aalen-Johansen estimator of cumulative incidence functions for competing risks.
- FineGray
-
Fine-Gray subdistribution hazard model for a competing-risks endpoint.
- PenalizedFineGray
-
Elastic-net penalized Fine-Gray subdistribution hazard model.
- CauseSpecificCox
-
Cause-specific Cox proportional-hazards model for competing risks.
- CompetingRiskForest
-
A random survival forest for competing risks with native CIF-based splitting.
- SurvivalBoost
-
Gradient-boosted cumulative incidence model for competing risks.
- MultiState
-
Aalen-Johansen estimator of multi-state transition and occupancy probabilities.
- simulate_competing_risks()
-
Generate synthetic competing-risks data from a latent-Weibull model.
- SimulatedCompetingRisks
-
Result of simulate_competing_risks().
Group comparisons
The log-rank test, MaxCombo test for non-proportional hazards, trend tests for ordered groups, the G-rho (Fleming-Harrington) family, Gray’s test for cumulative incidence, and restricted mean survival time (RMST) comparisons.
- logrank_test()
-
Compare survival across groups using the weighted log-rank (G-rho) test.
- maxcombo_test()
-
MaxCombo test: maximum of multiple weighted log-rank Z-statistics.
- 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.
- grays_test()
-
Compare cumulative incidence functions across groups using Gray’s test.
- TestResult
-
The outcome of a log-rank group comparison test.
- MaxComboResult
-
The outcome of a MaxCombo weighted log-rank 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.
Resampling & bootstrap
Bootstrap confidence intervals and k-fold cross-validation for survival models.
- bootstrap()
-
Bootstrap confidence interval for a Kaplan-Meier summary statistic.
- BootstrapResult
-
Result of a bootstrap confidence interval computation.
- cross_validate()
-
Evaluate a survival model’s out-of-sample performance using k-fold cross-validation.
Prediction performance
Concordance, IPCW Brier score, time-dependent AUC, calibration, concordance confidence intervals with delta-method comparison, a bundled competing-risks scorer, and the censoring distribution behind IPC weights.
- concordance_index()
-
Harrell’s concordance index: discrimination of risk scores against observed survival.
- concordance_index_ipcw()
-
IPCW concordance index (Uno et al., 2011) for right-censored survival data.
- concordance_index_ci()
-
IPCW concordance index with a confidence interval.
- concordance_index_compare()
-
Compare two concordance indices via the paired influence-function delta method.
- ConcordanceResult
-
Result of a concordance index with confidence interval.
- ConcordanceCompareResult
-
Result of comparing two concordance indices.
- concordance_index_incidence()
-
IPCW concordance index for cause-specific cumulative incidence.
- brier_score()
-
IPCW (Graf) Brier score of predicted survival probabilities at specified times.
- brier_score_incidence()
-
IPCW Brier score for a cause-specific cumulative incidence function at specified times.
- integrated_brier_score()
-
Integrated (time-averaged) Brier score across multiple time points.
- integrated_brier_score_incidence()
-
Integrated (time-averaged) Brier score for a cause-specific cumulative incidence.
- 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.
- calibration_incidence()
-
Aalen-Johansen calibration error for cause-specific cumulative incidence predictions.
- accuracy_in_time()
-
Time-dependent classification accuracy for competing-risks predictions.
- score_cr()
-
Bundled competing-risks evaluation: concordance, Brier, and integrated Brier.
- CensoringDistribution
-
Kaplan-Meier estimate of the censoring distribution, providing IPC weights.
Visualization
Interactive survival curves, forest plots, and cumulative incidence visualizations with aligned numbers-at-risk tables, plus Schoenfeld residual and probability-plot diagnostics.
- plot_survival()
-
Plot Kaplan-Meier survival curve(s).
- plot_predicted_survival()
-
Plot per-subject predicted survival or cumulative-hazard curves.
- 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.
- plot_influence()
-
Diagnostic scatter plots for identifying influential observations in a Cox model.
- plot_smooth_hr()
-
Plot a smooth hazard ratio curve for a continuous covariate.
- plot_schoenfeld()
-
Scaled Schoenfeld residual plots for assessing proportional hazards.
- plot_weibull()
-
Plot Kaplan-Meier estimates on distribution-linearizing axes.
- 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.
- theme_survival()
-
A light, publication-ready plotnine theme for survival plots.