gsem: A Stata command for parametric joint modelling of longitudinal and accelerated failure time models
Related Experiment Video
Updated: Dec 16, 2025

A Method of Trigonometric Modelling of Seasonal Variation Demonstrated with Multiple Sclerosis Relapse Data
Published on: December 9, 2015
1Faculty of Education, Department of Mathematics and Science Education, TED University, 06420 Ankara, Turkey; Faculty of Science, Department of Statistics, Hacettepe University, 06800 Ankara, Turkey.
Background:
The number of studies using joint modelling of longitudinal and survival data have increased in the past two decades, but analytical techniques and software shortcomings have remained. A joint model is often used for analysis of a combination of longitudinal sub-model and survival sub-model using shared random effects. Cox regression commonly referring to the survival sub-model, should not be used when proportional hazards assumptions are not satisfied. In such cases, the parametric survival model is preferable.
Methods:
We describe different parametric survival models for survival sub-model of joint modelling. We demonstrate how these models can be fit using gsem command (used for generalized structural equation model) in Stata that allows the model to be jointly continuous longitudinal and parametric survival data. With this code, linear mixed effect model is used for the longitudinal sub-model of the joint model, allowing random and fixed effects of the time. In gsem command for survival sub-models, there are five different choices: exponential, Weibull, log-normal, log-logistic and gamma accelerated failure time models.
Results:
In this paper, we have described properties of gsem command for parametric joint modelling and have shown an application for parametric joint models on the 312 patients with primary biliary cirrhosis, which is a major health problem in the western world.
Conclusions:
We showed how parametric joint models can be used with the gsem command which has been the only Stata code in the literature to fit the parametric joint models, for the generalized structural equation model, and we used the primary biliary cirrhosis dataset for the detailed application of the command. Thus, the gsem command becomes more useful for fitting parametric joint models.
Related Concept Videos
Parametric Survival Analysis: Weibull and Exponential Methods
Weibull Distribution
The Weibull distribution is a flexible model used in parametric survival analysis. It can handle both increasing and decreasing hazard rates, depending on its shape parameter...
Assumptions of Survival Analysis
Truncation in Survival Analysis
Left truncation occurs when individuals who experienced the event of interest before a certain time are not included in the study. This is often due to a "delayed entry" into the study where only those who survive until a certain entry point are...
Introduction To Survival Analysis
The primary goal of survival analysis is to estimate survival time—the time...
Comparing the Survival Analysis of Two or More Groups
Friedman Two-way Analysis of Variance by Ranks

