Red Door Analytics

RDA survsim

Flexible simulation of survival data — standard, flexible parametric, and user-defined hazards, with competing risks and multi-state structures. In Stata; the mature predecessor of avalon.

Stata packageThe methods-evaluation workhorseSucceeded by avalon · still maintained
Stata package · the predecessor of avalon

What survsim does

survsim simulates survival data from a wide range of hazard specifications — standard parametric distributions, flexible parametric (spline) models, fitted models, and fully user-defined hazard or log-hazard functions.

It supports time-dependent effects, competing risks, multi-state structures, and left truncation — the workhorse behind the team's methods-evaluation simulation studies, and behind much of the published survival-methods literature.

survsim is now being carried into both ecosystems as avalon (R + Stata), which succeeds it under one cross-ecosystem name. survsim remains available on SSC and fully supported.

Capabilities

Simulate almost any survival process

DISTRIBUTIONS

Standard & flexible parametric

Exponential, Weibull, Gompertz, and Royston-Parmar / log-hazard spline baselines — or simulate from a fitted model.

USER-DEFINED

Custom hazards

Simulate from any user-supplied hazard or log-hazard function — no closed form required.

STRUCTURES

Competing risks & multi-state

Competing-risks and multi-state data, with time-dependent effects and left truncation.

METHODS

Study design & evaluation

The standard tool for designing studies and evaluating new survival methods under known truth.

Installation

Get started

Install from the package repository or from the SSC archive. For new cross-ecosystem work, see its successor avalon (R + Stata, in development).

* the current build, from the package repository
net install survsim, from(https://raw.githubusercontent.com/RedDoorAnalytics/survsim/main/)

* or from the SSC archive
ssc install survsim

The repository carries the newer build. The SSC copy is updated less often than the repository, so where the two differ the repository is ahead. net install and ssc install put the same package on your adopath; if you have installed from one and want the other, ado uninstall survsim first.

The merlin family

The predecessor of avalon

survsim generates the data the rest of the family is tested against. In R, survival-data simulation has long been served by simsurv (Brilleman et al.). Both are now being unified, under one name in R and Stata, as avalon.

Worked examples and tutorials for the family are in our Resources.

Try it in your browser: the survival DGM explorer — pick a data-generating mechanism and watch the hazard and survival update live before you simulate.

Cite

Citing survsim

Cite the 2022 survsim paper for the current package; the 2013 paper introduced the original simulation approach.

@article{crowther2022,
  author  = {Crowther, M. J.},
  title   = {{Simulating time-to-event data from parametric distributions, custom distributions, competing-risks models, and general multistate models}},
  journal = {The Stata Journal: Promoting communications on statistics and Stata},
  year    = {2022},
  volume  = {22},
  number  = {1},
  pages   = {3--24},
  doi     = {10.1177/1536867x221083853}
}

RIS and the full library are on the publications page.

The original 2013 methods paper:

@article{crowther2013b,
  author  = {Crowther, M. J. and Lambert, P. C.},
  title   = {{Simulating biologically plausible complex survival data}},
  journal = {Statistics in Medicine},
  year    = {2013},
  volume  = {32},
  number  = {23},
  pages   = {4118--4134},
  doi     = {10.1002/sim.5823}
}

RIS and the full library are on the publications page.

Designing a simulation study?

We use survsim daily for methods evaluation and study design. If you'd like help scoping a simulation study, get in touch.

Get in touch Start a project