Interactions between observed variables
Message/Author
 Manon LeBlanc posted on Tuesday, July 22, 2008 - 12:38 pm
Hi,

I am currently at the beginning stages of learning Mplus (version 4.1 [a friend is letting me use his computer while he is on holidays])to analyze some data. I am testing a path analysis and want to test for moderation. I see on page 481 in the manual, that I should use the define command. If I were doing a latent variable analysis, I would have the following:

Analysis:
Type = random;
Algorithm =integration.
(1)Is this what I should type for my model?

(2)Do I simply muliply my two variables to create the interaction?

(3)I have 5 possible moderators. Do I test five different models or one model with the five?

Any help is appreciated. I am a PhD student and am just learning this program.
Thanks.
 Linda K. Muthen posted on Tuesday, July 22, 2008 - 1:55 pm
If the interaction is between two observed variables, you would multiply them together. If one of the variables is a latent variable, you would use the XWITH command. See the user's guide on the website for further information.
 Ji-hyun (Jason) Kim posted on Monday, January 26, 2009 - 2:02 pm
Hi,

My theory suggests that I need to estimate a set of equations like the following:

y1 = gamma11x1 + e1 (Eq.1)
y2 = beta21y1 + gamma21x2 + beta22y1x2 + e2 (Eq.2)
Cov(e1, e2) = 0

As you see there is an interaction term in Eq.2 that contains y1. When I substitute (Eq.1) in (Eq.2), x2 is correlated with the error term, which causes an endogeneity problem. I found a friend of mine who has Mplus program. The program does not seem to support a model I suggested. Being less familiar with SEM literature, I haven't been able to find a correct way of estimating beta22. 2SLS wouldn't work either due to non-linearity. Could someone help me on this issue?

Thank you.
 Tihomir Asparouhov posted on Monday, January 26, 2009 - 6:08 pm
I don't think that there are any problems in estimating beta22. In fact you don't need equation 1 at all. You can simply estimate equation 2 directly and ML will give you the consistent estimates.

If you choose to substitute Y1 in the second equation and then estimate beta22 from the combined equation you can still get consistent estimates if you specify that [E with X2] is a free parameter, but you need to specify the correct parameter constraint for this parameter with Mplus Model Constraint which will also involve gamma11.
 Ji-hyun (Jason) Kim posted on Monday, January 26, 2009 - 9:08 pm
Thank you so much for the quick response.

Maybe I am asking a totally trivial question, but it is not immediately clear to me how the Model Constraint command can resolve the endogeneity problem that becomes visible when I substitute (Eq.1) into (Eq.2). Doesn't this command just specify relationship among parameters?

Maybe I am missing something here....
 Tihomir Asparouhov posted on Tuesday, January 27, 2009 - 11:44 am
You can specify the correlation between the covariate and the residual as part of model constraint, but again ... you should not substitute (Eq.1) into (Eq.2) for the sole purpose of obtaining unbiased parameter estimates of that model.

See Example 5.23 in the user's guide for how to use model constraints to build a model with varying variance (Y2 variance) and varying correlation (Y2 with X2).
 db40 posted on Wednesday, July 09, 2014 - 11:33 am
Hi,

Is there any notes on the Mplus website that details how to do an interaction in mplus?

All I am trying to do is a very simple interaction like below. I dont know why but I get the feeling this is wrong.

USEVAR ARE
x1 w y1 x1w ;

Categorical are y1 ;
Define:
x1w = x1*w ;

ANALYSIS:
type = ;
ESTIMATOR= MLR ;
INTEGRATION = MONTECARLO ;
ALGORITHM = INTEGRATION ;
PROCESSOR=4(STARTS) ;

MODEL:
y1 on x1 (a1)
w
x1w (a2) ;

MODEL CONSTRAINT:
NEW (
eff1 ) ;

eff1=a1+a2;
 Linda K. Muthen posted on Wednesday, July 09, 2014 - 11:50 am
This looks correct.
 DavidBoyda posted on Friday, July 11, 2014 - 11:03 am
Linda thank you so much. May I ask - if Im using binary variables is there anything I should consider when defining the interaction.

I mean I didnt center any of the variables because Im really not sure how that would help considering everything is either a 0 or 1.
 Bengt O. Muthen posted on Friday, July 11, 2014 - 4:51 pm
I think it's fine not centering binary variables.
 db40 posted on Tuesday, November 25, 2014 - 12:25 pm
Hi, might I ask some questions regarding this syntax :

My variables are all binary so no centering required but when I run this I get this error:

