Answers are grounded in this paper and cite their sources.
Dynamic structural equation modeling (DSEM) has become a central tool for analyzing intensive longitudinal data, such as data from ecological momentary assessment and daily diary studies. In practice, DSEM is almost exclusively estimated in Mplus, a commercial, closed-source program, while packages built on the open-source probabilistic programming language Stan offer only a fixed selection of models. This tutorial shows applied researchers how to implement DSEM directly in Stan. Starting from a bivariate multilevel cross-lagged model with random effects, we build the model in three steps: a minimal working version, a non-centered reparameterization that resolves the convergence problems of the first version, and an extension that treats missing observations as parameters to be estimated. Along the way, we explain how to read Stan's convergence and sampler diagnostics, how to inspect the results visually, and how to report a Bayesian DSEM. On simulated data with known parameter values, the Stan implementation recovers the true values and closely reproduces the estimates of Mplus and of the R package mlts. We then demonstrate the flexibility of working in Stan with two extensions that require only local changes to the code: residual DSEM, and a binary within-person predictor, illustrated with data from a micro-randomized mindfulness intervention. All code is openly available and written to be adapted to new models. Working directly in Stan requires more initial effort than Mplus, but it makes every modeling decision transparent and extensible, and it lets researchers fit the model their research question calls for.
No takes yet. Share an insight, caveat, or question.
Snijder et al. (2026) studied this question.
Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context: