GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - mjcrowther/survsim: Simulating time-to-event data from parametric distributions, custom distributions, competing risk models and general multi-state models in Stata

This repository was archived by the owner on Oct 9, 2026. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

32 Commits
32 Commits

Folders and files

NameName
Last commit message
Last commit date
archive
archive
 
 
build
build
 
 
cert
cert
 
 
ssc
ssc
 
 
survsim
survsim
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
stata.toc
stata.toc
 
 
survsim.pkg
survsim.pkg
 
 

Repository files navigation

survsim

survsim is no longer developed. Its successor is avalon, from Red Door Analytics, for simulating survival data in R and Stata. avalon is a complete rewrite with a new syntax, not a new version of survsim. This repository is an archive: version 4.0.11 is the final version, and can still be installed as described below.

Simulating time-to-event data in Stata, from parametric distributions, custom distributions, competing risks models and general multi-state models.

For an introductory seminar, see Simulating time-to-event data from parametric distributions, custom distributions, competing risk models and general multi-state models.

What it simulates

survsim simulates survival times from:

  • A parametric distribution (help survsim parametric): exponential, Gompertz and Weibull, and 2-component mixtures of them, with covariate effects and non-proportional hazards.
  • A user-defined distribution (help survsim user): any hazard or cumulative hazard function, on the natural or the log scale, written in Mata; survival times are generated by numerical integration and root finding.
  • A fitted merlin model (help survsim model).
  • A competing risks or general multi-state model (help survsim msm): each transition has its own hazard function, a standard distribution or a user-defined one, with its own covariates and time-dependent effects.

Requirements

  • Stata 14.2 or later
  • moremata, for user-defined distributions and multi-state models: ssc install moremata
  • merlin and multistate, to simulate from a fitted merlin model: ssc install merlin and ssc install multistate

Installation

survsim can be installed from the SSC archive by typing:

ssc install survsim

To install directly from this GitHub repository, use:

net install survsim, from("https://raw.githubusercontent.com/mjcrowther/survsim/main/")

Example

Survival times from a Weibull distribution, with a binary treatment that has a log hazard ratio of -0.5, and censoring at 5 years:

clear
set obs 1000
gen trt = rbinomial(1,0.5)
survsim stime died, distribution(weibull) lambdas(0.1) gammas(1.5) covariates(trt -0.5) maxtime(5)
stset stime, failure(died = 1)
streg trt, distribution(weibull) nohr

Further examples, including competing risks and multi-state models, are in the help files: help survsim.

Version

Version 4.0.11 (9 October 2026).

References

Bender R, Augustin T and Blettner M. Generating survival times to simulate Cox proportional hazards models. Statistics in Medicine 2005;24:1713-1723.

Beyersmann J, Latouche A, Buchholz A and Schumacher M. Simulating competing risks data in survival analysis. Statistics in Medicine 2009;28:956-971.

Crowther MJ and Lambert PC. Simulating complex survival data. The Stata Journal 2012;12(4):674-687.

Crowther MJ and Lambert PC. Simulating biologically plausible complex survival data. Statistics in Medicine 2013;32(23):4118-4134.

Crowther MJ. Simulating time-to-event data from parametric distributions, custom distributions, competing-risks models, and general multistate models. The Stata Journal 2022;22(1):3-24.

Jann, B. 2005. moremata: Stata module (Mata) to provide various functions. Available from http://ideas.repec.org/c/boc/bocode/s455001.html.

Licence

Copyright (C) 2011-2026 Michael J. Crowther.

Released under the GNU General Public License, version 3. See LICENSE.

The root-finding routine survsim_mm_root() in survsim_msm.ado is based on mm_root() from moremata by Ben Jann, which is distributed under the MIT License (Copyright (c) 2019 benjann). Its copyright and permission notice is reproduced in that file.

About

Simulating time-to-event data from parametric distributions, custom distributions, competing risk models and general multi-state models in Stata

doi.org/10.1177/1536867X221083853

Topics

competing-riskshealth-economicsmicrosimulationmultistatesimulationstatasurvival-analysis

Resources

Readme
GPL-3.0 license
Activity

Stars

1 star

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.