 Plotting Interactions    Message/Author  anonymous posted on Monday, January 23, 2006 - 5:36 am
Hello,

I'm working on a project where I have interactions. My interactions were generated using the "define" code. I would like to plot the mean, one sd above mean, and one sd below the mean. How may I do this most efficiently in Mplus?

Thanks  Linda K. Muthen posted on Monday, January 23, 2006 - 8:49 am
This cannot currently be done in Mplus.  Ken Sakurai posted on Tuesday, June 15, 2010 - 9:14 pm
Dear Drs. Muthen

I am trying to plot a latent interaction based on Mplus output. All the variables are continuous. By reading the Mplus discussion list, Mplus handout 3(slide 170), and your comment below, I am guessing that one can actually plot an interaction. But I don't understand which part of a Mplus interaction outout tells the intercept value ("a" as in Y = a + b1*x1 + b2*x2 + b3*x1x2). Do you have an example of plotting a latent interaction for continuous variables? Also, you mentioned in the message below that one can calculate low and high latent variable using factor mean and standard errors. How do you do that?

Thank you in advance

A post on April 2008
"concerning interpretation of latent interactions, it seems that following the Aiken and West approach is recommended...I would plot lines for equations with the path coefficients (b1, b2, and b3) for low and high values of the predictor and moderator, as factor means are 0. What is the best way to obtain high and low factor values--is calculating the standard deviation from the variance obtained in the measurement model acceptable?"

B. Muthen replied;
"high and low factor values can be computed using the factor mean and variance estimates. Use e.g. + and - 1 SD from the mean. For an example in a growth model context, see handout for Topic 2 on our web site, slides 125-132."  Linda K. Muthen posted on Wednesday, June 16, 2010 - 8:21 am
Please see the Topic 3 course handout starting on slide 162 and in particular slides 170-171.  Ken Sakurai posted on Friday, June 18, 2010 - 1:52 am
Dear Drs.Muthen,

Based on Mplus manual p.71 (latent interaction), I tried the Mplus input below. The output doesn't seem to produce the intercept value necessary to construct an interaction plot. I studied slides 162-171 from topic 3 just like you said. I see that on page 169, you are using the intercept on S (0.417) into the unstandardized equation. But my output doesn't have the intercept on the latent criterion variables. I'm stuck and need help. Thank you in advance.

ANALYSIS: TYPE = RANDOM;
ALGORITHM=INTEGRATION
model: AFFECT BY Aper1-Aper3;
JS BY JS1-JS3;
CWB BY CWB1-CWB4;
NA BY NAper1-NAper3;
IJ BY SIJ1-SIJ6;
AxIJ | AFFECT XWITH IJ;
CWB ON AxIJ;
JS ON AxIJ;
JS ON AFFECT;
CWB ON AFFECT;

output: SAMPSTAT STANDARDIZED Tech1 TECH8;  Linda K. Muthen posted on Friday, June 18, 2010 - 9:51 am
It sounds like you may be using an older version of Mplus where TYPE=MEANSTRUCTURE is not the default.  Ken Sakurai posted on Friday, June 18, 2010 - 12:00 pm
Hello Drs. Muthen,

Actually, I have the latest Mplus version, which is Mplus6. The user's guide that I refer to is supposed to be the latest version also.

The only missing information for me to plot 2 latent interactions are an intercepts for a latent criterion (which is intercept ON JS and CWB in my case).

Do you see any problem with my Mplus Input? Should I type in Type = MEANSTRUCTURE? Thank you for your help.  Linda K. Muthen posted on Friday, June 18, 2010 - 2:28 pm
Please send the full output and your license number to support@statmodel.com.  Jerry Grenard posted on Monday, February 14, 2011 - 1:50 pm
I would also like to plot a latent factor interaction. I'm using the unconditional approach by Marsh so that I may fit a two group model by gender (apparently, not possible using XWITH). Unfortunately, I do not see an estimate for the intercept of the dependent latent factor. How do I obtain this estimate?  Bengt O. Muthen posted on Monday, February 14, 2011 - 6:35 pm
An intercept for the dependent latent variable cannot be identified separately from the latent variable indicator intercept parameters.

You can use XWITH with gender.  Luisa Walls posted on Saturday, June 09, 2012 - 10:38 am
Dr Muthen,

