Mediation and moderation
Message/Author
 Anonymous posted on Monday, March 29, 2004 - 1:04 pm
Hi,

I have a path model with variable A impacting on variable B and B impacting on variable C, i.e B is a mediating variable.
i also hypothesize that the impact of B on C is moderated by another variable D. is there a way to test this model?

Thank you.
 Linda K. Muthen posted on Monday, March 29, 2004 - 3:09 pm
If the variables are observed, you can create interactions using DEFINE. If they are latent, or latent and observed, Version 3 can include interactions for these types of variables.
 Anonymous posted on Monday, March 29, 2004 - 4:10 pm
thanks. does this mean an observed variable can be a mediator and a moderator in the same model?

thanks again
 Linda K. Muthen posted on Tuesday, March 30, 2004 - 9:06 am
I believe that this is the case. I have never actually done this though.
 Anonymous posted on Wednesday, January 12, 2005 - 10:53 am
I am testing a mediational hypothesis with one linear exogenous variable, one linear endogenous variable, and one dichotomous endogenous variable (all variables are observed):

X1 --> Y1 --> Y2

Where:
X1 = continuous observed variable
Y1 = continuous observed variable
Y2 = dichotomous observed variable (underlying continuous scale cannot be assumed)
B1 = coefficient from X1 --> Y1
B2 = coefficient from Y1 --> Y2

If all variables were linear, I could calculate the indirect effect of X1 on Y2 via Y1 by multiplying B1*B2. However, in this case, B1 is based on linear data and B2 based non-linear data. Are the point estimates and standard errors of the indirect effect generated by MPLUS3 valid in this case?

Here's the code I used to obtain the estimates:

USEVARIABLES ARE X1 Y1 Y2;
CATEGORICAL ARE Y2;
ANALYSIS:
MODEL:
Y1 ON X1;
Y2 ON Y1 X1

MODEL INDIRECT:
Y2 VIA Y1 X1;

Thank you for your help!
 Linda K. Muthen posted on Wednesday, January 12, 2005 - 1:57 pm
Yes.
 Zoogah posted on Friday, August 19, 2005 - 8:07 pm
I have a model with 8 predictor variables (6 continuous, 2 categorical); 2 control variables (1 continuous, 1 categorical); 1 mediator (6 categories), 1 dependent variable (continuous).
What approach do I use to test it? References will also help. Help please!
 Zoogah posted on Saturday, August 20, 2005 - 4:41 am
I have a path model with 8 predictors (6 continuous, 2 categorical); 2 covariates (1 continuous, 1 categorical); 1 mediator (6 categories); and 1 dependent variable (continuous). Which approach do I use to test the model? Please help!!!
 Linda K. Muthen posted on Saturday, August 20, 2005 - 9:25 am
This depends on the scale of your mediating variable. If it is nominal, then this model cannot be estimated as specified. If it is ordinal, you can estimate the model using the maximum likelihood estimator treating it as a continuous variable or the weighted least squares estimator treating it as a categorical variable. I would suggest maximum likelihood unless you have strong floor or ceiling effects. The following papers may be of interest:

Muthén, B. & Kaplan D. (1985). A comparison of some methodologies for the factor analysis of non-normal Likert variables. British Journal of Mathematical and Statistical Psychology, 38, 171-189.

Muthén, B. & Kaplan D. (1992). A comparison of some methodologies for the factor analysis of non-normal Likert variables: A note on the size of the model. British Journal of Mathematical and Statistical Psychology, 45, 19-30.
 Zoogah posted on Monday, August 22, 2005 - 10:08 am
Linda,
Thank you very much. The mediating variable is ordinal. I will treat it accordingly.
 Mary Anders posted on Thursday, July 13, 2006 - 1:32 pm
First, I would like to expressed how impressed I am with the wealth of information provided on this site. I apologize for my relative ignorance regarding Mplus and if you have already addressed my questions elsewhere within the Mplus discussion pages. My chair has recommended that I use SEM for my dissertation analyses, specifically WLS in Mplus. However, he has little background with your software program. Therefore, before I pursue this idea further, I wanted to confer with the experts (you) regarding whether or not the model that I would be proposing could be tested within Mplus.

All of my observed variables are binary (0-1). My model would involve two latent variables (each indicated by 7 of the observed variables). I would propose that the two latent variables interact to predict each of three observed variables that, in turn, predict the observed dependent variable.

Can you please let me know if the type of moderated mediation dichotomous outcome model I am proposing could be tested in Mplus and, if so, any suggestions you might have regarding computing this model? If this model is not testable, can you highlight the reasons for me?

Thank you very much for your time and any assistance you can offer.
 Bengt O. Muthen posted on Friday, July 14, 2006 - 4:43 pm
Yes, this can be handled in Mplus. To handle the interaction, you would be using maximum likelihood estimation.
 SC posted on Wednesday, October 25, 2006 - 4:13 pm
Moderation and Mediation in the same model
_________________________________________

I need to test a model which has both an interaction (moderation) effect and an indirect effect (mediation).

Con1--------->|
Lat1---------->|--> Cat1 --> Lat2 --> Lat3
Con1xLat1 -->| . . . . |-------->>---------|

Con1 is a continous variable
Lat1/2/3 are latent variables
Cat1 is a categorical variable (1,0,-1)

Con1 moderates the relationship between Lat1 and Cat1, for which I have used "Con1xLat1 | Con1 XWITH Lat1" with ANALYSIS=RANDOM & ALGORITHM=INTEGRATION

Lat2 mediates the relationship between Cat1 and Lat3, for which I have used MODEL INDIRECT with "Lat3 IND Lat2 Cat1".

However, MPLUS gives a error message on testing of Interation and Indirect effects in the same model, saying "*** ERROR: MODEL INDIRECT is not available for TYPE=RANDOM".

What do I do? How do I make MPlus handle this? I need to do it in a way in which reviewers will not complain about. Thanks in advance for you kind consideration, and congratulations on this wonderful product!
 Boliang Guo posted on Thursday, October 26, 2006 - 1:10 am
cross level interaction is same as a level 2 variable effects on level 1 relationship. pls refer Raudenbush's general 2 level regrestion equation.
for multilevel mediation/moderation assessing, you can not ask current version Mplus give you the direct/indirect effect yet, pls refere kenny's 2003 psychology method paper for the formula to compute indirect effect. following is a code for basic multilevel path analysis, psl add level 2 var for the moderation effcet by your self. if you are using multilevel SEM, I am not sure weather the code will work.just for reference.
VARIABLE: NAMES ARE ID2 ID1 X M Y;
usevariable = ID2 X M Y;
within = X;
CLUSTER IS ID2;
ANALYSIS: TYPE = TWOLEVEL RANDOM;
ALGORITHM = INTEGRATION;
MODEL:
%WITHIN%
c | Y ON X;! c mean c’
b | Y on M;
a | M on X;
%BETWEEN%
Y with M b a c;
M with b a c;
a with b c;
b with c;
 SC posted on Thursday, October 26, 2006 - 1:17 pm
Question: Moderation and Mediation in the same model (single level)
_____________

(NOTE: Based on cross-sectional individual level survey data. This is NOT MultiLevel.
I am sorry, but the above reply is extremely confusing and unrelated. Kindly provide a clear and understandable answer.)
-------------------

I need to test a model which has both an interaction (moderation) effect and an indirect effect (mediation).

Con1--------->|
Lat1---------->|--> Cat1 --> Lat2 --> Lat3
Con1xLat1 --->| . . . . |-------->>------|

Con1 is a continous variable
Lat1/2/3 are latent variables
Cat1 is a categorical variable (1,0,-1)

Con1 moderates (interaction effect) the relationship between Lat1 and Cat1, for which I have used "Con1xLat1 | Con1 XWITH Lat1" with ANALYSIS=RANDOM & ALGORITHM=INTEGRATION

Lat2 mediates (indirect effect) the relationship between Cat1 and Lat3, for which I have used MODEL INDIRECT with "Lat3 IND Lat2 Cat1".

However, MPLUS gives a error message on testing of Interation and Indirect effects in the same model, saying "*** ERROR: MODEL INDIRECT is not available for TYPE=RANDOM".

What do I do? How do I make MPlus handle this?
 Linda K. Muthen posted on Thursday, October 26, 2006 - 1:41 pm
MODEL INDIRECT is not available with TYPE=RANDOM. There is no way to change this. You would need to compute the indirect effects yourself.
 Tor Neilands posted on Tuesday, October 16, 2007 - 4:28 pm
A colleague has run a path analysis with the following variables:

1. Independent variables: x1-x10, a mixture of continous and categorical variables.

2. Mediators m1-4, all dichtomous

3. A single outcome, y1, dichotomous

WLSMV estimation with the THETA parameterization was used in Mplus 4. MODEL INDIRECT was used to define the various possible indirect effects. The investigator would now like to interpret the various effects.

On p. 356 of the v4 Mplus User's Guide, a formula is provided for converting probit Mplus results to probabilities in the dependent variable as a function of a single predictor:

p(u=1|x) = F(-t + bx)

where F is the normal distribution function, t is the threshold estimate, and b is the parameter estimate for the predictor. I am curious as to how this formula could be applied to the analysis situation described above. For instance, if the investigator wanted to compute the probability of u=1|x for the total effect of x1 on y1 through m1, could he use:

p(u=1|x) = F(-t + [a*b+c]x)

where a and b are the components of the indirect effect and c is the direct effect of x1 on y1?
 Linda K. Muthen posted on Wednesday, October 17, 2007 - 10:07 am
This sounds correct.
 Michael Mitchell posted on Friday, November 16, 2007 - 7:52 am
Greetings

I have a model that could be described as

X --> Y ----> Z
\------------/

Y is a NOMINAL variable with 3 or perhaps 4 categories. I wish to assess the direct and indirect effects of X on Z. As I understand it, this is not directly estimated in Mplus. Can this be "faked" by converting Y into a series of dummies?

Thanks,

Michael
 Linda K. Muthen posted on Friday, November 16, 2007 - 1:47 pm
I would instead use the mediating variable as a grouping variable.
 Rebecca Fraser posted on Friday, January 09, 2009 - 3:29 pm
Hello,

I noticed above that model indirect is unavailable with Type = Random, but is it an option with Type = TwoLevel?

I am trying to estimate the indirect effect for a 2-1-1 multilevel mediation model. While the model indirect command does not result in any error messages, the output shows 0.000 for the estimate and standard error with a est/se of 999.00.

Thanks so much!
 Linda K. Muthen posted on Friday, January 09, 2009 - 5:49 pm
MODEL INDIRECT is available with TYPE=TWOLEVEL.

It sounds like you may not be using the most recent version of the program. If you are, please send your input, data, output, and license number to support@statmodel.com
 Jill Messing posted on Monday, April 13, 2009 - 11:22 am
We are using path analysis to examine mediation between three exogenous variables and three endogenous variables. We are also controlling for three other exogenous variables expected to influence the three outcomes. All variables in the model are dichotomous coded ‘0’ or ‘1.’
Is it correct to both test the direct and indirect paths as follows?
y1 ON y4 x1 x2 x3 x4 x5 x6
y2 ON y4 x1 x2 x3 x4 x5 x6
y3 ON y4 x1 x2 x3 x4 x5 x6
y4 ON x1 x2 x3
Model indirect: y1 IND y4 x1
Model indirect: y1 IND y4 x2
Model indirect: y1 IND y4 x3
Model indirect: y2 IND y4 x1
Model indirect: y2 IND y4 x2
Model indirect: y2 IND y4 x3
Model indirect: y3 IND y4 x1
Model indirect: y3 IND y4 x2
Model indirect: y3 IND y4 x3

Can you also please clarify:
Is it correct for us to use WLSMV & parameterization=delta?
Are the indirect paths tested using the Sobel test?
We understand that Chi Square difference test can’t be used with WLSMV, does that mean that it is incorrect to use the Chi Square Test of Model Fit as a estimation of model fit or is it just that you can’t use it to compare different models for example in a multigroup analysis?
If we model direct and indirect paths together as we did above and for example significant paths are found between the following paths:
Model indirect: y1 IND y4 x2
Model indirect: y3 IND y4 x2
Y1 ON x2
Y3 On x2
Y4 On x2
Then we have partial mediation?
Thank you!
 Linda K. Muthen posted on Monday, April 13, 2009 - 1:40 pm
MODEL INDIRECT can contain more than one IND statement. You don't need to repeat MODEL INDIRECT. Otherwise this looks okay.

You can use WLSMV and the Delta parameterization. Yes, the Sobel test is used.

With WLSMV only the p-value should be interpreted. Chi-square and the degrees of freedom are adjusted to obtain a correct p-value. DIFFTEST should be used to compare nested models.

That would seem to suggest partial mediation.
 Jill Messing posted on Wednesday, April 29, 2009 - 8:30 am
Thank you! One more question -
For a path model using WLSMV and the Delta parameterization, with all dichotomous variables: Can the path coefficients be reported as Betas?
 Linda K. Muthen posted on Wednesday, April 29, 2009 - 10:38 am
Regression coefficients in this case are probit regression coefficients.
 Sebastian Reiche posted on Monday, October 26, 2009 - 11:40 am
Hi,

I am testing a moderated mediation model in which:

X1 --> X2 --> Y1,

and the moderator M moderates the relationship between X2 and Y1

I am using the following MPlus syntax:

USEVARIABLES ARE Y1 X1 X2 M;
CENTERING = GRANDMEAN (X1 X2 M);
CATEGORICAL ARE Y1;
Missing IS .;
DEFINE: interact = M*X2;
MODEL: Y1 on X2 M interact;
X2 on X1;
MODEL INDIRECT: Y1 IND X1;

I keep getting an error message that says that "Unknown variable(s) in an ON statement: INTERACT"

Can you help my in identifying what is wrong with my model command?

Thanks a lot in advance,

Sebastian
 Amir Sariaslan posted on Monday, October 26, 2009 - 12:15 pm
Sebastian,

Try the following:
USEVARIABLES ARE Y1 X1 X2 M interact;

/Amir
 Dan Shefet posted on Monday, June 21, 2010 - 12:35 am
Hey, I am running a simple mediation model with one mediator who is dicotomous and categorical . is it possibe to do that with Mplus? do I need a whole lot of subjects for that like with SEM (I have only 80 subjects so SEM is not an option).
I'm kinda new at this place so I apologize for the any stupid I might post
Thanks,
Dan
 Linda K. Muthen posted on Monday, June 21, 2010 - 11:18 am
You can estimate a mediation model with a categorical mediator using weighted least squares or maximum likelihood estimation in Mplus. Indirect effects can be estimated for the weighted least squares solution.

The necessary sample size depends on the size of your model and the quality of your data. Only a Monte Carlo simulation study could tell you if 80 subjects has enough power in your situation.
 Dan Shefet posted on Monday, June 21, 2010 - 2:43 pm
thanks, I tryed to find weighted least squares in the user's manuals but couldnt find how to execute this test. can you please refer me to the user's manual, or to another source that will help me get aquainted with this test. thanks again.
 Linda K. Muthen posted on Monday, June 21, 2010 - 2:47 pm
Weighted least squares is an estimator. See Example 3.12.
 elizabeth davis posted on Tuesday, September 14, 2010 - 8:04 am
Hi,
I would like to test if two variables are mediators of the same x-y relationship. Is it possible to put them in the same equation, or should I put them in seperate mediation analyses?

What would be the rationale for each approach?

thank you very much!
 Linda K. Muthen posted on Tuesday, September 14, 2010 - 9:50 am
It would depend on whether you are interested in the relationship between the two mediators. If they are both in the model, you estimate partial regression coefficients for each of them. If you run separate models, their relationship is not taken into account.
 Stefanie Köhler posted on Saturday, June 25, 2011 - 1:19 am
Hi,hopefully you can help me. I’m running a mediation analysis which includes a moderation as well. There’re NO latent variables. My independent variable&the mediator are treated as continuous. The moderator affects the a-path that goes from the predictor to the mediator. The moderator=continuous. My outcome=binary (coded 1 and 2).I’m controlling for age.
Now I want to test the indirect path if its signif. using bootstrapping. First I wanted to use MODEL INDIRECT&ESTIMATOR=MLR to get odds ratios, CI’s & estimates for the indirect & total effects. But it didn’t work. So I’ve created the MODEL CONSTRAINT which worked with ESTIMATOR=MLR & INTEGRATION=MONTECARLO.After that I’ve wanted to use bootstrapping,but it didn’t work in combination with ML(R).It’s working with the ESTIMATOR=WLSMV.Problems:
1.Using WLSMV doesn’t provide the odds ratios.Using MLR doesn’t allow bootstrapping.Can I specify both in just ONE model or do I have to live with splitting it up? Or just make a choice what’s more important:odds ratios or bootstrapping.
2.Using WLSMV & bootstrapping provides impossible results.The means are very strange & cannot be true.There are also slopes, but I don’t know why and how to interpret these slopes. Is there something else I’ve forgotten to specify?
 Stefanie Köhler posted on Saturday, June 25, 2011 - 2:30 am
