Skip to contents

Survival responses

The response objects that the estimators and models take, and helpers that build them from dates, several endpoints, or time-varying covariates.

Surv()
Create a survival response
as_surv()
Convert to a survival response
event_time()
Create an event-time response
new_event_time()
Build an event-time vector from its parts
extract_time() extract_status()
Take an event-time vector apart
first_event()
Build a competing-risks response from several endpoints
duration()
Elapsed time between two dates
split_episodes()
Split follow-up into episodes of constant covariates
event_table()
Risk sets and events at each observed time

Survival curves

Nonparametric estimates of survival and the cumulative hazard.

kaplan_meier()
Kaplan-Meier estimate of survival
predict(<kaplan_meier>) summary(<kaplan_meier>)
Kaplan-Meier estimates at given times
quantile(<kaplan_meier>) median(<kaplan_meier>)
Survival time quantiles from a Kaplan-Meier fit
nelson_aalen()
Nelson-Aalen estimate of the cumulative hazard
predict(<nelson_aalen>)
Nelson-Aalen estimates at given times
turnbull()
Turnbull estimate of survival for interval-censored data
predict(<turnbull>)
Turnbull estimates at given times
quantile(<turnbull>) median(<turnbull>)
Survival time quantiles from a Turnbull fit
rmst() rmrl()
Restricted mean survival time
bootstrap()
Bootstrap confidence intervals for Kaplan-Meier summaries

Comparing groups

logrank_test()
Log-rank test for differences in survival
pairwise_logrank_test()
Log-rank tests between every pair of groups
trend_test()
Log-rank test for a trend across ordered groups
maxcombo_test()
MaxCombo test for differences in survival
rmst_test() rmst_diff()
Compare restricted mean survival time between two groups
pairwise_rmst_test()
Compare restricted mean survival time between every pair of groups
logrank_n_events() logrank_power() logrank_sample_size()
Sample size and power for the log-rank test

Cox models

cox_ph()
Cox proportional hazards regression
predict(<cox_ph>)
Predictions from a Cox model
residuals(<cox_ph>)
Residuals of a Cox model
as.data.frame(<cox_ph>)
Coefficient table of a Cox model
baseline_hazard()
Baseline hazard of a model
cox_zph()
Test the proportional hazards assumption of a Cox model
frailty_test()
Test for frailty in a Cox model
influence_diagnostics()
Influence diagnostics of a Cox model
smooth_hr() as.data.frame(<smooth_hr>)
A smooth hazard ratio curve for a continuous covariate

Penalized regression

cox_net()
Elastic-net penalized Cox regression
predict(<cox_net>) as.data.frame(<cox_net>)
Predictions and coefficients of an elastic-net Cox model
cv_coxnet()
Choose the penalizer of an elastic-net Cox model by cross-validation
ipc_ridge()
IPC-weighted ridge regression
predict(<ipc_ridge>) as.data.frame(<ipc_ridge>)
Predictions and coefficients of an IPC-weighted ridge regression

Parametric and flexible models

aft()
Accelerated failure time regression
predict(<aft>)
Predictions from an accelerated failure time model
residuals(<aft>)
Residuals of an accelerated failure time model
as.data.frame(<aft>)
Coefficient table of an accelerated failure time model
test_distributions()
Test the distributions nested in a generalized gamma model
parametric()
Parametric survival distributions
predict(<parametric>) quantile(<parametric>) median(<parametric>) mean(<parametric>) rmst(<parametric>)
Survival, hazard, and summaries of a parametric fit
compare_distributions()
Compare parametric distributions
piecewise_exponential()
Piecewise exponential model
predict(<piecewise_exponential>) as.data.frame(<piecewise_exponential>)
Predictions and coefficients of a piecewise exponential model
royston_parmar()
Royston-Parmar flexible parametric survival models
predict(<royston_parmar>)
Predictions from a Royston-Parmar model
as.data.frame(<royston_parmar>)
Coefficient table of a Royston-Parmar model
buckley_james()
Buckley-James regression
predict(<buckley_james>) as.data.frame(<buckley_james>)
Predictions and coefficients of a Buckley-James regression
mixture_cure()
Mixture cure model
predict(<mixture_cure>) as.data.frame(<mixture_cure>)
Predictions and coefficients of a mixture cure model

