Message/Author 

mw posted on Tuesday, September 11, 2012  1:26 am



I'm all new to this and not particularly good! But I need to test a path model. I've got to grips with testing mediation, but now need to put a moderator in the model. I've trawled through some guides but still confused, I really just need some code to do it in Mplus. I'm better with visuals rather than trying to explain it, so have provided my model here... http://tinyurl.com/bnr3fzo 


One good approach is to let your moderator variable E be a grouping variable in a multiplegroup mediation model. The User's Guide has several examples of multiplegroup models. 

mw posted on Tuesday, September 11, 2012  10:47 am



Thank you for your reply. I really do want to keep the moderator as a continuous variable though and not split it. Is there a way of running the model without multiple groups? 


Then you have to think about how your moderator of the M >Y relationship might interact with M (and X, Y). You have an interaction between your moderator and your mediator. Interactions involving DVs (the mediator in your case) may pose special analysis issues  for instance, the chisquare test of model fit is off because the variance of Y conditional on X and your moderator is not constant. 

mw posted on Tuesday, September 11, 2012  12:10 pm



I've had a look at the preacher and hayes mplus code for a similar kind of analysis (I think it is anyway!)assuming w is the moderator and m is the mediator y on m x w mw; m on x; w with m; mw with m; Would that be suitable, if I just added a few more 'x' variables to recreate my model? I suppose you are saying I need to work out if the moderator affects the A B and C variables in my model (pictured above) as well. To that I'm not really sure! It should correlate, but can I just specify that it will or will I end up in a huge over/nonidentified mess? 


This code should work. It is a model in which the 'b' path is moderated by z, and it contains 3 x variables. TITLE: moderated mediation with 3 x's; DATA: FILE IS mplus.help3.dat; VARIABLE: NAMES ARE x1x3 m z y; USEVARIABLES ARE all mz; DEFINE: mz=m*z; MODEL: y ON m x1x3 z mz; m ON x1x3; m WITH z mz; x1x3; You would need to include a MODEL CONSTRAINT section that computes the conditional indirect effects that are of interest, but this is the basic model syntax. 

mw posted on Wednesday, September 12, 2012  6:26 am



Thank you! I'll run it and see! 

mw posted on Sunday, September 16, 2012  12:54 pm



I've decided to change my mediator to a latent variable. Will the above code be the same? or do I have to create/define the interaction differently with a latent variable. I've read something about XWITH (?) but not sure how I'd include that in Prof. Preacher's code above. 


Use XWITH to create the latent variable interaction and include it on the righthand side of ON as shown above. 

marlies posted on Wednesday, April 17, 2013  10:10 am



Dear drs. Muthen, I have a question about a model with one moderation and a mediation, which is also moderated. This is my full model, with dependent variable y, predictor x, mediator m and second level moderator z. MODEL:%WITHIN% s1  y ON x ; s2  m ON x; y ON m; %BETWEEN% y m s1 s2 ON z; y m s1 s2 WITH y m s1 s2 ; In this model, the crosslevel interaction between x and z on y is not signficant and neither is the crosslevel interaction effect of x and z on m. However, if I take out the interaction of x and z on m, so I run this model: s1  y ON x ; y ON m; m ON x; %BETWEEN% y s1 ON z; y WITH s1; then suddenly the interaction of x and z on y is significant (the p value changes from a nonsignificant 0.28 to a significant 0.047). However, it cannot have turned significant due to the mediation of m, since there was no interaction effect of x and z on m. Could it be that testing my full path model (so with both interaction effects)is statistically not okay? Thank you in advance for your answer! Kind regards, marlies 


I think your full model is correctly done. When you change m ON x from random to fixed, that may well influence the random y ON x regression. You may also want to try this out using Bayesian estimation to see how close to normal the posterior distributions are for the s ON z parameters; the Bayes results may be more trustworthy if they are not close to normal, as assumed with ML. 

marlies posted on Wednesday, April 17, 2013  11:47 pm



Thank you for your quick answer! Kind regards, Marlies 


Firstly, thank you again for the quick response! I am not a statistician so I am probably not expressing my thoughts well. Here is the model: http://i.imgur.com/meWWw2f.png My aim and questions are whether it is possible to add a lower level moderation in a 211 model on the 11 path in Mplus and whether there are some examples of such models or models with lower level moderation only (I could not find this)? Below, I followed the syntax from Preacher et al. (2010, 2011) for the 211 model. I tried to add the lower level moderator and construct the indirect effects as in Model 3 (Preacher et al., 2007). The model below gave no errors in Mplus. I'm sharing it for learning purposes. I find this forum incredibly helpful in that respect! Thank you! USEVARIABLES = Id sqy gmx gmm gmw mw; Missing are all (99); BETWEEN IS gmx; CLUSTER IS Id; DEFINE: mw = gmm*gmw; ANALYSIS: TYPE IS TWOLEVEL RANDOM; MODEL: %WITHIN% sb  sqy ON gmm; mb  sqy ON mw; sqy ON gmw; %BETWEEN% gmm ON gmx(a); sqy ON gmm(b); sqy ON mw (b2); sqy ON gmx (c); sqy ON gmw; [sb](bw); [mb] (mbw); MODEL CONSTRAINT: NEW (bb indb bb2 indb2); bb=b+bw; indb=a*b; bb2=b2+mbw; indb2=a* (b+bb2); 


I apologize for the above message! It was posted in the wrong forum. My sincere apologies. Laura 


Ok; answered elsewhere. 

sharon posted on Monday, October 09, 2017  8:31 am



Hi everyone, i could really use some help for a moderation that i would like to try on Mplus, but i dont know how to code it. Does anyone have a syntax ? its a simple moderation analyse with x, m, and y. Thanks again for your help! 


See the Mplus runs starting at Table 2.25 for our Regression and Mediation book which are posted at http://www.statmodel.com/Mplus_Book_Tables.shtml 

Back to top 