Package: survextrap 1.0.1

survextrap: Bayesian Flexible Parametric Survival Modelling and Extrapolation

Survival analysis using a flexible Bayesian model for individual-level right-censored data, optionally combined with aggregate data on counts of survivors in different periods of time. An M-spline is used to describe the hazard function, with a prior on the coefficients that controls over-fitting. Proportional hazards or flexible non-proportional hazards models can be used to relate survival to predictors. Additive hazards (relative survival) models, waning treatment effects, and mixture cure models are also supported. Priors can be customised and calibrated to substantive beliefs. Posterior distributions are estimated using 'Stan', and outputs are arranged in a tidy format. See Jackson (2023) <doi:10.1186/s12874-023-02094-1>.

Authors:Christopher Jackson [aut, cre, cph], Iain Timmins [ctb], Michael Sweeting [ctb]

survextrap_1.0.1.tar.gz
survextrap_1.0.1.zip(r-4.7)survextrap_1.0.1.zip(r-4.6)survextrap_1.0.1.zip(r-4.5)
survextrap_1.0.1.tgz(r-4.6-x86_64)survextrap_1.0.1.tgz(r-4.6-arm64)survextrap_1.0.1.tgz(r-4.5-x86_64)survextrap_1.0.1.tgz(r-4.5-arm64)
survextrap_1.0.1.tar.gz(r-4.7-arm64)survextrap_1.0.1.tar.gz(r-4.7-x86_64)survextrap_1.0.1.tar.gz(r-4.6-arm64)survextrap_1.0.1.tar.gz(r-4.6-x86_64)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
survextrap/json (API)