Additive hazards

aalen_additive()
Aalen's additive hazards model
predict(<aalen_additive>)
Predictions from an Aalen additive hazards model
as.data.frame(<aalen_additive>)
Table of an Aalen additive hazards model
cumulative_coefficients()
Cumulative regression coefficients of a model

Competing risks and multi-state models

aalen_johansen()
Cumulative incidence with competing risks
predict(<aalen_johansen>)
Cumulative incidence at given times
grays_test()
Gray's test for differences in cumulative incidence
fine_gray()
Fine-Gray regression for competing risks
predict(<fine_gray>)
Predictions from a Fine-Gray model
penalized_fine_gray()
Elastic-net penalized Fine-Gray regression
predict(<penalized_fine_gray>) as.data.frame(<penalized_fine_gray>)
Predictions and coefficients of a penalized Fine-Gray model
cause_specific_cox()
Cause-specific Cox regression
multi_state()
State occupancy in a multi-state model
predict(<multi_state>)
State occupancy at given times
simulate_competing_risks()
Simulate competing-risks data

Trees, forests, and boosting

survival_tree()
A log-rank survival tree
predict(<survival_tree>) predict(<survival_forest>) as.data.frame(<survival_tree>)
Predictions from survival trees and forests
random_survival_forest() extra_survival_trees()
Random survival forests and extra survival trees
competing_risk_forest()
Competing-risks random forests
predict(<competing_risk_forest>)
Predictions from a competing-risks forest
gradient_boosting_survival_analysis()
Gradient boosting for the Cox model
predict(<gradient_boosting_survival_analysis>)
Predictions from gradient boosting for the Cox model
survival_boost()
Gradient boosting for competing risks
predict(<survival_boost>)
Predictions from gradient boosting for competing risks
variable_importance()
Variable importance

Model performance

concordance_index() concordance_index_ipcw()
Concordance of risk scores with survival
concordance_index_ci() concordance_index_compare()
Concordance with a confidence interval, and comparing two risk scores
brier_score() integrated_brier_score()
Brier score of predicted survival probabilities
time_dependent_auc() integrated_auc()
Time-dependent AUC of a risk marker
calibration()
Calibration of predicted survival probabilities
censoring_distribution() predict(<censoring_distribution>) weights(<censoring_distribution>) as.data.frame(<censoring_distribution>)
The censoring distribution and its weights
score_cr()
Score predicted cumulative incidences of one cause
brier_score_incidence() integrated_brier_score_incidence() concordance_index_incidence() calibration_incidence() accuracy_in_time()
Prediction metrics for competing risks
cross_validate()
Cross-validate a survival model

Tidying results

Methods for the tidy(), glance(), and augment() generics.

Plots

plot_survival()
Plot Kaplan-Meier survival curves
plot_cif()
Plot cumulative incidence curves
get_risk_table_frame() risk_table()
Numbers at risk
plot_predicted_survival()
Plot predicted survival curves for new subjects
plot_forest()
Forest plot of model estimates
plot_influence()
Plot the influence diagnostics of a Cox model
plot_schoenfeld()
Plot the scaled Schoenfeld residuals of a Cox model
plot_smooth_hr()
Plot a smooth hazard ratio curve
plot_weibull()
Probability plot for a parametric survival distribution
theme_survival() theme_forest()
Themes for survival plots and forest plots

Datasets

colon
Chemotherapy for stage B/C colon cancer
e1684
ECOG melanoma trial E1684
lung
NCCTG lung cancer data
mgus2
Monoclonal gammopathy data
ovarian
Ovarian cancer survival
pbc
Mayo Clinic primary biliary cholangitis data
pbcseq
Mayo Clinic primary biliary cholangitis, sequential laboratory data
veteran
Veterans' Administration lung cancer trial