Message/Author 

Sven Lohrey posted on Friday, December 05, 2014  4:21 am



Dear Dr. Muthen, I want to test a 211 model with a level2 variable w moderating path a, and a level1 variable z moderating path b. Could you have a look at my syntax and let me know if this looks okay? Thank you! VARIABLE: NAMES = UNITID x w m z y; USEVARIABLES = UNITID x w m z y; BETWEEN = x w; CLUSTER = UNITID; MISSING = ALL (1); DEFINE: xw = x*w; mz = m*z; ANALYSIS: TYPE = TWOLEVEL RANDOM; MODEL: %WITHIN% m z y; y ON m(b1) mz(b2) z; %BETWEEN% x w m z y; m ON x(a1) xw(a2) w; y ON m mz z x xw w; MODEL CONSTRAINT: NEW(ind1 ind2 ind3 wmodval zmodval); wmodval=3.89; !+1SD zmodval=2.83; !+1SD ind1=(a1+a2*wmodval)*(b1+b2*zmodval); ind2=(a1+a2*wmodval)*b1; ind3=a1*(b1+b2*zmodval); OUTPUT: TECH1 TECH8 CINTERVAL; 


That's a complex model. A key issue is the moderation of the b path which needs special care already in the singlelevel case. See the Preacher, Rucker, Hayes (1997) MBR article, Figure 2, Model 3, where you add WITH statement between M and W, MW to avoid poor fit. So that needs to be added to your input on Within and something similar to the Between level as well. I asked Kris Preacher if he had written specifically about the multilevel version of this, and he said no, but offered this modified input (TYPE = TWOLEVEL suffices): MODEL: %WITHIN% m z y mz; y ON m(b1) mz(b2) z; m WITH z mz; z WITH mz; %BETWEEN% x w m z y xw mz; m ON x(a1) xw(a2) w; y ON m mz z x xw w; x WITH w xw z mz; w WITH xw z mz; xw WITH z mz; z WITH mz; m WITH z mz; 

Sven Lohrey posted on Wednesday, December 10, 2014  2:37 am



Dear Dr. Muthen, thank you (and Dr. Preacher) very much! This is very helpful! 

Sven Lohrey posted on Monday, February 16, 2015  7:50 am



Dear Dr Muthen, I have some question regarding the WITH statements in the BETWEEN part of the above syntax: 1) Why is "m" only included in the last line with z and mz, but not in any of the previous WITH statements? 2) If I were to expand the model to test effects on an additional grouplevel outcome (i.e. 222 in addition to the 211 model discussed above) and want to add a grouplevel moderator "v" to the path from grouplevel mediator "m2" to grouplevel outcome, how would I have to change the WITH statement? My thoughts are: x WITH w xw z mz m2 v m2v; w WITH xw z mz m2 v m2v; xw WITH z mz m2 v m2v; z WITH mz m2 v m2v; mz WITH m2 v m2v; m2 WITH v m2v; v WITH m2v; m WITH z mz; Is this correct? 


1) m is already permitted to covary with x, xw, w, and y via regressions in the %BETWEEN% section. Including more WITH statements would introduce redundant parameters. 2) This looks correct to me. 


Dear Dr. Muthen, I am trying to run a 211 (x,m,y) moderated mediation model. This model includes a crosslevel interaction (m and w) on path b. However, I am having difficulty declaring the whole model since I have to declare the m variable as a WITHIN variable for the crosslevel interaction and group centering, which will then not allow me to use it for the BETWEEN part of the mediation analysis. Is a 211 moderatedmediation model including a crosslevel interaction possible in MPLUS? Or would you suggest a 2step process for this? I wanted to ask you this first initial question before posting my code. I appreciate your time. 


I assume you have s y ON m; You can do what other programs do, namely create a Betweenlevel variable that is the cluster mean of m. 


Thank you for your response! I have written the model and it runs, but I wanted to see if I was not too far off. It is a 211 model with a a level 2 variable w moderating both paths a and b (b as the crosslevel int). I created mm as a betweenlevel variable with the cluster mean of m as suggested. Any help would be appreciated. USEVARIABLES ARE x m w y mm xw; CLUSTER = SupID; WITHIN = m; BETWEEN = x w mm xw; MISSING ARE .; DEFINE: CENTER x (GROUPMEAN); xw = x*w; ANALYSIS: TYPE = TWOLEVEL RANDOM; MODEL: %WITHIN% bijy ON x; ! [T1LMX@0]; I was going to add this since m was groupmean centered and its mean should be fix to zero to avoid any possible unconflated results but it but gave me error. Not sure if this is even an issue %BETWEEN% mm ON x(a1) w xw(a3) ; y ON mm(b1) w x ; bij ON w(b3); y WITH bij; MODEL CONSTRAINT: NEW(ind1 ind2 ind3 wmodval); wmodval= 3.89; !+1SD ind1=(a1+a3*wmodval)*(b1+b3*wmodval); ind2=(a1+a3*wmodval)*b1; ind3=a1*(b1+b3*wmodval); OUTPUT: TECH1 TECH8 CINTERVAL; 


