Logistic regression in mediation anal... PreviousNext
Mplus Discussion > Categorical Data Modeling >
 Jian Wang posted on Tuesday, December 06, 2011 - 12:17 pm
Dear Drs. Muthen&Muthen,

I am working on a mediator model with a binary outcome Y, two continuous mediators M1 and M2 and a continuous initial variable X. I am trying to use the logistic regression. The input file is as following:

TITLE: Two-mediator example
DATA: FILE IS data1.txt;
MODEL: m1 ON x(a1); m2 ON x(a2); y ON m1(b1);
y ON m2(b2); y on x; m1 WITH m2;
MODEL INDIRECT: y IND m1 x; y IND m2 x;
SAVEDATA: RESULTS ARE results_data1.txt;
TECH3 IS tech3_data1.txt;

However, when I run it, I got an error message like:

MODEL INDIRECT is not available for analysis with ALGORITHM=INTEGRATION.

I am not quite sure what the error message means. Thank you a lot for your help.
 Linda K. Muthen posted on Tuesday, December 06, 2011 - 2:14 pm
You would need to use MODEL CONSTRAINT to create the product term of the indirect effect. Note that this is the indirect effect of the latent response variable underlying y. If you are interested in the indirect effect of the observed variable y, see on the website:

Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus. Submitted for publication.
 Jian Wang posted on Tuesday, December 06, 2011 - 3:57 pm
Dear Linda,

Thank you very much for your quick response.

1. Now I have tried to use the Model constraint command, and it seems work. But when I tried to use bootstrap to get the confidence interval, it gave me the error message again:

*** ERROR in ANALYSIS command

Does it mean I can not use bootstrapping for logistic regression?

2. I remember that when the outcome is binary, I need to rescale the coefficients to make the coefficients comparable across equations. (http://nrherr.bol.ucla.edu/Mediation/logmed.html) I wonder if the mplus will rescale the coefficients? If yes, what option I should use?

Really appreciate your help!
 Bengt O. Muthen posted on Tuesday, December 06, 2011 - 6:25 pm
1. Yes, bootstrap is disallowed with integration due to the worry about computational time. If you are concerned about the indirect effect having a non-normal distribution, you can switch to Estimator=Bayes.

2. That rescaling is not necessary - the approach your refer to is about two generations of papers behind now. The first generation change is described in

MacKinnon, D.P., Lockwood, C.M., Brown, C.H., Wang, W., & Hoffman, J.M. (2007). The intermediate endpoint effect in logistic and probit regression. Clinical Trials, 4, 499-513.

The second generation change is the Muthen (2011) paper Linda referred to (it comes with Mplus scripts).
 Jian Wang posted on Wednesday, December 07, 2011 - 7:11 am
This is very helpful! Appreciate your help.
 Mario Mueller posted on Monday, May 07, 2012 - 9:56 am

I specified a mediated logistic regression model as follows (x1 and x2 are categorical: sex, education-hi/lo):

usevariables are x1 x2 x3 x4 x5 x6 x7 c;

missing are all (-999);
categorical is c;


c on x6 (p1) x7 (p2) x4 (p3) x1 (p4) x2 (p5) x3 (p6) x5 (p7);
x6 on x1 (p8) x2 (p9) x3 (p10) x5 (p11);
x7 on x1 (p12) x2 (p13) x3 (p14) x5 (p15);
x4 on x1 (p16) x2 (p17) x3 (p18) x5 (p19);

model constraint:
new (x1_x6_c x1_x7_c x1_x4_c
x2_x6_c x2_x7_c x2_x4_c
x3_x6_c x3_x7_c x3_x4_c
x5_x6_c x5_x7_c x5_x4_c);


I requested Tech1 & Tech8 but the output did not provide any fit statistics.
Is this useful and how can I obtain it?

Thanks, Mario
 Linda K. Muthen posted on Monday, May 07, 2012 - 5:20 pm
With categorical dependent variables and maximum likelihood estimation, chi-square and related fit statistics are not available because means, variances, and covariances are not sufficient statistics for model estimation.
 Mario Mueller posted on Thursday, May 10, 2012 - 5:07 am
Dear Linda,

thank you very much for your quick reply!

We have a path analysis with one categorical dependent variable (a two-class solution of a latent profile analysis of health behaviors) and two sets of predictor variables: 3 proximal predictor variables and four more distal predictor variables (e.g. sociodemographics).
Predictor variables are either Likert, ordinal or binary.

Can I ask two follow-up questions to make sure that I understand how to proceed:
(1) In this model with a categorical dependent variable, are there any usable fit indices?

(2) If yes, which should we use and which values would indicate acceptable fit?

Many thanks for your reply in advance,
all the best,
 Linda K. Muthen posted on Thursday, May 10, 2012 - 11:33 am
There are no absolute fit statistics. Nested models can be compared using -2 times the loglikelihood difference which is distributed as chi-square. BIC can be used to compare models with the same set of observed variables.
 Mario Mueller posted on Wednesday, July 18, 2012 - 4:55 am
Dear Linda,

I have a follow-up question:
As recommended by you, I have used the MODEL CONSTRAINT option to obtain Odds Ratios for both the direct and the indirect effects (via a continuous mediator). How can I interpret these total effect-ORs, especially when it is summarized from two paths with opposite directions? Do you know any reference I could refer to?

Thanks, Mario
 Linda K. Muthen posted on Wednesday, July 18, 2012 - 11:48 am
See the following paper which is available on the website:

Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus.
 Mario Mueller posted on Monday, August 13, 2012 - 3:32 am
Dear Linda,

Is there a way to obtain p-values for these indirect effects (via MODEL CONSTRAINT)? Is it possible to compute it from confidence intervals?

Thank you,
 Linda K. Muthen posted on Monday, August 13, 2012 - 6:24 am
You will get p-values for all new parameters defined in MODEL CONSTRAINT.
 Mario Mueller posted on Monday, August 13, 2012 - 6:50 am
Okay, I realized that but was uncertain how to interpret them, since I got for an estimate of -.004 (p<.001) of an indirect effect but the OR was 1.00 (95%CI: 1.00-1.00). Is that possible?

Thanks, Mario
 Linda K. Muthen posted on Monday, August 13, 2012 - 9:14 am
Please send the output and your license number to support@statmodel.com.
 Dm posted on Monday, January 13, 2014 - 8:58 am
Dear Prodessor Muthen,

I have quite a large mediated logistic regerssion model (x1-x13 m1-m4 Y1-y6). I see that i need to use the MODEL CONSTRAINT to specify the indirect effects based on posts on statmodel.

My question is, is there any way to use a collapsed type of labeling format to specify each of the paths instead of labeling each and every path? So instead of this:

y1 on m1 (p1) m2 (p2) m3 (p3) m4 (p4) x1 (p5) x2 (p6) x3 (p7) x4 (p8) x5 (p9) X6 (p10) x7 (p11) x8 (p12) x9 (p13) x10 (p14) x11 (p15) x12 (p16) x13 (p17) ;

maybe something like this? Since my syntax is getting very large specifying all the individual paths and then specifying all the labels as well.

Y1-y6 on m1-m4 (p1-p24) ; <----- if this is possible.

 Bengt O. Muthen posted on Monday, January 13, 2014 - 4:09 pm
I think that works - give it a try.

You can't give several labels on the same row as you have done - you need to separate them by semi colons.
 DavidBoyda posted on Wednesday, February 12, 2014 - 12:45 pm
Thank you so much Bengt, it worked wonderfully.

However, I have a follow up question. If the indirect effects are the product of OLS regression coefficient and probit coefficient, how on earth do would you interpret the indirect effects estimates since they are the product of two different scales?

I understand neither scales can be scaled.
 Bengt O. Muthen posted on Wednesday, February 12, 2014 - 1:52 pm
These issues are discussed in my paper on our website:

Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus. Click here to view the Technical appendix that goes with this paper and click here for the Mplus input appendix. Click here to view Mplus inputs, data, and outputs used in this paper.
 DavidBoyda posted on Wednesday, February 12, 2014 - 2:57 pm
Thank you so much sir - good day.
 namer posted on Sunday, April 20, 2014 - 11:16 am
Dear Linda and Bengt,

I am conducting a similar model to Mario, with 6 continuous IVs, 1 continuous mediator and a binary DV. Based on readings on this forum, I have opted for the mlr estimator versus wlsmv.

I have 2 questions:
1.Is the following syntax appropriate for a sensible interpretation of indirect effects - or is another step was required given the combination of OLS and logit coefficients?
2. to compute total effects do I simply add the indirect and direct effects? or again should I be weary of the combination of OLS and logit coefficients?

estimator is mlr;
type is missing;
integration = monte;

abexp on sesgez_low gender;
abexp on sch1 sch2 sup con consci socanx;

peer on sch1 (p9);
peer on sch2 (p10);
peer on sup (p11);
peer on con (p12);
peer on consci (p13) ;
peer on socanx (p14);

abexp on peer(m1);

new (ind_sch1);
new (ind_sch2);
new (ind_consci);
new (ind_con);
new (ind_sup);
new (ind_anx);

ind_sch2= m1*p10;

Sorry for my confusion and thank you in advance for any help.
 db40 posted on Sunday, April 20, 2014 - 11:58 am
Dear Professor Muthen,

I have completed a mediation model using Bayes since the results of MLR gave me product estimates that were non significant even though I have significant AB paths.

However I am a little bit confused over one of the results of the Bayes estimation. I have significant P values but the credibility intervals contain zero. So is the mediated effect significant or not?

For example;

m1 on x1 is significant (0.313, p =0.008, 95%CI= 0.063 - 0.555)

y1 on m1 is significant??? (0.098, p 0.035, 95%CI= -0.009 - 0.207)

and the mediated effect is:

Y1_M1_X1 = (0.028, p = 0.043, 95%CI= -0.003 - 0.085).
 Linda K. Muthen posted on Monday, April 21, 2014 - 10:10 am

With MLR and a binary distal outcome and a continuous mediator, you can use the product specification for an indirect effect involving the latent variable underlying the binary distal outcome. You can also use this with WLSMV. For further information about indirect effect specification, see

Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus.
 Linda K. Muthen posted on Monday, April 21, 2014 - 10:13 am

Go by the credibility interval. If it covers zero, the estimate is not significant.

The p-value is the probability of being in the other tail. For a positive estimate, it is the probability of being zero or negative.
 namer posted on Friday, April 25, 2014 - 4:35 am
Dear Linda,

Thank you for your prompt response. I have one follow up question - if I use WLSMV can I also use MODEL INDIRECT to calculate indirect effects and make use of bootstrapping? Or given that I have a binary outcome with continuous mediators and predictors is the MODEL CONSTRAINT method preferred?

Thank you kindly for your advice,

 Linda K. Muthen posted on Friday, April 25, 2014 - 6:12 am
In your situation, you can use either.
 namer posted on Wednesday, April 30, 2014 - 6:14 am
Dear Linda,

Yet another follow up question. If I wanted to add two binary covariates to the model, would WLSMV with MODEL INDIRECT still be a valid method? It seems to me the combination of continuous and categorical predictor variables are fine with WLSMV. These are control variables, which are only regressed on binary DV, not continuous M.

I am trying to stick with WLSMV instead of switching back to MLR as long as valid, due to the benefit of the fit statistics produced.

Furthermore, I normally interpret my indirect effects as: for one unit in change in x, y changes by the value of the indirect effect. However, it is not clear to me how to translate this combined probit/OLS indirect effects I have in this model. I guess I cannot change these coefficients into probabilities as with the strictly probit coefficients? Nor can I interpret as I would with OLS coefficients? So how do you advise to interpret them?

Kind regards,
 Bengt O. Muthen posted on Wednesday, April 30, 2014 - 7:33 pm
WLSMV has no problem with binary covariates, just don't put them on the Categorical list.

With WLSMV and a binary DV the y in your story is a latent continuous response variable behind the observed binary y. If you want to instead think about probabilities you have to study

Muthen, B. & Asparouhov T. (2014). Causal effects in mediation modeling: An introduction with applications to latent variables. Forthcoming in Structural Equation Modeling.

which is on our website under Papers, Mediational Modeling.
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