Addition: I guess I figured out that the strange values appear everytime I'm using WLSMV - i.e. the means from my moderator and dependent variable are negative, but they actually cannot be smaller than zero. And everytime I'm using WLSMV a table with slopes shows up.
 Linda K. Muthen posted on Saturday, June 25, 2011 - 11:58 am
BOOTSTRAP is available for ML. ML, MLR, and MLF have obtain the same parameter estimates. BOOTSTRAP gives bootstrapped standard errors. So ML gives the same as MLR and MLF would. Use ML.

It seems you are using weighted least squares and categorical dependent variables. Thresholds not means are estimated for categorical variables.

The sample statistics for model estimation with a conditional model and weighted least squaresand categorical dependent variables are thresholds, probit regression coefficients, and residual correlations.
 Stefanie Köhler posted on Sunday, June 26, 2011 - 12:35 am
Dear Linda, thank you so much for your quick answer.
But, if I'm using ESTIMATOR=ML and the BOOTSRAP command, than the following shows up:
ERROR in ANALYSIS command BOOTSTRAP is not allowed with ALGORITHM=INTEGRATION.

So I do know that you can find in the manual that the BOOTSTRAP command is available for ML, but the analysis does not run.

And yes I can find thresholds in the output, but there is also a table with the headline "means" and another one with "slopes". Thats quite confusing.

Did I miss something?

Best wishes, Steph
 Linda K. Muthen posted on Sunday, June 26, 2011 - 6:34 am
If you model requires numerical integration, then you can't use the BOOTSTRAP option.

The slopes are the probit regression coefficients I referred to in the earlier answer.
 Stefanie Köhler posted on Sunday, June 26, 2011 - 10:02 am

Just checking: With the model desribed earlier
1. I can do bootstrapping if I use WLSMV, but I cannot when I want to use ML.
2. And when I use WLSMV I get slopes which are the probit regression coefficients.
3.The table with the headline "means" at the beginning I do ignore.
4.Can I do something about the numerical integration so that I would be able to use the BOOTSTRAP option?

Have a nice evening.
 Linda K. Muthen posted on Sunday, June 26, 2011 - 10:15 am
1. Not if your model requires numerical integration which it seems to.
2. Yes.
3. I would have to see the output to know the context of the heading.
4. No.
 Stefanie Köhler posted on Sunday, June 26, 2011 - 11:05 pm
Good Morning,

Would you have a look at the output? It would be great!
Otherwise thanks for the answers you've gave me!
 Stefanie Köhler posted on Monday, June 27, 2011 - 12:09 am
Oh no, I think I got it - so forget the question above. Sorry.

Thanks for your patience.
Have a good day.
 Marion posted on Monday, July 04, 2011 - 4:00 am
Dear Mrs. Muthen, I've got a mediation model with a moderation as well (the path from X to M is moderated). If the interaction X * Moderator is significant, how could I test/analyse +/- 1 SD and M=0 in Mplus (version 6) with my data. Or do I have to use another program for that (e.g. SPSS)?

 Bengt O. Muthen posted on Monday, July 04, 2011 - 6:28 pm
You use the estimated parameter values to compute the effect of X on M for the different values of the Moderator (say Z) that you choose (such as +-1 SD and the mean of Z). So you have

M = b1*X + b2*Z + b3*X*Z + e

or written as a Z moderation of the X effect:

M = (b1 + b3*Z)*X + b2* Z + e,

where b3*Z is the moderating effect. So you can compute this by hand given the estimates.
 Marion posted on Tuesday, July 05, 2011 - 1:44 am

So, did I get it right:

1. It's not clever to use a standardized Moderator, because interpretation would be difficult.
2. So I just use the mean and +-1 SD from the Moderator.
3. If the slopes are different at different levels of the Moderator, than the interaction/moderation is significant.
4. The mean and the SD I could get with, lets say, SPSS. (because Mplus just gives means, or is Est/S.E. = SD?)
5. But I don't really know how to calculate it using Mplus and than plotting it.
Do I have to use the DEFINE command and translate the formulas above into Mplus language?
6. I've already defined the interaction X*Z, to see if its significant. But I don't really know how to define the formulas above. Do I have to do that anyway?

I've got the feeling that I'm missing something thats quite obvious, but I don't hit on it.

Hopefully you will help me once more.
 Marion posted on Tuesday, July 05, 2011 - 2:18 am
I've got an idea - would that be working:

DEFINE:

XZ = X * Z; !interaction
Z=4,81; !its the mean

(or Z=4,81-3,482 !one SD below
or Z=4,81+3,482 !one SD above the mean)

And than I could plot it, could I?

PLOT: TYPE = PLOT3;

 Bengt O. Muthen posted on Tuesday, July 05, 2011 - 9:18 am
You should center Z to make interpretations easier - see the centering command.

SD for Z is the square root of the sample variance of Z which you get out of a Type=Basic run.

Mplus does not plot interactions.
 Marion posted on Tuesday, July 05, 2011 - 9:30 am
Alright, sorry for all the confusion. After I've tried differnt things I guess I figuered it out.
The plan with the DEFINE command didn't work.
So I've centered my moderator at its mean in SPSS calculating a new variable. After that I've calculated two other variables: Moderator Z (centered) minus 1 SD and Z + 1 SD. (I guess you meant that with calculating it by hand...)
Now I think I can run 3 further analysis with Mplus using these new variables.
Lets say the interaction X*Z(mean centered) isn't significant - would it be sensible to test for +/- 1 SD?

Thank you very much.
 Bengt O. Muthen posted on Wednesday, July 06, 2011 - 7:23 am
No, you don't run it with new variables. I suggest that you read the MacKinnon book Statistical Mediation Analysis.
 Marion posted on Saturday, July 23, 2011 - 8:52 am
Hi,I'm running a Mediation analysis including a moderation,too.In the model I've got 2 groups.Sometimes,I'm getting following message:
GROUP 2:WARNING: THE SAMPLE CORRELATION OF PDAUER_3 AND E_2003 IS -1.000 DUE TO ONE OR MORE ZERO CELLS IN THEIR BIVARIATE TABLE.INFORMATION FROM THESE VARIABLES CAN BE USED TO CREATE ONE NEW VARIABLE.

Could you please tell me what it means? Can I ignore it?
If I don't split my sample in 2 groups the warning doesn't show up.

And then I've got another problem with my groups:if I use

VARIABLE: GROUPING IS PS_1995(1=.., 3=...)
GROUPING IS K_vorh95(0=No 1=Yes);

then 1)my ESTIMATES are identical for both groups:
K_VORH95 ON
K_SINN 0.263
E_1995 -0.206
K_SINN ON
E_1995 0.020
PDAUER_1 0.020
P_PD 0.020

2)variable X is the same like the interaction XZ.
3)But if I'm doing two analysis - in each just the people from one group in the data set, then the estimates are very differnt between groups.

Is that possible?
 Bengt O. Muthen posted on Saturday, July 23, 2011 - 10:09 am
The zero cell warning says that you don't have a large enough sample (relative to the rareness of the event) to determine this correlation - ignoring this might lead to distorted results, although it is not clear how much distortion occurs if only one correlation out of many is so affected.

Only one grouping variable is allowed. If you have two, you will have to use DEFINE to create a single grouping variable which combines the two.
 Marion posted on Saturday, July 23, 2011 - 10:39 am
I've just one more question because of the DEFINE command. If I'm allowed just to have one GROUPING variable, its not that easy for me to combine them, because Mplus wants grouping values in the variable command, but which shall I choose, because I've got four?
Can I actually use the & in the DEFINE command? Could I do it something like that with PK_95 as my new variable?

DEFINE: PK_95 = PS_1995(1=married, 3=single) & GROUPING IS K_vorh95(0=No 1=Yes);

VARIABLE: GROUPING IS PS_K_95 (?,?);

I'm hopeing so much you'll help me on this. Best wishes.
 Marion posted on Saturday, July 23, 2011 - 10:57 am
Sorry, of course without GROUPING IS in the DEFINE command...
 Bengt O. Muthen posted on Saturday, July 23, 2011 - 10:58 am
Say that you have grouping variables a and b, both of which have values 0 and 1. Then you create a new grouping variable that combines the two by writing:

Grouping = combine(0=lowlow 1=lowhigh 2=highlow 3=highhigh);

Define:
if(a eq 0 and b eq 0)then combine=0;
if(a eq 0 and b eq 1)then combine=1;
if(a eq 1 and b eq 0)then combine=2;
if(a eq 1 and b eq 1)then combine=3;
 Rebeca  posted on Wednesday, November 30, 2011 - 7:26 am
Good morning.
I'm new to MPLUS and am attemptin to re-run a logistic regression analyses using a categorical moderating variable and am having trouble finding any previous posts that are relevant to both the log reg and the categorical moderating variable, so I hope you can help.

I am interested in looking at how a categorical variable x3 (gender) moderates the relationship between continous Time 1 variables x1 and x2 in predicting Time 2 categorical outcome variable y1. I should mention that I am running this in MPLUS rather than SPSS because I have attrition in the dataset and want to run the analyses with estimated data (estimator=ml?) Similar to log reg and mod in SPSS, it seems as though I have to center the conitnous variables and I am currently running the following model:

VARIABLE:
NAMES ARE x3 y1 x1 x2;
USEVARIABLES ARE x3 y1 x1 x2 x12 x21;
CENTERING= grandmean (x1 x2);
Categorical IS y1;
Define: x12=x3*x1;
x21=x3*x2;
ANALYSIS:
ESTIMATOR IS ML;

Model:
y1 ON x3 x1 x2 x12 x21;

Does this look appriate for the question I am trying to answer? Thank you!
 Bengt O. Muthen posted on Wednesday, November 30, 2011 - 5:15 pm
This looks fine, except that the centering command does not operate the way you probably expect. I assume that you want to center x1 and x2 before they get multiplied by x3 in Define. But centering is actually done after Define is done. So what you should do is to delete the centering and instead use Define to subtract the sample mean, for instance

Define: x12 = x3*(x1-3);
 Rebeca  posted on Friday, December 02, 2011 - 11:54 am
Hello again,

Thank you for your help. Under the advisement of my SEM professor, I ended up running the syntax with two categorical variables (1 for the categorical outcome y1 and the other being x3 which is gender). While the syntax seemed to run with no warnings, the output states that the model was run with 2 dependent variables.However, under the model results, it appears to have still run x3 (moderator) on y1 (outcome). My question is whether it is acceptable that the output say number of dependent variable:2, number of independent variables:4, when it is actually 1 outcome variable and 5 independent variables. Thanks again for your help.
 Linda K. Muthen posted on Friday, December 02, 2011 - 11:59 am
Please send the output and your license number to support@statmodel.com.
 H. R. posted on Monday, January 23, 2012 - 7:34 am
I have observed ordinal variables that I would like to investigate within an observed path model:

2 independent variables (ordinal)
3 mediators (ordinal)
2 dependent variables (ordinal)

I would like to create a moderation where one IV2 moderates the relationship between another IV1 and a dependent variable DV. Both IVs have 5 categories. Would it be sufficient to code

CATEGORICAL: DV;

DV on IV1 IV2 IV1*IV2;

Or does MPLUS require more product terms to model the moderation between categorical variables? I. E. would I have to introduce separate product terms for every value combination:

DV on IV1 IV2 IV1_VAL1*IV2_VAL1 IV1_VAL2* IV_VAL1...;

Many thanks for your help.
 Linda K. Muthen posted on Wednesday, January 25, 2012 - 12:01 pm
DV on IV1 IV2 IV1*IV2;

is correct.
 H. R. posted on Wednesday, January 25, 2012 - 12:04 pm
Thanks a lot, Linda.
 Lina Sapokaite posted on Thursday, January 26, 2012 - 11:52 am
I'd like to test a mediation model with all dichotomous variables (outcome, predictor, mediator, covariates). I have a large sample size (over 5,000), however, the outcome of interest is only 3% of the sample. Other variables (mediator, covariates) also have rather unequal variable proportions (e.g. 15%=1, 85%=0). Will this present any problems in the analyses?
Also, does mplus allow to control for clustering in the mediation analyses?
Thanks a lot!
 Bengt O. Muthen posted on Thursday, January 26, 2012 - 12:45 pm
This modeling is covered in

Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus. Submitted for publication.

which you find on our web site under Papers, Mediational Modeling.

See the Pearl example, which also presents a simulation - this is the only way to answer your question about sample size and prevalence.

Mplus can take into account clustering - see Chapter 9 of the User's Guide.
 Jane Robertson posted on Thursday, February 09, 2012 - 7:45 am
Hello,

I am trying to test a mediation model with 2 continuous exogenous variables (PreSE & PreKnow), 1 dichotomous exogenous variable (Instr), and 2 continuous endogenous variables (PostSE & PostKnow). I also want to include an interaction (moderator) term that is the product of PreSE & Instr. I used the following code:

DEFINE: CLPreSE = Instr*PreSE;
VARIABLE: NAMES ARE PreSE PreKnow Instr PostSE PostKnow;
USEVARIABLES ARE PreSE PreKnow Instr PostSE PostKnow CLPreSE;
ANALYSIS: ESTIMATOR=MLR;
MODEL: PostKnow ON PostSE PreKnow PreSE Instr;
PostSE ON PreKnow PreSE Instr CLPreSE;
MODEL INDIRECT: PostKnow VIA PostSE PreSE;
PostKnow VIA PostSE PreKnow;
PostKnow VIA PostSE Instr;

The STDYX estimate for PostSE on Instr is 1.694 and for PostSE on the interaction term is -1.987. I cannot figure out why these values are so far from 1 and -1 and if I need to change something in my code. Thanks for your help!
 Linda K. Muthen posted on Friday, February 10, 2012 - 10:11 am
This could be due to multicollinearity. Subtract the means of instr and prese from each value using DEFINE.
 CEKIC Sezen posted on Tuesday, February 28, 2012 - 4:42 am
Hello,

I would like to know how it's possible to get a graph like the one on the p.445 of the v6 user guide.
I mean: a graph of the probability to fall in each of the categories of the dependant variable given the value of the independant variable on the x axis.

My dependant variable is categorical with 5 categories and my independant variable is continuous.

I already got the results of the mediation analysis.

Thank you very much!
 Bengt O. Muthen posted on Wednesday, February 29, 2012 - 8:55 am
That graph is available in Mplus for regression of a latent class variable on covariates. It is not available for a nominal observed DV.
 Karen S. Mitchell posted on Tuesday, May 22, 2012 - 12:54 pm
Hello,

I am attempting to run a model with a categorical IV, mediator, and DV. I have read Bengt's article mentioned earlier in this thread and have some questions. Ideally, I would like to be able to bootstrap to obtain confidence intervals for the indirect effect, or to use the BAYES estimator, as this method can handle non-normally distributed parameters. However, it doesn't seem like there is a way to do either of these things for LINK=LOGIT. My outcome is a rare variable, so as far as I know, I shouldn't use PROBIT, which is the only link function available for ESTIMATOR=BAYES or for WLSMV. Is my only option to use ESTIMATOR=ML and to compute the significance of the indirect effect using Model Constraint? If so, how is the significance of the indirect effect calculated?
 Bengt O. Muthen posted on Tuesday, May 22, 2012 - 5:42 pm
You can use probit also for rare outcomes when you use the general formula given in the paper (it is the simplified logit expression that can only be used for rare cases). So you can use Bayes. See the Pearl example.
 Karen S. Mitchell posted on Wednesday, May 23, 2012 - 12:18 pm
I forgot to mention that I also would like to use sample weights, which isn't possible with ESTIMATOR=BAYES. Will I obtain correct estimates if I use the formula with WLSMV and bootstrapping?
 Bengt O. Muthen posted on Thursday, May 24, 2012 - 11:02 am
Yes.
 Petek Demirer posted on Friday, July 20, 2012 - 6:21 am
Hello,I have a question about interpreting the outputs,sorry if this sounds too basic.I keep finding different conclusions with regard to the relationships among my variables,from looking at p-values and estimates vs. confidence intervals (e.g. while total indirect effect seems significant when I look at CI's,it seems insignificant when I check p-values). I'm running the analyses with bootstrapping,asking for standardized estimates and CI's.Which indicator should be prioritized in drawing conclusions?
 Linda K. Muthen posted on Friday, July 20, 2012 - 10:45 am
The p-values and confidence intervals will agree if the confidence intervals are symmetric. BOOTSTRAP and BCBOOTSTRAP confidence intervals are not symmetric.
 Petek Demirer posted on Sunday, July 22, 2012 - 4:20 am
Thanks.But when analysis=bootstrap was not defined,CI (BCBOOTSTRAP) command was not executed anyways.When I wrote CI (BOOTSTRAP) -which is probably not correct to do- values did not agree either.I couldn't fix the problem.
 Linda K. Muthen posted on Sunday, July 22, 2012 - 6:39 am
Please send the output and your license number to support@statmodel.com. ANALYSIS=BOOTSTRAP is not in the Mplus language so I don't know what you mean by it was not defined.
 Francisca Galindo Garre posted on Monday, August 27, 2012 - 6:54 am
Hi,

I would like to perform a mediation analysis with a categorical (ordinal) independent variable with 3 categories. In the paper by Hayes and Preacher under revision they propose a method to compute relative indirect and direct effects for each category (k-1) of the independent variable.

My question is: Could I define a latent variable for a ordinal independent variable?

CATEGORICAL: education;

MODEL:

f by education;
f@1;

y ON f;

If this code is correct, I will have less parameters.

Thank you very much for your answer.

Best regards,

Francisca Galindo
 Linda K. Muthen posted on Monday, August 27, 2012 - 5:08 pm
If the covariate is ordinal just say y on education. This is no different from putting a factor behind the covariate.
 Francisca Galindo Garre posted on Thursday, August 30, 2012 - 3:58 am
ok, thank you very much.
 Ciara Wynne posted on Monday, October 29, 2012 - 6:06 pm
Hi

I am carrying out moderated mediation using Preacher et al (2007) Model 1 mplus syntax. I have confirmed complete mediation in a simple mediation model. X is continuous (standardised scores from -3 to 3), Med is dichotomous, Y is continuous and Mod is the X variable (i.e. elevated levels of x). I am new to MPlus and when I ran the syntax, instead of giving me B, SEs, P and BC CI for the indirect effect, the output gave me "starting values". I inserted all of these to see what would happen and I received error message saying

"*** ERROR A1*(B1+B2*XMODVALHIGH*1)"

Can you please advise me what to do next. Thanks.
 Linda K. Muthen posted on Monday, October 29, 2012 - 6:41 pm
Please send the output and your license number to support@statmodel.com.
 Leslie Roos posted on Thursday, January 17, 2013 - 2:30 pm
Hello!

After receiving a revise/resubmit with more stringent statistics of mediation than Baron & Kenny, it has been suggested that I use Mplus Path modelling to determine our mediation. I have some familiarity with your program but would truly value your advice on this problem as there seem to be many important considerations!

I am attempting to determine this mediation model with a categorical (yes/no) DV, categorical (yes/no) IV, and a categorical (yes/no) mediator. However, this model is somewhat more complex as we have a number of endogenous covariate variables which are continuous (income, age, education); binary (sex); and categorical (3L marital, 5L ethnicity). Additionally I am using a complex sampling design with clusters and weights.

My questions are
1) how to model both the mediation (with MODEL INDIRECT?)
2) how to create the categorical covariates (do I need a latent variable here from dummy codes?)
3) on what variables the covariate should be regressed.

Thank you in advance!

Leslie
 Leslie Roos posted on Thursday, January 17, 2013 - 2:35 pm
Hello!

After receiving a revise/resubmit with more stringent statistics of mediation than Baron & Kenny, it has been suggested that I use Mplus Path modelling to determine our mediation. I have some familiarity with your program but would truly value your advice on this problem as there seem to be many important considerations!

I am attempting to determine this mediation model with a categorical (yes/no) DV, categorical (yes/no) IV, and a categorical (yes/no) mediator. However, this model is somewhat more complex as we have a number of endogenous covariate variables which are continuous (income, age, education); binary (sex); and categorical (3L marital, 5L ethnicity). Additionally I am using a complex sampling design with clusters and weights.

My questions are
1) how to model both the mediation (with MODEL INDIRECT?)
2) how to create the categorical covariates (do I need a latent variable here from dummy codes?)
3) on what variables the covariate should be regressed.

Thank you in advance!

Leslie
 Bengt O. Muthen posted on Thursday, January 17, 2013 - 5:33 pm
1) You should read

Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus.

which is on our website under Papers, Mediational Modeling.

2) You have to create them before analysis, say by DEFINE or outside Mplus.

3) All DVs.
 Leslie Roos posted on Monday, January 21, 2013 - 9:28 am
Hello,

Thank you, as always for your excellent advice! A couple follow-up questions:

1) Having read the article you suggest, I was unclear exactly how the combination of ordinal, continuous, and nominal covariates should be included within the mediational model?

2) I will definitely create this before analysis -- (a) am I correct that I will need to create a latent variable for each of the nominal covariates? (b) would you have a reference or chapter for advice on this

(3) Thank you! If we hypothesize the covariates to also potentially relate to the mediator variable, would it be advised to include these paths, or as they are not of interest (and not discussed in the manuscript) we could leave them out?

Best
Leslie
 Bengt O. Muthen posted on Monday, January 21, 2013 - 8:20 pm
1) The covariate scale is not critical. All covariates are treated as continuous by Mplus. So for a nominal vble you create a series of binary variables.

2) See above for nominal covariate handling. No latent variable is needed. Regression books would have this described.

3) The covariates would typically influence all DVs, which includes the mediators and the ultimate (distal) outcomes.

Because your questions are about basic statistics, you may want to seek statistical consultation with your campus support group to get more detailed help.
 Yao Wen posted on Saturday, May 11, 2013 - 6:08 pm
Hello Linda,

I am working on a project using the mediation model in which x is categorical, m and y are continuous. I used MLR estimator with the consideration of categorical variables in the model. However, I have problems to interpret the coefficient between x and y or x and m. Do you have any suggestions? Should I dummy code x?

Thanks!
 Linda K. Muthen posted on Sunday, May 12, 2013 - 6:32 am
If x is an unordered categorical variable, you must create a set of dummy variables. If it is an ordered categorical variable, you can create a set of dummy variables or treat it as a continuous variable.
 Dianna "Annie" Murray-Close posted on Thursday, August 01, 2013 - 12:30 pm
Dear Dr. Muthen,

I am running a path analysis with 2 manifest continuous variables (main effects) and their interaction (calculated using the DEFINE feature). I am also testing whether the interaction varies across gender, so I am conducting multiple group analyses by gender. Nested model comparisons indicate that the main effects do not vary across gender, but the interaction does. A reviewer has asked whether it is appropriate to constrain the main effects to be equal across gender and then allow the interaction effect to vary across gender. They have suggested that if the interaction is freely estimated across groups, the main effects should be freely estimated across groups as well. I wasn't sure which approach is more appropriate (i.e., constraining main effects across gender and allowing the interaction to vary across gender versus freely estimating all three paths), and was wondering if you have any suggestions.

Thank you so much for your assistance.

Regards,
Annie
 Bengt O. Muthen posted on Thursday, August 01, 2013 - 2:14 pm
The mantra is that you should not interpret main effects when there is a signficant interaction. If the interaction varies over groups, the main effects have different meanings over groups and should not be held equal.
 Dianna "Annie" Murray-Close posted on Thursday, August 01, 2013 - 3:36 pm
Thank you!

Annie
 Emily Rosenzweig posted on Monday, September 16, 2013 - 9:06 am
Hello --

I am looking to test a simple mediation model (all three variables are measured and continuous), but have within-subjects data, such that I need to include a random intercept for subject ID in my model. As someone totally new to mPlus, I don't know which version of mPlus I would need (do I need the mixture add-on? the multilevel add-on?), and I also was hoping someone might be able to point me towards the syntax I would use to add in this random effect to the MODEL INDIRECT code I see in places above?

Many many thanks,
Emily
 Linda K. Muthen posted on Monday, September 16, 2013 - 4:09 pm
How is the nesting of the data? Is it repeated measures of the same variable across time or students nested in classrooms?
 Emily Rosenzweig posted on Monday, September 16, 2013 - 5:58 pm
It is repeated measures data...
 Linda K. Muthen posted on Monday, September 16, 2013 - 6:05 pm
Then you can get just the Base program and run your growth models in the wide multivariate format. See the introduction in Chapter 6 for more information.
 Yellowdog posted on Thursday, February 13, 2014 - 7:04 am
Dear Linda,

I would like to run a mediated path model with a binary DV and IV and three continuous mediator variables controlled for age. Furthermore, I would like to compare these associations between males and females using the GROUPING command. How do I have to proceed to test for differences between groups? Do you have any examples how to specify the necessary models step by step?

Thanks for your assistance;
M

My model is:

model:
m1 on x
age ;
m2 on x
age ;
m3 on x
age ;

y on x
m1
m2
m3
age ;

model males:
m1 on x
age ;
m2 on x
age ;
m3 on x
age ;

y on x
m1
m2
m3
age ;

MODEL INDIRECT:

y IND m1 x;
y IND m2 x;
y IND m3 x;
 Linda K. Muthen posted on Friday, February 14, 2014 - 11:29 am
If you use the GROUPING option, I believe you will get the indirect effects specified in MODEL INDIRECT for each group. Try it.
 Yellowdog posted on Tuesday, February 18, 2014 - 4:47 am
