After many years of working on the
stmt package in Stata, our paper Flexible parametric survival analysis with multiple timescales: Estimation and implementation using stmt was recently published in the Stata Journal (1).
stmt can be installed by typing in Stata:
ssc install stmt
The aim of this paper was to describe and illustrate how to model multiple timescales using flexible parametric survival models, and introduce the
stmt Stata package (which has been around on SSC for quite some time already!). Typically time-to-event analyses focus on modelling one timescale of interest, but there may be situations where modelling multiple timescales is of interest. In fact it may be necessary to account for several timescales to answer specific research questions, or to estimate effects without bias under certain circumstances (2). One typical approach for modelling multiple timescales is to select one primary timescale, and split follow-up time on the second timescale. This variable for the second timescale can then be includes as a covariate in the time-to-event model (for example, as a categorical variable or smoothed spline in a Poisson model). When using large datasets, this approach can be computationally intensive!
Instead, we suggest the approach of modelling multiple timescales simultaneously and smoothly, via a flexible parametric survival model framework on the log hazard scale. Restricted cubic splines are used to model both the first and second timescale, where the second timescale is written as a function of the first timescale, since time increases in the same way independent of timescale. For example, if we were interested in modelling time since surgery until death, we could consider timescales 1) time since surgery and 2) attained age. We could then write the attained age as a function of time since surgery (= time since surgery + age at surgery).
stmt uses restricted cubic splines in the flexible parametric framework to model two timescales simultaneously; note that the command extends to three timescales, although the theoretical approach extends for multiple timescales.
The Stata Journal paper describes the methodology behind this approach, and illustrates how to fit these models using
stmt, and predict useful results using the
stmt post-estimation command.
Feedback and bug reports are very welcome – we hope you find it useful!
(1) Bower, H., Andersson, T. M.-L., Crowther M. J. et al. Flexible parametric survival analysis with multiple timescales: Estimation and implementation using stmt. The Stata Journal 2022, 22(3), 679–701.
(2) Batyrbekova, N., Bower, H., Dickman P.W. et al. Potential bias introduced by not including multiple time-scales in survival analysis: a simulation study. Communications in Statistics – Simulation and Computation 2022.
See also: Batyrbekova, N., Bower, H., Dickman, P.W. et al. Modelling multiple time-scales with flexible parametric survival models. BMC Med Res Methodol 2022, 22, 290.