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!

Videos

Introduction to Epidemiological Study Designs

This video offers a comprehensive introduction to epidemiological study designs, emphasising their classification, key definitions, strengths, limitations, and practical applications. We will dive into the most commonly used study designs, exploring their structure, purpose, and the contexts in which they are most effective. Throughout the video, real-world case studies of landmark research will be used […]
Read more

Specialist subjects

Real-world evidence (RWE)

Real-world evidence (RWE) Data and information that, unlike data generated in clinical trials conducted in controlled environments, has been obtained from everyday clinical practice, patient registers, or other sources outside the clinical trial setting.   RWE plays a crucial role in complementing traditional clinical trial data, providing insights into the safety, effectiveness, and overall performance […]
Read more

Videos

State-of-the-art statistical models for modern HTA

At @RedDoorAnalytics, we develop methodology and software for efficient modelling of biomarkers, measured repeatedly over time, jointly with survival outcomes, which are being increasingly used in cancer settings. We have also developed methods and software for general non-Markov multi-state survival analysis, allowing for the development of more plausible natural history models, where patient history can […]
Read more

Videos

Multilevel (hierarchical) survival models: Estimation, prediction, interpretation

Hierarchical time-to-event data is common across various research domains. In the medical field, for instance, patients are often nested within hospitals and regions, while in education, students are nested within schools. In these settings, the outcome is typically measured at the individual level, with covariates recorded at any level of the hierarchy. This hierarchical structure […]
Read more

Statistical Primers

What are competing risks?

Competing risks In survival analysis, competing risks refer to the situation when an individual is at risk of experiencing an event that precludes the event under study to occur. Competing risks commonly occur in studies of cause-specific mortality, as all other causes of death than the one under study might happen before the individuals “have […]
Read more

Statistical Primers

What is immortal time bias?

Immortal time bias Immortal time bias is a type of bias that can occur in observational research when the study design allows for a period of time during which the outcome of interest cannot occur, often referred to as “immortal time”. Simply put, immortal time bias occurs when information from a future event is incorporated into the […]
Read more

Statistical Primers

What is the proportional hazards assumption?

Proportional hazards Proportional hazards in survival analysis means that the rate at which an event of interest occurs over time for two or more groups or individuals is proportional over time. Specifically, it assumes that the hazard ratio, which represents the relative rate of an event occurring between two groups or individuals, is constant over […]
Read more

Statistical Primers

What is censoring?

Censoring refers to a situation in survival analysis where the event of interest is not observed for some of the individuals under study. In this Statistical Primer, we’ll define three types of censoring often seen in survival analysis studies. Censoring occurs when the information on the survival time is incomplete or only partially observed. Censoring […]
Read more

Statistical Primers

What is the Cox model?

The Cox model The Cox model, also known as the proportional hazards model, is a popular statistical tool used to analyse survival data. It was developed by British statistician Sir David Cox, and published in 1972. It has gained popularity largely by avoiding making parametric assumptions about the shape of the baseline rate in a […]
Read more

Statistical Primers

What is survival analysis?

Survival analysis is a statistical method used to analyse the time until an event of interest occurs. The key feature of survival analysis is that the outcome has two dimensions: – an event indicator (yes/no), and – the time spent at risk for the event All survival analyses require precise definitions of start and end of […]
Read more

Tutorials

Multivariate joint longitudinal-survival models

Joint longitudinal-survival models have been widely developed, but there are many avenues of research where they are lacking in terms of methodological development, and importantly, accessible implementations. We think merlin fills a few gaps. In this post, we’ll take a look at the extension to modelling multiple continuous longitudinal outcomes, jointly with survival. For simplicity, I’ll concentrate […]
Read more

Tutorials

Simulation and estimation of three-level survival models: IPD meta-analysis of recurrent event data

In this example I’ll look at the analysis of clustered survival data with three levels. This kind of data arises in the meta-analysis of recurrent event times, where we have observations (events or censored), k (level 1), nested within patients, j (level 2), nested within trials, i (level 3). Random intercepts The first example will […]
Read more