# Install 'survextrap' in R:
install.packages('survextrap', repos = c('https://chjackson.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/chjackson/survextrap/issues

Pkgdown/docs site:https://chjackson.github.io

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:
  • cetux - Datasets for evaluation of cetuximab in head and neck cancer
  • cetux_bh - Datasets for evaluation of cetuximab in head and neck cancer
  • cetux_seer - Datasets for evaluation of cetuximab in head and neck cancer
  • colons - Colon cancer survival data
  • curedata - Simulated data for testing mixture cure models

On CRAN:

Conda:

cpp

6.92 score 12 stars 58 scripts 596 downloads 54 exports 52 dependencies

Last updated from:17cbe470c1. Checks:12 OK, 1 FAIL. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK368
linux-devel-x86_64OK318
source / vignettesOK530
linux-release-arm64OK389
linux-release-x86_64OK374
macos-release-arm64OK308
macos-release-x86_64OK548
macos-oldrel-arm64OK298
macos-oldrel-x86_64OK730
windows-develOK398
windows-releaseOK305
windows-oldrelOK433
wasm-releaseFAIL190

Exports:cumhazdsurvmsplinedsurvmspline_waneget_drawshazardhazard_ratiohrtimehsurvmsplineHsurvmsplinehsurvmspline_waneHsurvmspline_waneirmstmean_survmsplinemean_survmspline_wanemspline_basismspline_constant_coefsmspline_initmspline_list_initmspline_plotdatamspline_plotsetupmspline_specmsplinemodel_initp_betap_gammap_hrp_meansurvp_normalp_tplot_hazardplot_hazard_ratioplot_msplineplot_prior_hazardplot_survivalprint_priorsprior_haz_constprior_haz_sdprior_hrprior_hr_sdprior_predprior_sampleprior_sample_hazardpsurvmsplinepsurvmspline_waneqsurvmsplineqsurvmspline_wanermstrmst_survmsplinermst_survmspline_wanersurvmsplinersurvmspline_wanestandardise_tostandardize_tosurvextrapsurvival

Dependencies:abindbackportsBHcallrcheckmateclicpp11descdistributionalfarvergenericsggplot2gluegridExtragtableinlineisobandlabelinglatticelifecycleloomagrittrMatrixmatrixStatsnumDerivotelpillarpkgbuildpkgconfigposteriorprocessxpsQuickJSRR6RColorBrewerRcppRcppArmadilloRcppEigenRcppParallelrlangrstanS7scalessplines2StanHeaderssurvivaltensorAtibbleutf8vctrsviridisLitewithr

Examples of using survextrap
Examples | Simplest model: no external data | Note on model tuning | Note on computation settings | Divergent transitions | Restricted mean survival | Custom posterior summaries | Extrapolation using long term population data | Modelling differences between the trial and external data | Expert elicitation on the long term | Covariates | Covariate-specific outputs | Standardised outputs | Notes on computation of standardised outputs | Time-dependent standardised outputs | Non-proportional hazards model | Treatment effect waning models | Model comparison | Cure models | Additive hazards / relative survival models | Background hazard defined at all times | Stratified background hazards | Background hazard only defined at the event times | Comparison with other ways of supplying external data in survextrap

Last update: 2026-02-18
Started: 2022-06-30

Details of methods behind survextrap
M-splines | Traditional M-spline basis | Smoothed M-spline basis | Using M-splines to represent particular hazard shapes | Why not other kinds of spline? | Bayesian model specification | Prior distribution for the hazard curve | Choice of knots when modelling data | Effect of covariates on the hazard | Proportional hazards model | Flexible, non-proportional hazards model | Cure models | Relative survival / additive hazards models | Combining relative survival and cure models | Treatment effect waning models | Principles | Waning model: details | Waning models: example | Waning models: distribution utilities

Last update: 2026-01-12
Started: 2022-06-30

Priors in survextrap models
Converting prior judgements about survival to external data | Further notes on elicitation | Priors on spline parameters | Plotting plausible hazard trajectories | Constant hazard level | Hazard as a function of time | Ratio between high and low hazards over time | Hazard ratios for effects of covariates | SD of hazard ratios over time in non-proportional hazards models

Last update: 2026-01-11
Started: 2023-03-30

Readme and manuals

Help Manual

Help pageTopics
The 'survextrap' package.survextrap-package
Datasets for evaluation of cetuximab in head and neck cancercetux cetux_bh cetux_seer
Colon cancer survival datacolons
Estimates of cumulative hazard from a survextrap modelcumhaz
Simulated data for testing mixture cure modelscuredata
Posterior draws from a survextrap modelget_draws
Estimates of hazard from a 'survextrap' modelhazard
Hazard ratio against time in a survextrap modelhazard_ratio
Hazard ratio between high and low values of the hazard over timehrtime
Incremental restricted mean survival timeirmst
Mean survival timemean.survextrap
Evaluate an M-spline basis matrix at the specified times.mspline_basis
Determine M-spline basis coefficients which give a constant function.mspline_constant_coefs
Create a default M-spline model structuremspline_init
Validate an M-spline object supplied as a list, choosing defaults if needed.mspline_list_init
Data for plotting an M-spline function, showing how it is built up from its basismspline_plotdata
Get basis for an illustration of an M-spline with given knots.mspline_plotsetup
Make default M-spline knot specification given a survival dataset.mspline_spec
Create an M-spline survival model, both structure and parameters.msplinemodel_init
Derive a normal prior for the log hazard ratio parameter based on a guess at the hazard ratiop_hr
Derive a normal prior for the log hazard scale parameter based on a guess at survival timesp_meansurv
Plot hazard curves from a survextrap modelplot_hazard
Plot hazard ratio against time from a survextrap modelplot_hazard_ratio
Plot a M-spline function, showing how it is built up from its basisplot_mspline
Plot survival curves from a survextrap modelplot_survival
Plot method for survextrap model objectsplot.survextrap
Print the priors used in a fitted survextrap modelprint_priors
Print a fitted survextrap modelprint.survextrap
Determine priors for time-varying hazards and hazard ratiosprior_haz prior_haz_sd prior_hr_sd
Summarises the prior for the constant hazard implied by a particular prior on the hazard scale parameter and spline specification.prior_haz_const
Summarises the prior for the hazard ratio implied by a particular prior on the log hazard ratioprior_hr
Simulate a dataset from the prior predictive distribution of survival times in an M-spline survival model.prior_pred
Sample from the joint prior of parameters in a survextrap modelprior_sample
Generate and/or plot a sample from the prior distribution of M-spline hazard curvesplot_prior_hazard prior_sample_hazard
Prior distributions and optionspriors p_beta p_gamma p_normal p_t
Restricted mean survival timermst
Constructor for a standardising population used for survextrap outputsstandardise_to standardize_to
Posterior summary statistics for parameters of survextrap modelssummary.survextrap
Flexible Bayesian parametric survival modelssurvextrap
Estimates of survival from a 'survextrap' modelsurvival
M-spline survival distributiondsurvmspline Hsurvmspline hsurvmspline mean_survmspline psurvmspline qsurvmspline rmst_survmspline rsurvmspline Survmspline
M-spline survival distribution under treatment effect waningdsurvmspline_wane Hsurvmspline_wane hsurvmspline_wane mean_survmspline_wane psurvmspline_wane qsurvmspline_wane rmst_survmspline_wane rsurvmspline_wane Survmspline_wane