Dear Statalisters,
I am trying to determine whether my analytical and coding approach to this model is correct. I have multilevel data with observations nested within individuals at L1 and between-person characteristics at L2.
We have hypothesized a mediated model in which the mediation path (x-->med-->y) occurs all at L1 but the X-->med path is moderated by a variable at level 2 ("mod"). We have run the individual pieces using the mixed command, but we are trying to calculate whether the indirect effect of x on y is moderated by mod. In order to do this, and obtain bias-corrected confidence intervals for the indirect effects at +/-1 sd of mod, I believe we have to use GSEM. My understanding is also that we need random slopes and intercepts in this model. All variables are continuous. Here is a simplified version of my code (which actually includes another mediator path and several control variables).
Does this correctly get us random intercepts and slopes and account for the cross-level interaction? In the past, to calculate the conditional indirect effects I used nlcom (for a non-multilevel model). Can I do the same with GSEM? Any suggestions or advice would be appreciated as I am struggling a bit to use GSEM properly.
-Matt
I am trying to determine whether my analytical and coding approach to this model is correct. I have multilevel data with observations nested within individuals at L1 and between-person characteristics at L2.
We have hypothesized a mediated model in which the mediation path (x-->med-->y) occurs all at L1 but the X-->med path is moderated by a variable at level 2 ("mod"). We have run the individual pieces using the mixed command, but we are trying to calculate whether the indirect effect of x on y is moderated by mod. In order to do this, and obtain bias-corrected confidence intervals for the indirect effects at +/-1 sd of mod, I believe we have to use GSEM. My understanding is also that we need random slopes and intercepts in this model. All variables are continuous. Here is a simplified version of my code (which actually includes another mediator path and several control variables).
Code:
gsem (y <- x med x#M2[id] M1[id]) (med <- x#M2[id] M1[id]) (M1[id] <- mod) (M2[id]<-mod), latent(M1 M2)
-Matt