Message/Author 


Hi, I am just starting to learn Mplus. I am interested in using MPLUS to model twin data. Right now I am trying to fit a standard ACE model but including a covariate that moderates the path from the latent variables to the observed phenotypes (similar to the model presented in Purcell, 2002, Twin Resarch) Is XWITH appropriate for this? Thank you. 

bmuthen posted on Monday, August 08, 2005  1:16 pm



Yes, XWITH is suitable for this. 


Dear Drs. Muthen, I am using simulated twin data to test a GxE interaction model. I'm using XWITH to specify an interaction between an observed moderator (m1 and m2) and latent genetic (A) and environmental (E) factors: I have no problem running the model using multiple groups and the EM algorithm. However, eventually I want to include interactions between latent factors which requires using numerical integration (=montecarlo) The problem is I get the error message shown below, regardless of what my simulation conditions are. If I take out the interactions the model runs fine, so the problem must have something to do with them. Do you have any tricks you could recommend? Thank you, Carol RANDOM STARTS RESULTS RANKED FROM THE BEST TO THE WORST LOGLIKELIHOOD VALUES Unperturbed starting value run did not converge. 10 perturbed starting value run(s) did not converge. Loglikelihood values at local maxima, seeds, and initial stage start numbers: 1 perturbed starting value run(s) did not converge. THE ESTIMATED COVARIANCE MATRIX IN CLASS 2 COULD NOT BE INVERTED. COMPUTATION COULD NOT BE COMPLETED IN ITERATION 1. CHANGE YOUR MODEL AND/OR STARTING VALUES. 


I would need more information to answer this. Please send the input that ran without the interaction, the input for the model that received the above message, the data, the two outputs, and your license number to support@statmodel.com. 


Hello, I would like to know if it is possible to test models that include 2 latent variable interactions in Mplus 5. For example, if I have a model of f1 > f2 > f3, can I include a moderator f4 between f1/f2 and a moderator f5 between f2/f3? Thanks for any assistance you can provide. 


You can use XWITH more than once in the MODEL command. 


Hi Linda and Bengt, Can XWITH be used to determine a point of diminishing returns? For example, if I think that Perceived Control (PC) has a point of diminishing returns in its positive effect on health, I can use XWITH to create a latent "PC Squared" term. If this squared term is significant, that means that there is a significant curvilinear component to the effect of PC on health. Can I determine the value of PC Squared at which the change in slope is zero? Does Mplus have functionality for this? Thank you. 


Yes, you can do this using XWITH squared  f XWITH f; 


Thanks, Linda. Can I determine where the point of diminishing returns for this squared term would be? This would be something like looking for a marked decrease in the marginal effect. I also see this Mplus discussion page (http://www.statmodel.com/discussion/messages/23/828.html?1358295422) suggesting that you may have an Excel sheet that offers estimates of marginal effects? Or, is there another way to graph the impact of this squared term created using XWITH on the y variableto, again, determine the point of diminishing returns? Thank you! 


Linda, I suppose what I should have said is that I am looking for elasticities. Does Mplus give percent change of the marginal effect (elasticity)? 


We don't have an automatic way of doing this, but you can always graph it. Just plot the estimatedrelationship between Y and f, where you let f vary a couple of SDs around its mean. 


I am trying to use XWITH in a Montecarlo power analysis to get an interaction. However, I cannot get the model to run. Below is the model I tried. If you remove the XWITH the model runs just fine. Any ideas on what I could do? model montecarlo: outcome BY d1@1 d2d7*.7; d1d7*.5; f1 by y1@1; y1@0; f1*1; f2 by y2@1; y2@0; f2*1; y1 WITH y2@0; f1 WITH f2@0; int  f1 XWITH f2; outcome ON f1*.3 f2*.3 int*.3; outcome*.73; model: outcome BY d1@1 d2d7*.7; d1d7*.5; f1 by y1@1; y1@0; f1*1; f2 by y2@1; y2@0; f2*1; y1 WITH y2@0; f1 WITH f2@0; int  f1 XWITH f2; outcome ON f1*.3 f2*.3 int*.3; outcome*.73; Analysis: type = random; ALGORITHM = integration; processors = 2; 


Please send the output with the failed XWITH run to Support. 


Dear Drs. Muthen, I am trying to estimate an interaction effect in a larger SEM model (i.e., whether an observed categorical variable moderates the relation between two continuous latent variables). Would it be possible to use an XWITH command to test the interaction, or would it be more appropriate to use multiple group analysis? Sincerely, Natasha 


You could use the observed categorical variable as a grouping variable or in XWITH. The results would be the same. 

Ryan Wright posted on Tuesday, April 01, 2014  1:30 pm



I'm doing a model using XWITH with a categorical IV (dm_Dcsn). Is there a way to generate rsquared values with this? I'm not getting any. Model: Fbk_Norms BY fn1fn3; Fbk_Att BY fa2* fa3 fa4@1; Fbk_Trust BY ft1ft4; Fbk_Intr BY fi1fi5; IUIPC BY iu1iu3 iu5 iu6; Gm_Att BY ga2* ga3 ga4@1; Gm_Intr BY gi1gi5; Gm_Intn BY gn1gn3; Gm_Trust BY gt1gt4; Gm_Rwd BY gr1gr3; Ad_Att BY aa1 aa2 aa3 aa4; Ad_Intr BY ai1ai5; Ad_Intn BY an1* an2@1 an3; Ad_Trust BY at1at4; Ad_Rwd BY ar1ar3; !! Research model XDec_gm  dm_Dcsn XWITH Gm_Att; XDec_ad  dm_Dcsn XWITH Ad_Att; Gm_Att ON Gm_Trust Gm_Rwd Gm_Intr IUIPC; Ad_Att ON Ad_Trust Ad_Rwd Ad_Intr IUIPC; Gm_Intn ON XDec_gm Gm_Att Ad_Att Age Gender Fbk_Att Fbk_Trust Fbk_Norms Fbk_Intr; Ad_Intn ON XDec_ad Gm_Att Ad_Att Age Gender Fbk_Att Fbk_Trust Fbk_Norms Fbk_Intr; OUTPUT: TECH1 TECH8 STAND; 


See the Latent Variable Interaction FAQ on the website. 

Jon H posted on Monday, October 01, 2018  10:46 am



I am having some trouble with xwith. I am using code that goes something like this: L1 by x1 x2 x3 x4 x5; lXz  L1 XWITH z; y ON L1 z lXz; The problem is, I get the following error: *** ERROR in DEFINE command A new variable included on the USEVARIABLES list was not defined. Check your DEFINE statements. Undefined variable: lXz Notably, this error occurs whether I have the line: y ON L1 z lXz; in or not. Of course, since L1 is a latent variable, I can't put it in the define command, and the Mplus users guide says I shouldn't/can't do this anyway. Do you have any sense of what I'm doing wrong? 


The interaction variable that XWITH creates should not be on the USEV list, only variables created in DEFINE. 

Jon H posted on Monday, October 01, 2018  11:12 am



Thanks. I knew it had to be something like that, but couldn't figure it out. 

Back to top 