Using a control variable in SEM PreviousNext
Mplus Discussion > Structural Equation Modeling >
Message/Author
 Amanda M. White posted on Wednesday, October 17, 2007 - 7:32 pm
I'd like to control for age in my SEM model - would I use WITH to do this? Also, if I do use WITH to control, is there one line of syntax that controls for age in the entire model or do I have to include a line in for each construct or variable?
 Linda K. Muthen posted on Thursday, October 18, 2007 - 9:41 am
One controls for a variable by using it as a covariate in a regression. The ON option is used for regression. You should include age as a covariate in all ON statements.
 Emily Scheinfeld posted on Thursday, February 14, 2013 - 12:00 pm
I understand I need to control for my control variables (age and sex) on each line, but what does that look like? If I have all observed data:

IV BY DV
IV BY DV DV2 DV3

How do I include age and sex as a covariate?
 Linda K. Muthen posted on Thursday, February 14, 2013 - 1:45 pm
If you factor is iv, the BY statement should be

IV BY DV DV2 DV3;

You don't need the extra IV BY DV.

Then you can regress iv on the covariates:

iv ON age sex;
 Karen Kegel posted on Tuesday, June 04, 2013 - 6:58 am
Dear Drs Muthen:

I have 2 questions related to a covariate:

1) I want to include Age as a covariate in my SEM models. Age only correlates with some variables in my model, so I'm only featuring it in some lines of my Mplus code. For example:

UDO ON SC Age;
HS ON SC UDO;
PD ON SC UDO HS Age;

This is okay to do, right? I see above you stated "You should include age as a covariate in all ON statements".

2) Also, even if MPlus automatically correlates Age with my main exogenous variable (here, SC), I would like to get the value of that path in the output. How do I ask for that? If I add a "WITH" line, some of the values (eg, the AIC) change...

Thanks!
 Karen Kegel posted on Tuesday, June 04, 2013 - 8:25 am
Another control variable question while I'm at it:

What if I want to have a control variable that does not correlate with the main exogenous variable? For example, I have syntax like so for one model:

udo ON sc age
hs ON udo sc
pd ON hs udo sc age

I do not want MPlus to assume there should be covariance between SC and age. Is there anything I can do about this? Thanks again!
 Bengt O. Muthen posted on Wednesday, June 05, 2013 - 10:39 am
I would recommend handling the covariates by the Mplus default, namely that they are all correlated. Their correlation values can be found by using SAMPSTAT. Those correlations are not part of the model. The only exception I would make in this regard is if you have strong theoretical reasons for zero correlations, for instance with a randomized study where the tx variable is uncorrelated with a pretest, but even then it is not necessary. What you should not do is to look at the sample correlations and for almost zero sample corr's fix those corrs at zero in the model. Including a correlation that is almost zero does not hurt.

When you start using WITH among covariates, they change status in Mplus and are include among the list of DVs and therefore BIC/AIC change.
 Karen Kegel posted on Thursday, June 06, 2013 - 11:29 am
Thank you so much for your help. To clarify, you are saying that by default, MPlus includes covariance/correlation between a control variable and an exogenous variable. For one of my models, I absolutely need to this covariance/correlation to be contributing to model fit, path coefficient results, etc. This is because I am comparing it vs other models where I have a predictor path running from Age to UDO. When moving UDO to become the main exogenous variable for one model, this predictor path needs to get turned into an explicit covariance path.

If you are saying that such a covariance/correlation is NOT part of model results, is there a way to explicitly and accurately indicate covariance between a control variable and the exogenous variable--besides using a WITH statement?

Sorry if this sounds confusing. Thanks so much again for your time!
 Bengt O. Muthen posted on Thursday, June 06, 2013 - 2:23 pm
If you want some covariates (say x1, x2) to be part of the model to be estimated (and to be evaluated for fit), you include them in the model by saying one of the following:

x1 x2;

[x1 x2];

x1 WITH x2;
 Estee posted on Tuesday, March 04, 2014 - 11:20 am
Dear Dr. Muthen,

I need advice on mplus syntax if I want to include control variables in a mediation model.
Let's say if I have 1 independent variables (IV), 1 dependent variables (DV) and 2 mediators in a SEM model (M1&M2).
The syntax I used is:

ANALYSIS:
BOOTSTRAP = 5000;

MODEL:
IV BY a1 a2;
DV BY b1 b2;
M1 BY c1 c2;
M2 BY c3 c4;

!Direct Relationship between IV and DV
DV ON IV;

!Relationship between IV and Mediator
M1 ON IV (P1);
M2 ON IV (P1);

!Relationship between DV and Mediator
DV ON M1 (P3);
DV ON M2 (P4);

MODEL INDIRECT:
DV IND IV;
DV IND M1 IV;
DV IND M1 IV;

MODEL CONSTRAINT:
NEW (IVM1DV) = P1*P3
NEW (IVM2DV) = P2*P4

!PAIRWISE CONTRAST
NEW (CON)= IVM1DV - IVM2DV;
 Estee posted on Tuesday, March 04, 2014 - 11:21 am
** Continued from the previous post

I have three control variables to be added. They are gender, father's education level and mother's education level. From previous posts, I learnt that control variables/covariates are added in ALL ON statements. As there are missing value in my covariates, I need to bring all of the covariates into the model by mentioning their variances in the MODEL command. So, is the following syntax correct?

ANALYSIS:
BOOTSTRAP = 5000;

MODEL:
Gender FEdu MEdu;
IV BY a1 a2;
DV BY b1 b2;
M1 BY c1 c2;
M2 BY c3 c4;

!Direct Relationship between IV and DV
DV ON IV Gender FEdu MEdu;

!Relationship between IV and Mediator
M1 ON IV Gender FEdu MEdu (P1);
M2 ON IV Gender FEdu MEdu (P1);

!Relationship between DV and Mediator
DV ON M1 Gender FEdu MEdu (P3);
DV ON M2 Gender FEdu MEdu (P4);

MODEL INDIRECT:
DV IND IV;
DV IND M1 IV;
DV IND M1 IV;

MODEL CONSTRAINT:
NEW (IVM1DV) = P1*P3
NEW (IVM2DV) = P2*P4

!PAIRWISE CONTRAST
NEW (CON)= IVM1DV - IVM2DV;

Also, do I need to add the control variables into the MODEL INDIRECT?
Your guidance is very much appreciated. Thank you very much.
 Linda K. Muthen posted on Tuesday, March 04, 2014 - 12:32 pm
This would appear to be correct. Please note that posts to Mplus Discussion should not exceed one window. Please follow that in the future.
 Estee posted on Wednesday, March 05, 2014 - 10:24 am
Thank you very much. I apologize for the the previous post which exceeded one window.
I have a question regarding moderated mediation. In a moderated mediation model, are control variables allowed to be included? For example, gender is tested as a moderator in the mediation model while family income and father education level are controlled in the model.
 Linda K. Muthen posted on Wednesday, March 05, 2014 - 10:40 am
Yes.
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: