XWITH PreviousNext
Mplus Discussion > Structural Equation Modeling >
 Carol Van Hulle posted on Tuesday, August 02, 2005 - 1:17 pm

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.
 Carol Van Hulle posted on Thursday, March 22, 2007 - 2:03 pm
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


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.

 Linda K. Muthen posted on Thursday, March 22, 2007 - 2:32 pm
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.
 michael curran posted on Friday, May 30, 2008 - 8:01 pm
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.
 Linda K. Muthen posted on Saturday, May 31, 2008 - 5:47 am
You can use XWITH more than once in the MODEL command.
 Lisa M. Yarnell posted on Tuesday, January 15, 2013 - 3:31 pm
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.
 Linda K. Muthen posted on Tuesday, January 15, 2013 - 5:11 pm
Yes, you can do this using XWITH

squared | f XWITH f;
 Lisa M. Yarnell posted on Tuesday, January 15, 2013 - 5:24 pm
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 variable--to, again, determine the point of diminishing returns?

Thank you!
 Lisa M. Yarnell posted on Wednesday, January 16, 2013 - 7:46 am
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)?
 Bengt O. Muthen posted on Wednesday, January 16, 2013 - 7:57 am
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.
 Isaac Washburn posted on Friday, November 22, 2013 - 12:21 pm
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 d2-d7*.7;
f1 by y1@1;
f2 by y2@1;
y1 WITH y2@0;
f1 WITH f2@0;
int | f1 XWITH f2;
outcome ON f1*.3 f2*.3 int*.3;
outcome BY d1@1 d2-d7*.7;
f1 by y1@1;
f2 by y2@1;
y1 WITH y2@0;
f1 WITH f2@0;
int | f1 XWITH f2;
outcome ON f1*.3 f2*.3 int*.3;
type = random;
ALGORITHM = integration;
processors = 2;
 Bengt O. Muthen posted on Saturday, November 23, 2013 - 6:05 am
Please send the output with the failed XWITH run to Support.
 Natalia Dmitrieva posted on Friday, March 14, 2014 - 7:47 am
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?

 Linda K. Muthen posted on Friday, March 14, 2014 - 10:14 am
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 r-squared values with this? I'm not getting any.


Fbk_Norms BY fn1-fn3;
Fbk_Att BY fa2* fa3 fa4@1;
Fbk_Trust BY ft1-ft4;
Fbk_Intr BY fi1-fi5;
IUIPC BY iu1-iu3 iu5 iu6;
Gm_Att BY ga2* ga3 ga4@1;
Gm_Intr BY gi1-gi5;
Gm_Intn BY gn1-gn3;
Gm_Trust BY gt1-gt4;
Gm_Rwd BY gr1-gr3;
Ad_Att BY aa1 aa2 aa3 aa4;
Ad_Intr BY ai1-ai5;
Ad_Intn BY an1* an2@1 an3;
Ad_Trust BY at1-at4;
Ad_Rwd BY ar1-ar3;

!! 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;

 Linda K. Muthen posted on Tuesday, April 01, 2014 - 1:39 pm
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?
 Bengt O. Muthen posted on Monday, October 01, 2018 - 11:07 am
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
Add Your Message Here
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Options: Enable HTML code in message
Automatically activate URLs in message