Estimating 1-2-1 multilevel mediation model

Would it be possible to estimate a 1-2-1 multilevel mediation model with Stan? A 1-2-1 multilevel mediation model is a model in which the exposure is measured at level 1 (e.g. individual study participant’s income), the mediator is measured at level 2 (e.g. neighborhood disorder), and the outcome is measured at level 1 (e.g. individual cardiovascular disease).

An approach to such models is given by Preacher, Zyphur and Zhang in A general multilevel SEM framework for assessing multilevel mediation. Psychological Methods. 2010;15(3):209-233. doi:[10.1037/a0020141]

Additionally, there is a survival-type outcome, there might be reason to expect spatial autocorrelation, and there is also reason to expect there is a variable that acts as an effect modifier for the association between exposure and mediator.

Hi, @Jeroen and welcome to the Stan forums.

Yes, you can code just about any model you can code in SEM in Stan. We don’t have the interpreter for the notation, which means you have to write a Stan program to code up the data, parameters, and log density. The user’s guide shows how to code all the pieces, like parametric or non-parametric survival models, spatial autocorrelation, etc. (if spatial autocorrelation isn’t in the user’s guide, it’ll be in @mitzimorris’s case study on the ICAR model). That paper seems to do a very explicit job of coding the models likelihoods so it shouldn’t be too much work to port over to Stan (once you learn Stan!).