I am currently trying to test a moderated mediation model with nested data and repeated measures.

My independent, moderator, mediator, and dependent variables are on the individual level. I used repeated measures and collected the data for all variables from individual respondents on 6 different points in time. These individual respondents were nested in groups. I had too few respondents to examine time series per individual and therefore decided to make a cross-sectional data file. This file is structured as following (considering two hypothetical respondents residing in different groups):

Respondent# - Time - Group
1 - 1 - 1
1 - 2 - 1
1 - 3 - 1
1 - 4 - 1
1 - 5 - 1
1 - 6 - 1
2 - 1 - 2
2 - 2 - 2
2 - 3 - 2
2 - 4 - 2
2 - 5 - 2

I am wondering if it is statistically possible to conduct an individual-level moderated mediation that takes nesting in groups/time into account, using this data. I could not find any resources for this type of analysis (I did find a syntax for testing a multilevel moderated mediation with a level 2 moderator. However, my model includes a level 1 moderator).

Also, if you have experience with this sort of analysis, I would greatly appreciate if you could share the syntax (e.g., for Mplus) you used. Your help is very welcome!

  • 1
    $\begingroup$ If you're just asking for how to write code, your post would be off topic. $\endgroup$
    – Glen_b
    Commented Aug 8, 2016 at 8:44
  • $\begingroup$ Thanks, I reworded the question to get to its statistical core. $\endgroup$ Commented Aug 8, 2016 at 8:53
  • 1
    $\begingroup$ This question is far to broad and i.m.o. off topic $\endgroup$
    – Huub Hoofs
    Commented Aug 29, 2016 at 10:39

1 Answer 1


I'd echo the comments that asking for code examples is off-topic, and yet I'd agree this is an--albeit complicated--statistical question. I've been dealing with similar issues, mediation from panel data. Intuitively I understand that mediation has a longitudinal aspect to it in the sense that the mediator must be caused by the primary exposure and, in turn, cause the outcome. I'll assume also your interest lies in fitting a linear SEM type model.

Regardless of the details of the predictors and how they affect outcomes, you must account for repeated measures within participants. A flexible framework which is amenable to structural modeling is a growth model, or an HLM, where you directly model the longitudinal trends within participants by defining a random slope and a random intercept using a latent construct:

i = y1 + y2 + y3 + y4 + y5 + y6 s = 0*y1 + 1*y2 + 2*y3 + ... +5*y6

assuming 6 time points and your data reshaped to a "wide" format with y1-y6 being the time series with possible incomplete measurement.

The relation between the covariate and individual outcomes can then be formulated using an edge relating the latent i and s to the baseline measure of the covariate: as a note, I'm assuming when you say "individual level" you mean that the covariate and mediator are not time varying and were collected at baseline. The regression coefficients relating these would then be total effects which can be decomposed into the indirect (mediated) effect and direct effect.

As with other types of analyses your path model would be decomposed further in relating the covariate x to i and s with a direct edge and two edges passing through m call it a for the covariate-to-mediator effect, then bi and bs for the mediator-to-randomintercept/randomslope effect. Then the test of significance for a*bi and a*bs would infer whether the mediator led to changes in growth or mean differences.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.