I am plotting a three way interaction. I have followed the procedure described by Aiken and West. However, I do not how to request or where to find the intercept of the equation.

I have seen the Topic 3 course handout. In that example the intercept of the independent variable is provided, I have the same model commands but it is not showed in my output, only the intercepts of the residual variances.

could you provide me guidance in how to request or how to find the intercept?  Linda K. Muthen posted on Sunday, June 10, 2012 - 3:42 pm
I am confused by your questions. A dependent variable has an intercept. An independent variable does not. I don't know what you mean by the intercepts of the residual variances.  Luisa Walls posted on Monday, June 11, 2012 - 2:50 am
Sorry my mistake.

I need to know how to request the intercept of the dependent variable when I perform an Interaction effect (xwith) because the output does not show it.  Linda K. Muthen posted on Monday, June 11, 2012 - 6:34 am
Please send the output and your license number to support@statmodel.com.  Helen Zhao posted on Sunday, February 03, 2013 - 5:26 am
Hi, Linda,

I read the handouts and all relevant threads but still have exactly the same problem as people above. I would like to plot interaction but couldn't find the intercept for my dependent variable.

That is, under the section of "intercept" I can only find intercepts of IVs but not DVs. Can you help? Thanks!  Bengt O. Muthen posted on Sunday, February 03, 2013 - 11:35 am
Latent variables in a single group analysis have means and intercepts of zero.  Brianna Delker posted on Saturday, August 08, 2015 - 4:58 pm
Hello-- I ran a simple moderation model with X, M, and Y variables and 2 binary categorical covariates; X and M are also binary categorical variables.

In the Mplus output, where can I find the estimated mean values of the Y variable at each level of the X and M variables? I will use these estimated values to plot the interaction effect in Excel.
Under the Output command, I wrote:
cinterval (bcbootstrap) STAND SAMPSTAT;

Thank you.  Bengt O. Muthen posted on Sunday, August 09, 2015 - 7:29 pm
It's like regression of Y on binary M and binary x (regression on dummy variables). That gives you 1 intercept and 2 slopes (or 3 slopes if you interact X and M). This translates into the Y means as in regular regression with dummy variables (the Y mean for X=0, M=0 is the intercept, etc).  Ye Liu posted on Friday, October 09, 2015 - 8:34 am
I am trying to incorporate an interaction in a SEM model between two latent exogenous variables by using the XWITH option in Mplus. Because the means of latent variables are 0, which means that there is only slopes and no intercepts between x and the y, I have learned above that y will have zero as their intercepts.How to plot the interaction effects like this &#8203;in the case of structural equation modelling?  Bengt O. Muthen posted on Friday, October 09, 2015 - 8:48 am
See our FAQ Latent variable interaction LOOP plot.  Samuli Helle posted on Monday, December 21, 2015 - 2:25 am
I�m trying to plot the quadratic effect of my (standardized) latent variable on continuous-time survival response using the code below with the LOOP-command. The plot looks rather ok to me but I�m still wondering whether the code used is correct?

MODEL:
LAT = x1* x2 x3; LAT@1;
LAT2 | LAT XWITH LAT;
Y = LAT (b1)
LAT2 (b2);
MODEL CONSTRAINT:
PLOT (predY);
LOOP (LAT,-3,3,0.1);
predY = EXP((b1*LAT)+b2*(LAT*LAT));
PLOT:
TYPE =PLOT3;

Thanks!  Tihomir Asparouhov posted on Tuesday, December 22, 2015 - 12:54 pm
The variable predY is the hazard ratio (not the expected value of Y). The effect of the covariates estimated by a proportional hazards model is reported as that hazard ratios. So the formulas are correct except in the model there is no = sign. Rather
LAT by x1* x2 x3;
Y on LAT (b1)
LAT2 (b2);  Samuli Helle posted on Tuesday, December 22, 2015 - 1:05 pm
Thanks Tihomir. And yes, there was a typo in my code.  Sofie Wouters posted on Wednesday, January 13, 2016 - 2:43 am
If you would have a path model (only observed variables) with multiple dependent variables (y1, y2, and y3), and also multiple independent variables (a and b), and you would find a signficant interaction effect (e.g., a*b on y2 is signficant), would it be acceptable to plot this interaction using this equation?

