green aurora lights over the mountain during night time

Flexible multi-state survival analysis at your fingertips

Latest stable release: v4.4.0

multistate provides a set of commands, described below, for multi-state survival analysis. This includes data preparation tools, obtaining predictions from general
continuous time multi-state survival models, both Markov and semi-Markov, and plotting utilities. Transition hazard models must be estimated using the stmerlin or merlin commands. The package includes:

  • msset is a data preparation tool which converts a dataset from wide (one observation per subject, multiple time and status variables) to long (one observation for each transition of which a subject is at risk).
  • msboxes creates a descriptive plot of the multi-state process through the transition matrix and numbers at risk.
  • msaj calculates the non-parametric Aalen-Johansen estimates of transition probabilities, and the length of stay in each state.
  • predictms calculates a variety of predictions from a Markov or semi-Markov multi-state survival model, including transition probabilities, length of stay (restricted mean time in each state), the probability of ever visiting each state and transition specific hazard and survival functions. Predictions are made at user-specified covariate patterns. Differences and ratios of predictions across covariate patterns can also be calculated. Standardised (study population-averaged) predictions can be obtained. Confidence intervals for all quantities are available. User-defined predictions can also be calculated by providing a user-written Mata function, to provide complete flexibility. predictms can be used with a general transition matrix (cyclic or acyclic), and allows the use of transition-specific timescales.
  • graphms creates stacked transition probability plots, following a predictms call.


The latest stable version of multistate is available on the Statistical Software Components archive, and can be installed directly in Stata by typing:

ssc install multistate

Blog posts
Probabilistic sensitivity analysis and survival models
Today we're going to take a little look into probabilistic sensitivity analysis …
Defining a transition matrix for multi-state modelling
In this post we'll take a look at how to define a …
multistate v4.4.0: semi-parametric multi-state modelling
multistate version 4.4.0 has been released! Ok, that may have happened a …


Weibull CE, Lambert PC, Eloranta S, Andersson TML, Dickman PW, Crowther MJ. A multi-state model incorporating estimation of excess hazards and multiple time scales. Statistics in Medicine 2021;40(9):2139-2154.

Hill M, Lambert PC, Crowther MJ. Relaxing the assumption of constant transition rates in a multi-state model in hospital epidemiology. BMC Medical Research Methodology 2021;21:16.

Crowther MJmerlin – a unified framework for data analysis and methods development in Stata. The Stata Journal 2020;20(4):763-784.

Crowther MJ, Lambert PC. Parametric multi-state survival models: flexible modelling allowing transition-specific distributions with application to estimating clinically useful measures of effect differences. Statistics in Medicine 2017;36(29):4719-4742.

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

Red Door Analytics AB is a registered company in Sweden

CEO: Michael Crowther
Org. number: 559351-8359