Error in assignment statement for CATEGORICAL

What is this?

(2) Do i need to use the model constraint command if I am only looking to define an interaction between two observed variables on y1? (i thought model constraint was for indirect effects?)

Can I not just define the interaction using DEFINE as per below and then run a linear regression (without using model constraint) ?

USEVAR ARE
x1 w y1 x1w ;

Categorical are y1 ;
Define:
x1w = x1*w ;

ANALYSIS:
type = ;
ESTIMATOR= MLR ;
INTEGRATION = MONTECARLO ;
ALGORITHM = INTEGRATION ;
PROCESSOR=4(STARTS) ;

MODEL:
y1 on x1 (a1)
w
x1w (a2) ;

MODEL CONSTRAINT:
NEW (
eff1 ) ;

eff1=a1+a2;
 Bengt O. Muthen posted on Thursday, November 27, 2014 - 3:27 pm
 Tamara Kang posted on Thursday, April 20, 2017 - 10:09 pm
How would you test an interaction between two dichotomous variables (each coded as 0 or 1) on one dependent variable (i.e., count variable)? Would you multiple them in the define command (e.g., DEFINE: x1=time*resist), or use a different command? I tried using the XWITH command, but I received an error that the XWITH command is not available with TWOLEVEL RANDOM. Or would I need to probe the interaction using quantpsy.org or another program?
 Bengt O. Muthen posted on Friday, April 21, 2017 - 5:40 pm
Just multiply them in Define.
 Tamara Kang posted on Saturday, April 22, 2017 - 5:20 pm
 Sara De Bruyn posted on Tuesday, April 23, 2019 - 8:18 am
Hi,

I want to perform a path analysis (x>y>z) in which the path between y (binary) and z (binary) is moderated by m (continuous).

I know I should include a 'Define' statement in the syntax:

DEFINE:
ym = y*m

But what should I write in the 'model' statement? I cannot find it in the user's guide nor the forum. Would it be the following?

MODEL:
z on
y
m
ym;

y on x;

 Bengt O. Muthen posted on Tuesday, April 23, 2019 - 5:02 pm
Looks ok. Perhaps you want also

z on x;

Note that a binary outcome (z) and a binary mediator (y) calls for "counterfactually-defined effects" - see our Mediation page:

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

and also our Short Course Topic 11 video and handout on our website.
 Sara De Bruyn posted on Monday, April 29, 2019 - 6:14 am
Thank you very much. The video was really helpful. I have a follow-up question regarding these analyses.

To be more concrete, I want to test the effect of women's social status (x) on women's attitude towards female circumcision (y) on their final decision whether they let their daughter be medically circumcized or not (z). Moreover, we hypothesize that the prevalence rate of circumcision within the women's region (m) moderates the association between y and z.

We have circumcision prevalence rates for all regions of Egypt.

(1) Would it be necessary to do multilevel SEM?
(2) Or could we do regular SEM in which each woman of our dataset gets their own 'individual' prevalence rate (i.e. the rate of the region where they live) and include it as a continuous moderator in our model?
(3) If (2) would be possible, do we need to control for the fact that the number of respondents differ between regions? If so, how would we do that?

Thank you very much.
 Bengt O. Muthen posted on Tuesday, April 30, 2019 - 3:53 pm
You want to take into account that there is possibly variation across regions in attitudes (y) and in tendency to let their daughter be circumcised (z). Plus that y influences z differently in different regions (the moderation). This can be done using multilevel SEM - at least if you have many (say > 30) regions and you view region as a random mode (random draw from a larger population of regions) as opposed to a fixed mode (which would be handled by multiple-group analysis).

For multilevel modeling you would have a random intercept on level 1 (woman) for y and for z which varies on level 2 (region). And you would have a random slope for z regressed on y so that the influence of y on z is moderated by region as you say.

It would be easier for others to understand this quicker if your notation is the standard for mediation. So instead of saying as you do

x -> y -> z

you would say:

x -> m -> y

where x = woman's soc status
m = attitude
y = daughter decision
 Chang Liu posted on Friday, June 05, 2020 - 5:56 am
Hi,

For the moderated mediation, 1 mediator, 1 moderator of the mediator - DV path only, can I create the interaction term (mediator * moderator) before the analysis (instead of using Mplus DEFINE function)? This way, will Mplus know that is the interaction term (mediator * moderator)?

Thank you so much!
 Bengt O. Muthen posted on Friday, June 05, 2020 - 6:26 pm
Yes.