Michael J. Crowther
In this article, I present the community-contributed stmixed command for fitting multilevel survival models. It serves as both an alternative to Stata’s official mestreg command and a complimentary command with substantial extensions. stmixed can fit multilevel survival models with any number of levels and random effects at each level, including flexible spline-based approaches (such as Royston–Parmar and the log-hazard equivalent) and user-defined hazard models. Simple or complex time-dependent effects can be included, as can expected mortality for a relative survival model. Left-truncation (delayed entry) is supported, and t-distributed random effects are provided as an alternative to Gaussian random effects. I illustrate the methods with a commonly used dataset of patients with kidney disease suffering recurrent infections and a simulated example illustrating a simple approach to simulating clustered survival data using survsim (Crowther and Lambert 2012, Stata Journal 12: 674–687; 2013, Statistics in Medicine 32: 4118–4134). stmixed is part of the merlin family (Crowther 2017, arXiv Working Paper No. arXiv:1710.02223; 2018, arXiv Working Paper No. arXiv:1806.01615).