Dear Linda,
Thank you for your reply. I already got these effects but how can I test for differences between groups?
As far as I know I have to set equality constraints on all parameters (coefs, means, intercepts) across groups, which were relaxed stepwise by a specific algorithm, right?
Is this procedure described somewhere along with the corresponding MPlus commands?

Thank you,
Mario
 Linda K. Muthen posted on Tuesday, February 18, 2014 - 6:22 am
You would need to use MODEL CONSTRAINT, for example,

MODEL:
y ON m;
m ON x;

MODEL male:
y ON m (m1);
m ON x (m2);

MODEL female:
y ON m (f1);
m ON x (f2);

MODEL CONSTRAINT:
NEW (m f diff);
m = m1*m2;
f = f1*f2;
diff = m - f;
 Yellowdog posted on Thursday, February 20, 2014 - 3:18 am
Dear Linda,

Thank you for your suggestions. I tried it and got some of these differences being significant. Can I simply interpret these paths being different across groups? Can you recommend any article using (and reporting) this method the same way? I am not certain to be on the right track.

Thanks, Mario
 Linda K. Muthen posted on Thursday, February 20, 2014 - 10:16 am
Yes, these are different across groups. This is a standard test. I don't know of a paper offhand. Perhaps you should ask on a general discussion forum like SEMNET.
 Shifeng LI posted on Tuesday, April 22, 2014 - 11:14 pm
Hello --
I'm new to MPLUS and am interested in looking at how a categorical variable x3 (group) moderates the relationship between continous variables x1 x2 and x3 in predicting continous outcome variable y1. What approach do I use to test it? References will also help. Help please!
 Linda K. Muthen posted on Wednesday, April 23, 2014 - 10:49 am
The best way to do this is to use x3 as a grouping variable in a multiple group analysis. Another option is to create two dummy variables from x3 and create interaction variables between the dummy variable and other variables.
 Lindsay Nicolai posted on Friday, July 11, 2014 - 3:58 pm
Hello. I have three continuous latent variables and I am looking to run a test of mediation. I would like to see if F2 mediates the relationship between F1 and F3. I used MODEL INDIRECT: F3 IND F2 but my output does not report a Specific Indirect effect. Also, the output values for the Total Indirect effect are 0.000 for the estimate and 999 for the Est/SE. Any advice would be appreciated. Thank you!
 Bengt O. Muthen posted on Friday, July 11, 2014 - 4:53 pm
You should say

F3 IND F2 F1;
 db40 posted on Sunday, August 10, 2014 - 5:32 am
Dear Dr.Muthen,

Can I just query, that if I total effect that is non-significant and a direct effect that is also non-significant but significant indirect effect, what is this? partial or nothing?
 Bengt O. Muthen posted on Sunday, August 10, 2014 - 1:31 pm
You then have a fully mediated effect.

You may want to ask these general modeling questions on SEMNET.
 Yilma Wolgabreal posted on Tuesday, October 07, 2014 - 12:15 am
Dear All
Please help. I'm trying to estimate the following mediation model. It runs fine, but when I change the direction of relationship (the latent mediator as predictor), the error message below appears:

THE STANDARD ERRORS OF THE MODEL PARAMETER ESTIMATES COULD NOT BE COMPUTED. THE MODEL MAY NOT BE IDENTIFIED.CHECK YOUR MODEL.
PROBLEM INVOLVING THE FOLLOWING PARAMETER:
Parameter 16, BREACH ON ORNIR
THE CONDITION NUMBER IS 0.660D-12.

Usevariables Are ORNIR AAQ GSE LOTR SHS breach;

Categorical IS breach;

ANALYSIS: PARAMETERIZATION=THETA; !Type=MEANSTRUCTURE;

! BOOTSTRAP = 2000;

MODEL: PPS By AAQ GSE LOTR SHS;

PPS ON ORNIR;
breach ON ORNIR PPS;

AAQ With GSE@.561 LOTR@.548 SHS@.565;
GSE With LOTR@.668 SHS@.824;
LOTR With SHS@.731;
breach@1;

MODEL INDIRECT:
breach IND ORNIR;
OUTPUT:
sampstat STDYX; standardized;
! cinterval (bcbootstrap);
 Bengt O. Muthen posted on Tuesday, October 07, 2014 - 10:33 am
Send output and license number to Support so we can diagnose this.
 Alex Mommert posted on Friday, January 30, 2015 - 2:22 am
Hi! I am interested in a moderated mediation where 'mod' moderates the b-path and the outcome (y) is ordinally scaled. Especially I am interested in the indirect effects on the levels of the (dichotomous) moderator.

Here's the relvant bit of syntax:

MODEL:
med on x (a1);
y on med (b1)
mod (b2)
modXmed (b3);
MODEL CONSTRAINT:
NEW(ind1 ind2 modval1 modval2);
modval1 = -1;
modval2 = 1;
ind1=a1*(b1+b3*modval1);
ind2=a1*(b1+b3*modval2);

The problem I have now is that the results for the indirect effects seem to depend on the coding of the moderator. If I use -1 and 1 for coding in the data and in the syntax results seem good but they change when I use 0 and 1 instead.

So, which values should I use?

Tanks a lot in advance for your help, Alex
 Bengt O. Muthen posted on Friday, January 30, 2015 - 1:58 pm
Please send input, output, data, and license number to Support.
 Eric Thibodeau posted on Tuesday, February 17, 2015 - 8:18 am
Hi,

I've heard that you should not interpret or report STDYX estimates for interaction terms. Is this true? Thanks.

Eric
 Bengt O. Muthen posted on Tuesday, February 17, 2015 - 8:53 am
Yes; see the Aiken-West regression interaction book.
 Nadine Forget-Dubois posted on Monday, September 28, 2015 - 12:50 pm
Dear Drs Muthen,
We are doing moderated mediation analyses within longitudinal design using Mplus 7.3. Our mediator (M), moderator (Z) and outcome (Y) are binary variables while the independent variable (X) is continuous.
We would like to use the MOD statement in INDIRECT MODEL command (as specified in Muthén & Asparouhov, 2015) : Y MOD M (m0 m1) Z MZ XZ X (0 10 1) and we have some questions related to this:

A. Is it possible to use the MOD statement with a dichotomous mediator and a dichotomous outcome as such or do we need to modify the statement?

B. We do GENERAL COMPLEX analysis and, by consequence, we use the MLR estimator. In this case, using the MOD command and treating the mediator and the outcome as observed variables in MODEL command, do we obtain probit or logit regression coefficients?

C. Does the indirect effect concern the underlying continuous latent response variables or the observed binary variables?

Your insight would be very helpful and much appreciated, thank you in advance.
 Bengt O. Muthen posted on Monday, September 28, 2015 - 1:34 pm
A. Yes. But the MOD statement you give is not right. M does not have anything in parenthesis (unless you want a control direct effect), Z has 3 arguments in parenthesis, and X has only 2 arguments.
See UG Addendum for 7.2.

B. You can do both. Use link=probit or logit.

C Both are shown. But I would rely on the effects in probability metric given by the counterfactual definitions.
 Raghav Ramachandran posted on Monday, September 28, 2015 - 3:40 pm
Drs. Muthen,

Is it possible to program the following mediation model in MPlus: x1--> y1--> c1 where c1 is a latent categorical (latent class) variable? c1 via y1 x1 (under the model indirect command) results in the following error:
"unknown variable in via statement: c1"
x1 and y1 are observed continuous measures.

If such a model is not possible, could I use the 3-step approach to create a nominal variable representing most likely class membership, and then replace c1 with this nominal variable in my model? Thanks for your help.

Thanks,
Raghav
 Bengt O. Muthen posted on Monday, September 28, 2015 - 6:37 pm
See my answer yesterday to Daniel Beale.
 Gouri Shankar Mishra posted on Sunday, October 04, 2015 - 11:19 pm
Hello - In my path model, both mediator (M) and the outcome (Y) variables are ordered categorical variables (ordered probit model). In addition to M and Y, I have a third endogenous variable D (0/1) representing treatment membership.

I am trying to compute and compare the probability of belonging to a particular category of Y for treated and untreated groups at mean values of X. I guess the complexity is to estimate probabilities that reflect "total" effects and not just the "direct" effects.

Will you be able to point me to literature that can help me do the above?

Thanks
 Gouri Shankar Mishra posted on Monday, October 05, 2015 - 10:24 am
I think it might help if I add some more details to my question above on October 5th.
I have the following three equations

D = f(X1)
M = g(X2, D)
Y = h(X3, M, D)

where D is Program Membership indicator
M is mediator (Vehicle Holdings)
Y is outcome (Transit Usage)
M and Y are ordered categorical variables. D is dichotomous.
X1, X2 and X3 are covariates

I am interest in the effect of D on Y. I want to calculate the probabilities of falling in a particular category of Y when D=1 and when D=0.

Thanks
 Bengt O. Muthen posted on Monday, October 05, 2015 - 6:14 pm
If you assume that M can be represented by an underlying continuous latent response variable M* linearly related to D and Y you can express the probability of Y as a function of D and X3 (no need to bring in X1, X2). You can estimate using weighted least-squares or Bayes.

Here is an early article of this kind:

Xie, Y. (1989). Structural equation mode
ls for ordinal variables. Sociological
Methods & Research, 17, 325-352.
 liuxu posted on Thursday, September 08, 2016 - 4:21 am
Dear Prof. Muthen,

Thank you so much for taking the time to look at my model.

I am running a moderated mediation model with two hypothesized moderators (E & F) and 5 moderated paths among the basic mediation model using Mplus 7.0: M mediate the relationship between X and Y;E would not only moderate the relationship between X and M (a) but also between X and Y (b), and F would play as moderator in three paths, including the relationship between X and M (c), the relationship between M and Y (e), and the relationship between X and Y (d).

I wonder to know weather Mplus 7.0 could only test two latent variable interactions in the model simultaneously£¿If so, is it reasonable to test a E interaction path (a & b) and a F interaction path (c, d & e), 6 models (2 ¡Á 3, i.e., a & c, a & d, a & e, b & c, b & d, b & e) while we considered two moderators simultaneously£¿

Thank you so much for your assistance.

Regards,
Liuxu
 Bengt O. Muthen posted on Thursday, September 08, 2016 - 1:31 pm
Mplus can do several XWITHs in the same model. I would recommend exploring one at a time, however.
 liuxu posted on Sunday, September 11, 2016 - 8:19 pm
Dear Prof. Muthen,

Actually, I have to consider two moderators in the same model according to the theoretical hypothesis. But the model with all of the five XWITHs can not run. Indeed, not all 6 model mentioned above (2 ¡Á 3, i.e., a & c, a & d, a & e, b & c, b & d, b & e) run normally. Although several model do run, they stopped suddenly with no hints and no results. Only when path ¡°a¡± and path ¡°e¡± were added into the basic mediation model, the moderated mediation model estimation terminated normally and the model fit the data well (AIC = 14639.05, BIC = 14865.72, Adjusted BIC = 14681.71, and the number of free Parameters is 58).

May I report this results? Or, what should I do next?

Thanks with all my heart.

Regards,
liuxu
 Bengt O. Muthen posted on Monday, September 12, 2016 - 9:30 am
If you have a problematic run that you are particularly interested in resolving, please send your input, output, and data to Support along with your license number.
 Melissa Jaime Huey posted on Tuesday, September 13, 2016 - 9:36 am
Hello Drs. Muthen,

I am running a three wave longitudinal mediation model and I am curious if I am running it correctly. The model fit needs to be improved, and I am not sure what I am missing in my model. Could you advise as to whether this model is correct? I have parenting (IV) at 3 time points, self-esteem (M) at 3 times points, and peer influence (DV) as 2 time points (time 2 and time 3).

Thanks for all your help.
Melissa

ANALYSIS:
Type = general;
estimator = ml;

DEFINE:

!Independent Variables

IV1= MpsychcontrolT1;
IV2= MpsychcontrolT2;
IV3= MpsychcontrolT3;

!Mediators

M1 = SelfesteemT1;
M2 = SelfesteemT2;
M3 = SelfesteemT3;

!Dependent Variables

DV2 = PeerSusceptT2;
DV3 = PeerSusceptT3;

MODEL:

!correlations

IV1 with M1;
IV2 with M2 DV2;
IV3 with M3 DV3;

!stabilities

IV3 on IV2;
IV2 on IV1;
M3 on M2;
M2 on M1;
DV3 on DV2;

M2 ON IV1 (path1);
DV3 ON M2 (path2);

MODEL Constraint:
new (overalleffect);
overalleffect = path1*path2;
 Bengt O. Muthen posted on Tuesday, September 13, 2016 - 11:13 am
You seem to have a hypothesis of a lag-1 effect of IV on M and of M on Y. But your setup looks strange to me - for instance, why doesn't IV2 influence M3? And why doesn't DV1 correlate with the other two time 1 variables. And why doesn't DV2 correlate with M2 and DV3 with M3?

You may want to ask this general analysis strategy question on SEMNET.
 Freya Glendinning posted on Sunday, October 02, 2016 - 8:49 am
Hello,

I have a 3 wave longitudinal data set with one IV one mediator and 4 DV's (all measured at 3 time points). I want to run a Bayesian cross-lagged mediation analysis. Could you point me to somewhere I could find a syntax or example that would help guide me in forming a syntax for this analysis?

Thank you very much,
Freya
 Bengt O. Muthen posted on Monday, October 03, 2016 - 6:52 am
There is no special difficulty - just use ON. Adding WITH for contemporaneous DVs.
 Anthony Coy posted on Friday, November 11, 2016 - 10:25 am
Hello,

I apologize if you've addressed this questions previously. I notice similar questions from 10 years ago, but I know the software has changed since then those posts.

I'm attempting to run a moderated mediation path model in which X and Y are continuous but M and V (in Hayes model 14) are nominal (M has 3 categories, V has 4). The code in short:

USEVARIABLES: x y m v mv;
DEFINE: mv = m*v;
MODEL: y ON x m v mv;
m ON x;

I've seen some posts suggesting that a categorical M can't be used, and others suggesting the use of a latent variable for M. Any clarification you can provide would be helpful.

Thanks!

Anthony
 Bengt O. Muthen posted on Friday, November 11, 2016 - 11:27 am
The case of a nominal mediator requires special computations that are described in Chapter 8 of our new book:

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

You have the Mplus script for this at

http://www.statmodel.com/mplusbook/chapter8.shtml

See 8.35.

The nominal V has to be broken up into binary dummy variables.
 Tjorven Blöbaum posted on Tuesday, January 31, 2017 - 3:49 am
Hi,

I have a mediation model with
-3 dummy variables as independent variables (0/1),
-1 continuous dependent variable
-4 continuous mediators

I want to estimate direct and indirect effects. My code looks as follows:

Emo BY Emo1 Emo2;
Br BY BI1 BI2;
Pr BY Pr1 Pr2 ;

!direct effects
DV ON Dum1 Dum2 Dum3 ;

!DV on mediators (b)
DV ON Emo Br Pr;

!mediators on IV (a)
Emo ON Dum1 Dum2 Dum3;
Br ON Dum1 Dum2 Dum3;
Pr ON Dum1 Dum2 Dum3;

!indirect effects (c)
MODEL INDIRECT:
DV IND Dum1;
DV IND Dum2;
DV IND Dum3;

If I now estimate individual models, only one independent variable at a time (for example only Dum1, excluding Dum2 and Dum 3), I don’t get the same estimates.

Can anyone help? Thank you!
 Linda K. Muthen posted on Tuesday, January 31, 2017 - 12:14 pm
When you have three independent variables, the regression coefficients are partial regression coefficients. With one at a time, they are not.
 Liz Novack posted on Monday, February 06, 2017 - 12:23 pm
I recently was given Mplus code that allowed me to run a multiple mediation analysis with sample weights. I am trying to find the statistical method that Mplus uses to run this code. Is it the Preacher and Hayes method? Any information would help, thank you!

MPLUS CODE
TITLE:
Multiple mediation with sample weights;

DATA:
FILE is [Enter pathway for data set here];
FORMAT is free;

VARIABLE:
MISSING ARE ALL [Enter missingness indicator for all variables in parentheses];
NAMES ARE [Enter exact order of the variables in your dataset];
USEVARIABLES ARE [Enter variables to be used in your analysis];
WEIGHT IS [Enter variable name for weight];
STRATIFICATION is [Enter variable name for strata];
CLUSTER is [Enter variable name for cluster];
SUBPOPULATION is [Enter the variable name for subpopulation followed by == and the value you want to include];

ANALYSIS:
TYPE = complex;

MODEL:
y ON m1 m2 m3 x;
m1 ON x;
m2 ON x;
m3 ON x;

MODEL INDIRECT:
y IND x;

OUTPUT:
STDY;
 Bengt O. Muthen posted on Monday, February 06, 2017 - 3:49 pm
This is done as described in

Asparouhov, T. (2005). Sampling weights in latent variable modeling. Structural Equation Modeling, 12, 411-434.
 Chung Chin Wu posted on Friday, April 21, 2017 - 3:57 am