y2=intc + B*a + B*b + B*ab
(where you get the intercept of y2 and the unstandardized regression coefficients from Mplus and you just fill in meaningful values for a and b (like 1 and -1 if these variables are standardized))

Or in other words, would it be acceptable to ignore the other variables in the path model and plot the interaction just like in a normal/simple regression analysis?  Bengt O. Muthen posted on Wednesday, January 13, 2016 - 12:17 pm
Check our Mediation page on our website and the description of ex 318 plotting.  Sofie Wouters posted on Thursday, January 14, 2016 - 7:29 am
I may be wrong but isn't the example about a model with only one dependent variable? I was wondering about plotting interactions in a model with more than one dependent variable? In such a model, do you plot an interaction on a specific DV like you do in this example thus ignoring the other DVs in the plot?  Bengt O. Muthen posted on Thursday, January 14, 2016 - 6:11 pm
Yes, you do one DV at a time.  Sofie Wouters posted on Tuesday, January 19, 2016 - 3:18 am
OK, thanks a lot!  Rebecca Lazarides posted on Wednesday, July 27, 2016 - 3:32 am
Dear Drs Muthen,

according to the instructions on your website, I use the syntax below to plot a latent interaction.

However, I get the following error message:

*** ERROR in MODEL CONSTRAINT command
A parameter label or the constant 0 must appear on the left-hand side
of a MODEL CONSTRAINT statement. Problem with the following:
HIGHF2) =

Here is the syntax:

Model Constraint:

NEW (lowf2 highf2);
PLOT (lowf2 highf2);
LOOP (f1, -3, 3, 0.1);
lowf2 = (b1+b3*(-1))*f1+b2*(-1);
highf2 = (b1+b3*(+1))*f1+b2*(+1);

It seems that Mplus (version 6) does have problems with PLOT (lowf2 highf2) but I am not sure what exctly the problem is.

Thanks for your help!  Linda K. Muthen posted on Wednesday, July 27, 2016 - 6:27 am
The LOOP and PLOT options were not available in Version 6.  Kim Betts posted on Thursday, October 05, 2017 - 5:00 am
Hi,

I have run a latent variable interaction by which the two IV's are latent while the DV is observed continuous.

I have followed the code in the FAQ regarding implementing and graphing interactions, and the coefficients are as expected.

However, I don't understand why the y-axis of my loop plot ranges from -19 to 19 when my observed outcome ranges from 1 to 100?

Also, Mplus estimates the correlation between my two predictors by default. Is that normal, I wouldn't have expected that estimate to be part of my output? What would be the consequence of setting this correlation to 0?

Thank you.

Kim.  Bengt O. Muthen posted on Friday, October 06, 2017 - 11:41 am
Please send your output and plot to Support along with your license number.  Peter Hegel posted on Sunday, November 05, 2017 - 2:56 pm
Hello Drs. Muthen and Muthen,

Loop plot Q: simple moderator relationship, severity moderating relationship between IV (bullying) and DV (turnover). Problem: the IV and DV should be positively correlated, but loop plot output shows a negative relationship between the Y axis and the X axis ("XVAL")for all 3 levels of my moderator.

1. am I misinterpreting the plot?
2. Is the unnamed Y axis my DV, and is "XVAL" my IV?
3. is there some error in my code?

Analysis:
TYPE = RANDOM;
ESTIMATOR = ML;
PROCESSORS = 2;
ALGORITHM = INTEGRATION;

SEVXBB | PL_SEV XWITH BB_ALL;
TICON ON BB_ALL (b1);
TICON ON SEVXBB (b2);
TICON ON PL_SEV (b3);

MODEL CONSTRAINT:
NEW(LOW_W MED_W HIGH_W SIMP_LO SIMP_MED SIMP_HI);
LOW_W = -1;
MED_W = 0;
HIGH_W = 1;

SIMP_LO = b1 + b3*LOW_W;
SIMP_MED = b1 + b3*MED_W;
SIMP_HI = b1 + b3*HIGH_W;

PLOT(LOMOD MEDMOD HIMOD);
LOOP(XVAL,-3,3,0.1);
LOMOD = (b1 + b3*LOW_W)*XVAL;
MEDMOD = (b1 + b3*MED_W)*XVAL;
HIMOD = (b1 + b3*HIGH_W)*XVAL;