You declare x as a Between variable but you use it on Within: %WITHIN% bijy ON x; 


Yes, I am sorry, that was a typo on my part. Was that the only aspect that seemed strange? 


I would have to see the script for a run where this mistake has been cleared up. 


Thank you again Dr. Muthen. Because of the length and size, I cannot seem to paste a whole run in this forum. If there is another way for me to send it let me know. If not, I understand and still thank you for your time. 


You can send it to support@statmodel.com along with your license number. 


Hi, Regarding multilevel modeling in Mplus, I am trying to understand why we are finding a discrepancy in the coefficients when introducing variables at the between level. We have two variables one at the between level (level 2) and one at the within level (level 1), and when we run a simple regression with the two variables, whether in SPSS or Mplus, we get a significant coefficient of around .33. However, when we label each variable as a between variable, and then label the regression as a between regression, the coefficient drops to about .17. I understand the power level changes at the second level due to the smaller N (level 2 is supervisors, level 1 is employees). I don't understand why the coefficient would decrease by 50%. We ran the regression by introducing a variable that is the group means of the level 1 variable, and ran everything at level 2 in Mplus. To my understanding, this is the recommended process when dealing with a 211 model, which is what we have. At this point, we are only looking at the first half of the model, say between X and M. Any thoughts on this? Best wishes. 


You say that one vble is on level 1 and one on level 2. And then you say that each vble is labeled as between  Mplus would protest against that contradiction. You may want to send the two outputs you refer to to Support along with your license number. 


Sorry about the misunderstanding...it is my understanding that introducing a between level (level 2) variable that contains only group means is the appropriate method when dealing with a 211 mediation model and testing indirect effects (Zhang, Zyphur, & Preacher, 2009). My understanding was that introducing the group mean variable for the level 1 variable creates a between level variable since the only variation is at the between level. Then run the between level regression and labeling the between level X variable and the between level group mean variable for M and have only a between level regression to represent the relationship between X and M even though M is actually a lower level variable. 


Sounds ok then. 


I want to run a 211 with a level 2 moderator of the a path. I am receiving an error “TYPE=TWOLEVEL requires specification for the CLUSTER option”. I am assuming there is a small error I am not seeing, but I haven’t been able to figure it out. Thank you as always for the help! Robert USEVARIABLES ARE ID X Y M XW W; CLUSTER = ID; WITHIN=Y M; BETWEEN = X W XW; ANALYSIS: TYPE = TWOLEVEL RANDOM; MODEL: %WITHIN% Y M; Y ON M(b1); %between% X W XW M Y; M ON X(a1) XW(a2) W; Y ON M X XW W; MODEL CONSTRAINT: NEW (IND1 WMODVAL); WMODVAL=3.5; !+1SD IND1=(a1+a2*WMODVAL)*b1; OUTPUT: TECH1 TECH8 CINTERVAL; 


We need to see the full output to say  send to Support along with your license number. 

Mercy Oyet posted on Sunday, November 12, 2017  2:15 am



Hello Dr. Muthen, I want to test a 111 model with a level2 variable w moderating path a (this is a repeated measures analyses). I have three level 2 covariates (l, m, n) and one level 1 covariate (p). Could you have a look at my syntax and let me know if this looks okay? Thank you! I have not used Mplus before but recently purchased the license. I would really appreciate your advise on this. VARIABLE: NAMES ARE Clus x m y p w l m n; USEVARIABLES ARE clus x m y p w l m n; CLUSTER IS clus; DEFINE: xw = x * w; ANALYSIS: ESTIMATOR = BAYES; PROCESSORS = 2; BITERATIONS = (30000); ANALYSIS: TYPE IS TWOLEVEL RANDOM; MODEL: %WITHIN% x m y p; m ON x (b1); y ON x (b2); y ON m (b3); y ON p (b4); %BETWEEN% x m y w l m n; m ON x (a1); xw (a2) w y ON m; x xw w; x WITH xw w_cen l m n; w WITH xw l m n xw WITH l m n; l WITH m n m WITH n l n WITH l m MODEL CONSTRAINT: PLOT(indirect); LOOP(mod,2,2,0.1); indirect = b3*(b1+a2*mod); PLOT: TYPE = PLOT2; OUTPUT: TECH8 CINTERVAL; 


I see two issues here: 1) Note that the xw variable has variation also on Within. 2) You typically use s  m on x; s on moderator; if you want level 2 moderation. 

Mercy Oyet posted on Tuesday, November 14, 2017  3:43 pm



Thank you Dr. Muthen. This is quite helpful. 

Back to top 