Plotting MLM interaction PreviousNext
Mplus Discussion > Multilevel Data/Complex Sample >
Message/Author
 Jaimee posted on Tuesday, May 27, 2014 - 10:01 pm
I am trying to figure out how to plot an interaction effect between 2 level 2 variables in a MLM. I am having a bit of trouble as I am getting confused with the syntax.

Here is what I have

USEVARIABLES clus Y X C D M N O MxN;
CLUSTER = clus;
WITHIN = C D;
BETWEEN = M N O MxN;
DEFINE:
MxN = M*N;
CENTER M (GRANDMEAN);
CENTER N (GRANDMEAN);
CENTER O (GRANDMEAN);

ANALYSIS: TYPE = TWOLEVEL;

MODEL: %within%
Y on C D;
%BETWEEN%
Y on M (beta1)
N (beta2)
O
MxN;

MODEL CONSTRAINT:
PLOT(interaction);
LOOP(moderate, 5, 28, 1);
Y = beta1+beta2* moderate;
PLOT: TYPE = PLOT2;

The model constraint and naming of the pathways is where I am confused. I need a plot with Y on the Y axis, N as the moderator and M on the X axis.

Any help would be very much appreciated. Thanks very much.
 Bengt O. Muthen posted on Wednesday, May 28, 2014 - 12:18 am
Take a look at how it is done for UG ex 3.18 as shown on our Mediation page:

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

Just translate that to your Between-level statements.
 Laura Giurge posted on Thursday, April 30, 2015 - 10:33 am
Hi, I have a related question to the above discussion. I am running a twolevel random model with random intercepts and slopes. I wish to plot the cross over interaction but I get an error message: ' Error in parsing line:"LOOP (MOD,-1,1,0.1)"'

Here is the full syntax:
Missing are all (-99);
BETWEEN = gmx;
WITHIN = gmw;
CLUSTER = Id;
ANALYSIS: TYPE = TWOLEVEL RANDOM;
MODEL:
%WITHIN%
s | sqy ON gmw;
%BETWEEN%
sqy ON gmx;
[s] (a);
s ON gmx (b);
sqy WITH s;
MODEL CONSTRAINT
PLOT(crosslv1);
LOOP (mod, -1,1,0.1);
crosslv1 = a+b*mod;
PLOT:
TYPE = PLOT2;
OUTPUT: TECH8 TECH4 SAMPSTAT;

I cannot figure out what am I doing wrong. Thanks a lot in advance!
 Bengt O. Muthen posted on Friday, May 01, 2015 - 12:24 am
You don't show a colon after CONSTRAINT.
 Laura Giurge posted on Friday, May 01, 2015 - 1:44 pm
Professor Muthen, thank you so much for the quick response! It was a very sloppy mistake on my side.
Back to top
Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: