Message/Author 


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. 


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. 


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 nonlinearity. Could someone help me on this issue? Thank you. 


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. 


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.... 


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; 


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. 


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; 


Please send output and license number to Support. 

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? 


Just multiply them in Define. 

Tamara Kang posted on Saturday, April 22, 2017  5:20 pm



Thank you for your help! 

Back to top 