PLOT:
TYPE = plot3;  Peter Hegel posted on Monday, November 06, 2017 - 3:32 pm
My apologies for confusion, but I was incorrect about the correlation, and you should disregard my comment on that topic above.

I do still have a few questions, though. I have reviewed the loop plot FAQ and the Mplus manual, and I am still confused about the following:

1. Is the unnamed Y axis my DV, and is "XVAL" my IV?
2. Is there any way to remove the single vertical and horizontal lines that are perpendicular to zero on each axis? I have removed gridlines but these central lines still remain.

Thank you for reading!

-Peter  Bengt O. Muthen posted on Tuesday, November 07, 2017 - 2:11 pm
This is explained in our book at

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

The book examples are shown at

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

See the example of Table 1.8, part 2.

1) Q1: the intercept is missing but otherwise it is your DV. Q2: Yes.

2) Yes - this is also described in our book. Use the Line plots option within the Loop plot menu.  Ebrahim Hamedi posted on Saturday, September 14, 2019 - 11:11 pm
Hi
This part from the mplus book produces 2 lines to represent the relationship between agg1 and agg5 at 2 values of tx (a binary variable):

model:
[agg5] (b0);
agg5 on
tx (b1)
agg1 (b2)
txagg1 (b3);

model constraint:
loop(x,-1,1,0.1);
plot(tx0 tx1);
tx0 = b0 + b2*x;
tx1 = b0 +b1 + (b2+b3)*x;

1- Let's imagine the tx variable has 5 levels. I cannot figure out how to change the model constraint syntax to get five lines in the graph. The plot line would change to "plot(tx0 tx1 tx2 tx3 tx4);". Can you give me the lines that i need to add at the bottom to get the other 3 lines?

2- I wonder if there is a way to produce distinguished lines (e.g., using colors, patterns, or labels)?

many thanks in advance.  Bengt O. Muthen posted on Monday, September 16, 2019 - 4:11 pm
With 4 tx variables (tx1-tx4), you would label 4 b1 coefficients and 4 b3 coefficients and then use them in 4 tx equations instead of the single tx1 = statement.  Bengt O. Muthen posted on Monday, September 16, 2019 - 4:11 pm
And there are plot settings for marking the different lines.  SA Barzeva posted on Thursday, June 18, 2020 - 10:34 pm
Hi,

Is there a way to plot multiple interactions with different loops at once (with different predictors) in version 8.4?

For example, creating plots for both:

PLOT(edu0 edu1);
LOOP(xval, -4, 4, .5);
edu0 = b0 + a11fn*xval;
edu1 = (b0 + a44efn) + (a11fn+a55efn)*xval;

PLOT(sex0 sex1);
LOOP(xval2, 0, 7, 1);
sex0 = b01 + b1fq*xval2;
sex1 = (b01 + c2) + (b1fq+b3fq)*xval2;

Thanks!  Thuy Nguyen posted on Friday, June 19, 2020 - 6:23 pm
This is not possible. You can only have one LOOP statement.  DavidBoyda posted on Thursday, July 09, 2020 - 9:50 am
Dear Professor,

in example 3.18, the plot is as follows:

MODEL CONSTRAINT:
LOOP(mod,-2,2,0.1);
PLOT(indirect);
indirect = b*(gamma1+gamma2*mod);

Given my model is a second stage moderator:

x1 M W Y

Could I get some guidance on the syntax for my plot given my model information:

y1 on m (b)
Mz (gamma2)
x1
b1
z ;

m on x1 (gamma1)
b1 ;

Could I check this please?

indirect1 = gamma1*(b*gamma2*mod) ;

One last question please. I know the mod command assumes different values from Z, but is it possible to probe the indirect effect -1SD / +1SD with syntax so precise estimates are displayed in the additional parameters?  Bengt O. Muthen posted on Thursday, July 09, 2020 - 6:18 pm
This is covered in our RMA book, page 95. It should be

indirect1 = gamma1*(b+gamma2*mod) ;

Yes, just use Model Constraint with NEW to express this for particular values.  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: Topics | Tree View | Search | Help/Instructions | Program Credits Administration