2-1-1 Moderated Mediation Model
Message/Author
 Sven Lohrey posted on Friday, December 05, 2014 - 4:21 am
Dear Dr. Muthen,

I want to test a 2-1-1 model with a level-2 variable w moderating path a, and a level-1 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;
 Bengt O. Muthen posted on Friday, December 05, 2014 - 9:55 am
That's a complex model. A key issue is the moderation of the b path which needs special care already in the single-level 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 group-level outcome (i.e. 2-2-2 in addition to the 2-1-1 model discussed above) and want to add a group-level moderator "v" to the path from group-level mediator "m2" to group-level 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?
 Kristopher J. Preacher posted on Tuesday, February 17, 2015 - 12:01 am
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.
 Marcus Valenzuela posted on Wednesday, February 24, 2016 - 10:38 am
Dear Dr. Muthen,

I am trying to run a 2-1-1 (x,m,y) moderated mediation model. This model includes a cross-level 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 cross-level interaction and group centering, which will then not allow me to use it for the BETWEEN part of the mediation analysis. Is a 2-1-1 moderated-mediation model including a cross-level interaction possible in MPLUS? Or would you suggest a 2-step process for this? I wanted to ask you this first initial question before posting my code. I appreciate your time.
 Bengt O. Muthen posted on Wednesday, February 24, 2016 - 4:42 pm
I assume you have

s |y ON m;

You can do what other programs do, namely create a Between-level variable that is the cluster mean of m.
 Marcus Valenzuela posted on Friday, February 26, 2016 - 4:32 pm
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 2-1-1 model with a a level 2 variable w moderating both paths a and b (b as the cross-level int). I created mm as a between-level 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%
bij|y ON x;
! [T1LMX@0]; I was going to add this since m was group-mean 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;
 Bengt O. Muthen posted on Friday, February 26, 2016 - 6:01 pm
You declare x as a Between variable but you use it on Within:

%WITHIN%
bij|y ON x;
 Marcus Valenzuela posted on Friday, February 26, 2016 - 7:49 pm
Yes, I am sorry, that was a typo on my part. Was that the only aspect that seemed strange?
 Bengt O. Muthen posted on Sunday, February 28, 2016 - 4:10 pm
I would have to see the script for a run where this mistake has been cleared up.
 Marcus Valenzuela posted on Monday, February 29, 2016 - 7:27 am
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.
 Linda K. Muthen posted on Monday, February 29, 2016 - 4:47 pm
 Wayne Crawford posted on Wednesday, March 02, 2016 - 11:16 am
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 2-1-1 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.
 Bengt O. Muthen posted on Thursday, March 03, 2016 - 6:31 pm
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.
 Wayne Crawford posted on Thursday, March 03, 2016 - 10:16 pm
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 2-1-1 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.
 Bengt O. Muthen posted on Friday, March 04, 2016 - 5:54 pm
Sounds ok then.
 Robert Allen King posted on Tuesday, January 17, 2017 - 8:01 am
I want to run a 2-1-1 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;
 Bengt O. Muthen posted on Tuesday, January 17, 2017 - 9:07 am
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 1-1-1 model with a level-2 variable w moderating path a (this is a repeated measures analyses). I have three level 2 co-variates (l, m, n) and one level 1 co-variate (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;
 Bengt O. Muthen posted on Sunday, November 12, 2017 - 5:41 pm
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.
 mashal ahmed posted on Friday, July 06, 2018 - 8:34 am
Dear Professor,

I am trying to test a model 2-1-1 (X-M-Y) with a level 1 moderator (W) on 2-1.Can i get mplus syntax for it?
 Bengt O. Muthen posted on Friday, July 06, 2018 - 5:48 pm

Preacher et al. multilevel mediation inputs

on our Mediation page:

http://www.statmodel.com/Mediation.shtml