Skip to contents

survextrap is an R package to model survival from a combination of

  1. A standard individual-level, right-censored survival dataset, e.g.
Survival time Death Predictors…
2 years Yes
5 years No
etc…
  1. “External” data sources in the following aggregate “count” form:
Follow-up period Number Predictors…
Start time t End time u Alive at t Still alive at u
t1 u1 n1 r1
t2 u2 n2 r2
etc…

Any number of rows can be supplied for the “external” data, and the time intervals do not have to be distinct or exhaustive.

Many forms of external data that might be useful for survival extrapolation (such as population data, registry data or elicited judgements) can be manipulated into this common “count” form.

Principles

  • Extrapolations from short-term individual level data should be done using explicit data or judgements about how risk will change over time.

  • Extrapolations should not rely on standard parametric forms (e.g. Weibull, log-normal, gamma…) that are only used out of convention and do not have interpretations as plausible mechanisms for how risk will change over time.

  • Instead of selecting (or averaging) traditional parametric models, an arbitrarily flexible parametric model should be used, that adapts to give the optimal fit to the short-term and long-term data in combination.

How it works

  • Bayesian multiparameter evidence synthesis is used to jointly model all sources of data and judgements.

  • An M-spline is used to represent how the hazard changes through time (as in rstanarm). The Bayesian fitting method automatically chooses the optimal level of smoothness and flexibility. Spline “knots” should span the period covered by the data, and any future period where there is a chance that the hazard may vary. Then if there is no data in the future period, the uncertainty will be acknowledged and the predicted hazards will have wide credible intervals.

  • A proportional hazards model or a flexible non-proportional hazards model can be used to describe the relation of survival to predictors.

  • Mixture cure, relative survival and treatment effect waning models are supported.

  • It has an R interface, designed to be friendly to those familiar with standard R modelling functions.

  • Stan is used under the surface to do MCMC (Hamiltonian Monte Carlo) sampling from the posterior distribution, in a similar fashion to rstanarm and survHE.

  • Estimates and posterior summaries and samples for outputs, such as survival, hazard and (restricted) mean survival, can easily be extracted.

Technical details of the methods

The model is fully described in a paper: Jackson, BMC Medical Research Methodology (2023). See also vignette("methods").

vignette("priors") goes into detail on how prior distributions and judgements can be specified in survextrap - an important but often-neglected part of Bayesian analysis.

Examples of how to use it

vignette("examples") gives a rapid tour of each feature, using simple textbook examples and simulated data.

The cetuximab case study is a more in-depth demonstration of how survextrap could be used in a typical health technology evaluation, based on clinical trial, disease registry, general population and elicited data. This vignette accompanies Section 4 of the preprint paper.

Development

The package is in “beta” status. All major features are included, and there are no substantial changes expected.

Further testing is planned before it is put on CRAN. In particular, work is ongoing to determine “default settings” (for things like priors and model flexibility) that work best in a wide range of examples based on simulation. Though the current defaults are expected to be reasonable for typical use, and there are examples in the vignettes of fine-tuning them for specific cases.

The current version can be installed as:

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

Please give feedback and suggestions if you do. These can be posted on github issues, or email.