Dear Muthen,
I have four exdogenous variables and one endogenous variable. I introduce LMS to test latent interaction and get significant results. Reviewer make comments as following: “please conduct simple effect test for the significant interaction. For the simple effect test on interaction between continuous predictors in multiple regression, you may refer to Aiken, L. S., West, S. G., & Reno, R. R. (1991). Multiple regression: Testing and interpreting interactions. Sage. Please note that SEM is an extension of multiple regression. All the tests that can be used in multiple regression also apply in SEM. Different sub-models of SEM can be used to test mean differences, correlation, regression, FAs and SEM full model etc. It can also be situated in multilevel contexts.”
My questions are: whether I should conduct simple effect tests of not? If the answer is yes or no, why? If the answer is yes, how to do tests?
 Bengt O. Muthen posted on Friday, April 21, 2017 - 5:48 pm
See our FAQs

Latent variable interactions

Latent variable interaction LOOP plot
 Timothy Allen posted on Friday, August 25, 2017 - 9:33 am
Hello,

I'm running a latent growth curve mediation model ( x predicts i and s, i and s in turn predict y). Bootstrapped CIs suggests that the indirect effect is significant whereas the direct effect is not.

However, when I run the model without the mediators, the direct effect is significant. I'm wondering what's happening and whether x and y are in fact directly related?
 Bengt O. Muthen posted on Friday, August 25, 2017 - 4:37 pm
When you see a significant direct effect, it appears in a model where the indirect effect is included. When you don't have the mediator you have a very different situation.
 ringel posted on Friday, April 27, 2018 - 10:36 am
Hi,

I want to test a within-level moderation at Level 1 with continuous predictor and moderator, and a dichotomous outcome. Can I use the same syntax as for a continuous dependent variable, except, of course, that I categorize the dependent variable as categorical? Or do I have to take a different approach?

My syntax (predictor X, moderator M, and their interaction XM all centered at the person mean; Y = dichotomous dependent variable):

usevariables = ID Y X M XM;
cluster = ID;
within = X M XM;
categorical = Y;
analysis: type = twolevel random;
model:
%WITHIN%
Y on X (a1);
Y on M;
Y on XM (w1);

Thanks!
 Bengt O. Muthen posted on Friday, April 27, 2018 - 1:51 pm
If all your variables are Within, you are not modeling between-level variation and then you don't need Type=Twolevel analysis. To get good SEs you can use Type=Complex.
 Ellen Houben posted on Thursday, July 12, 2018 - 1:15 pm
Dear dr. Muthén,

I don't really get what the problem is, I tried a simple (curvilinear) mediation. but I get this warning:

A mediating variable in an indirect effect statement cannot be an exogenous variable in the model. Problem with: AGE

Yet, as far as I know I did not code age as a mediator:

! AUR EFFECTS

ELOCIT2 on ELOCIT1;
ELOCLT2 on ELOCLT1;
PEET2 on PEET1;

! OV>M

ELOCiT1 ON AGE AGE2;
ELOCLT1 ON AGE AGE2;

! M>OV

PEET2 ON ELOCIT1 ELOCLT1;

! direct effects

PEET2 ON AGE AGE2;

model indirect:

PEET2 IND AGE AGE2;

could you help me?

kind regards!
 Bengt O. Muthen posted on Thursday, July 12, 2018 - 3:47 pm

model indirect:

PEET2 IND AGE AGE2;

implies that AGE is a mediator - see the V8 UG page 761.
 Roxanne Bizier-Lacroix posted on Monday, July 16, 2018 - 1:25 pm
Hi,

I want to test a mediation with a binary mediator, but it does not work...

The nature of my variables is:

dependent variable: continuous
Mediator: binary
independent variable : continous.

What can I do to be able to test this mediation?

Thanks!
 Bengt O. Muthen posted on Monday, July 16, 2018 - 5:30 pm
This is described in our Topic 11 Short Course video and handout on our website and also in our RMA book.

If that doesn't help, send your failed output to Support along with your license number.
 Javed Ashraf posted on Tuesday, July 17, 2018 - 6:47 am
I am bit worried about the computational time and the non-convergence regarding latent variables( categorical mainly binary) interactions in my model. Can somebody help or suggest what should I do reduce the computational time and make the data converge too. The sample size is 5255 and the missingness is not more than 10%.
The MPlus syntax is as follows:

USEVARIABLE ARE MP_TL MP_TR MP_ML MP_MR
TB_Freq DV_reasn DChk_frq LDV
S1_6mm S2_6mm S3_6mm S4_6mm S5_6mm S6_6mm
Mig_M;

CATEGORICAL ARE MP_TL MP_TR MP_ML MP_MR
Mig_M
TB_Freq DV_reasn DChk_frq LDV
S1_6mm S2_6mm S3_6mm S4_6mm S5_6mm S6_6mm;

MISSING ARE ALL(-999);

MODEL: mTMD BY MP_TL* MP_TR MP_ML MP_MR;
mTMD @1;
P6 BY S1_6mm* S2_6mm S3_6mm S4_6mm S5_6mm S6_6mm;
P6 @1;
OHB BY TB_Freq* DV_reasn DChk_frq LDV;
OHB @1;
Mig_M ON mTMD;
Mig_M ON OHB;
Mig_M ON P6;
mTMD ON OHB;
Mig_M ON XZ;
Mig_M ON XZ1;
P6 ON XZ;
P6 ON mTMD;
P6 ON OHB;

XZ|mTMD XWITH OHB;
XZ1|OHB XWITH P6;

ANALYSIS: TYPE=RANDOM;
INTEGRATION=MONTECARLO;
ESTIMATOR=MLR;
 Bengt O. Muthen posted on Wednesday, July 18, 2018 - 6:46 am
Take a look at the FAQ on our website:

TECH8 – negative ABS changes

If this doesn't help, send your output (and data) to Support along with your license number.
 Javed Ashraf posted on Friday, July 20, 2018 - 7:14 am
I wish to graph loop plots(slopes at different levels of moderator) my moderator is ordinal with 3 categories (Dent_Anx). The syntax below is not generating the graphs. Can you please guide where I am going wrong:
USEVARIABLE ARE MP_TL MP_TR MP_ML MP_MR
Dent_Anx
OHA_M;

CATEGORICAL ARE MP_TL MP_TR MP_ML MP_MR
OHA_M;

MISSING ARE ALL(-999);

MODEL: mTMD BY MP_TL* MP_TR MP_ML MP_MR;
mTMD @1;
OHA_M ON mTMD;
OHA_M ON Dent_Anx;
OHA_M ON XZ;
XZ|mTMD XWITH Dent_Anx;

MODEL CONSTRAINT:
PLOT(XZ)
LOOP (Dent_Anx,1 2 3);

PLOT: TYPE=PLOT2;

ANALYSIS: TYPE=RANDOM;
INTEGRATION= MONTECARLO;

OUTPUT: STDYX;
 Bengt O. Muthen posted on Friday, July 20, 2018 - 10:44 am
You are not defining what "XZ" is. You nedd to add

XZ = ...*Dent_Anx;

See the Loop plot for UG ex 3.18 at

http://www.statmodel.com/Mediation.shtml
 Javed Ashraf posted on Sunday, July 22, 2018 - 5:37 am
But in my opinion I have an interaction between a latent variable "(mTMD)" and a covariate "Dent_Anx"(moderator). Do I need to give the DEFINE command in this too.
I want to see the moderator effect at three levels of moderator. Moderator being an ordinal variable with 3 levels.
 Bengt O. Muthen posted on Sunday, July 22, 2018 - 2:19 pm
If the moderator (Dent_Anx) is ordinal with 3 categories, I would not use XWITH but instead do a 3-group analysis - which does not need Type=Random. You can then plot what you want using parameters for each group.
 Javed Ashraf posted on Sunday, July 22, 2018 - 4:16 pm
Can you please tell how will the modified syntax look like in My scenario. I am confused regarding the latent variable interaction with a covariate mòderator command and the plot type for a single diagram depicting all three levels of moderator.
Can you please guide me a bit more
 Bengt O. Muthen posted on Monday, July 23, 2018 - 10:00 am
The idea is that the latent variable interaction with a 3-category moderator gets replaced by a 3-group run where the interaction is seen in coefficients being allowed to vary across the 3 groups (that's what an interaction means after all).

Look at multiple-group examples in the User's Guide (you find it on our website) which also shows you examples of how to plot things using Model Constraint with the LOOP and PLOT options. If that doesn't help, send the output of your latest attempt to Mplus Support along with your license number.