Message/Author 

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: Twomediator example DATA: FILE IS data1.txt; VARIABLE: NAMES ARE x m1m2 y; CATEGORICAL IS y; ANALYSIS: ESTIMATOR = ML; 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; OUTPUT: CINTERVAL;TECH3; SAVEDATA: RESULTS ARE results_data1.txt; TECH3 IS tech3_data1.txt; However, when I run it, I got an error message like: *** ERROR 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. 


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 BOOTSTRAP is not allowed with ALGORITHM=INTEGRATION. 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! 


1. Yes, bootstrap is disallowed with integration due to the worry about computational time. If you are concerned about the indirect effect having a nonnormal 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, 499513. 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. 


Hello, I specified a mediated logistic regression model as follows (x1 and x2 are categorical: sex, educationhi/lo): usevariables are x1 x2 x3 x4 x5 x6 x7 c; missing are all (999); categorical is c; analysis: estimator=ML; integration=montecarlo; ALGORITHM=INTEGRATION; model: 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); x1_x6_c=p1*p8; x1_x7_c=p2*p12; x1_x4_c=p3*p16; x2_x6_c=p1*p9; x2_x7_c=p2*p13; x2_x4_c=p3*p17; x3_x6_c=p1*p10; x3_x7_c=p2*p14; x3_x4_c=p3*p18; x5_x6_c=p1*p11; x5_x7_c=p2*p15; x5_x4_c=p3*p19; I requested Tech1 & Tech8 but the output did not provide any fit statistics. Is this useful and how can I obtain it? Thanks, Mario 


With categorical dependent variables and maximum likelihood estimation, chisquare and related fit statistics are not available because means, variances, and covariances are not sufficient statistics for model estimation. 


Dear Linda, thank you very much for your quick reply! We have a path analysis with one categorical dependent variable (a twoclass 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 followup 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, Mario 


There are no absolute fit statistics. Nested models can be compared using 2 times the loglikelihood difference which is distributed as chisquare. BIC can be used to compare models with the same set of observed variables. 


Dear Linda, I have a followup 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 effectORs, especially when it is summarized from two paths with opposite directions? Do you know any reference I could refer to? Thanks, Mario 


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. 


Dear Linda, Is there a way to obtain pvalues for these indirect effects (via MODEL CONSTRAINT)? Is it possible to compute it from confidence intervals? Thank you, Mario 


You will get pvalues for all new parameters defined in MODEL CONSTRAINT. 


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.001.00). Is that possible? Thanks, Mario 


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 (x1x13 m1m4 Y1y6). 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: MODEL: 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. Model: Y1y6 on m1m4 (p1p24) ; < if this is possible. thanks 


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. 


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? ANALYSIS: estimator is mlr; type is missing; integration = monte; MODEL: 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); MODEL CONSTRAINT: new (ind_sch1); new (ind_sch2); new (ind_consci); new (ind_con); new (ind_sup); new (ind_anx); ind_sch1=m1*p9; ind_sch2= m1*p10; ind_consci=m1*p13; ind_con=m1*p12; ind_sup=m1*p11; ind_anx=m1*p14; Sorry for my confusion and thank you in advance for any help. Namer 

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). 


Namer: 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. 


DB40: Go by the credibility interval. If it covers zero, the estimate is not significant. The pvalue 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, Namer. 


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, Namer 


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. 


Dear Professor Muthen, I saw your tutorial about the logistic regression and read your paper about the direct and indirect effects in mediation analysis using SEM in MPlus. I have a binary outcome and two continous mediators. I understand that I have to create a MODEL CONSTRAINT. Now I get the following error message: *** FATAL ERROR THIS MODEL CONSTRAINT IS AVAILABLE ONLY WITH THE ODLL ALGORITHM.ADD ALGORITHM=ODLL TO THE ANALYSIS COMMAND. Can you tell me what I did wrong? Thank you for your help. 


Try the suggestion of the error message. Otherwise, send the output and your license number to support@statmodel.com. 


Professor Muthen, I'm running a single mediation model (7 continuous IVs; 1 continuous mediator; 1 categorical outcome). I'm currently using the following to run my model before testing for mediation. ANALYSIS: type = complex; estimator = MLR; integration = montecarlo; To test for mediation, can I use model indirect with bootstrapping? Also, I read in an article that when testing mediation with a categorical outcome, it is best to standardize all variables (not the outcome). Thoughts on this technique? Any help you can give is greatly appreciated. Danyel 


You should read Muthén, B. & Asparouhov, T. (2014). Causal effects in mediation modeling: An introduction with applications to latent variables. Structural Equation Modeling: A Multidisciplinary Journal, 22(1), 1223. DOI:10.1080/10705511.2014.935843 


Dr. Muthen, Thank you for recommending this article to me, it was a great help. I have several IVs and want to extend this model. Thus when referring to Table A.2, would I include *.2 on each of my IVs? Thank you very much! Danyel 


Dr. Muthen, Also, I read your paper  Applications of Causally Defined Direct and Indirect Effects...& ran Table 31 syntax with just one IV; however, the model won't run when I try to add additional IVs. Under model constraint, wouldn't I need NEW variables for the multiple direct and indirect effects? Am I misunderstanding? THanks in advance. Danyel 


First post: You can do that, but note that X is the "cause" here. When you say "several IVs", do you mean that there are covariates beyond the "cause" that are used as control variables? 


Second post: Table 31 is rather advanced with a binary Y and X*M interaction  is that really what you need? If so, you may be better off doing that using the new Mplus language shown in my 2014 article. 


Dr. Muthen, 1st post: Yes, my IV is a dichotomous variable (whether students participated in an intervention) and the other vars. are covariates. 2nd post: No, I don't need the XM interaction so I will use the new language in the 2014 article. When adding the covariates and asking for the indirect effects  is this the correct way? RET IND CurGPA FYSApp; RET IND CurGPA HSGPA; RET IND CurGPA ACG1; Thanks for responding. Danyel 


Dr. Muthen, I had another thought  OR by just adding the covariates in the model and only requesting the indirect effect with my intervention variable, would this consider the covariates? Thanks, Danyel 


Your IND statements should have only the intervention X on the right hand side. The covariates are taken into account in the sense that they affect the partial regression coefficient for X. The covariates play into the counterfactual effect estimates only if you have interactions between them and X or include the X*M interaction (and then only for the direct effect). 


OK  thanks. Another question  is this a correct interpretation of the Odds Ratio of the TNIE = 1.085? "As mediated by GPA, students who participated in the intervention were 1.085 times more likely to retain than students who did not participate." Danyel 


I recommend that you use the effect on the probability scale, so what's reported first in the output. See my example on page 19 of my 2014 article. 


OK, thanks. Is there a specific situation when you would suggest to use the Odds Ratio? Danyel 


No; I am just saying to keep it simple at first. 


Ok  thanks again! Danyel 

YeeZhang posted on Friday, March 17, 2017  3:53 am



Dear Drs. Muthen&Muthen, I am working on a mediator model with a binary outcome Y, four binary mediators M1M4 and a nominal independent variable X. I am trying to use the logistic regression and bootstrap respectively to calculate and test the indirect effect. Part of my input file is as following: ANALYSIS: estimator=ML; bootstrap=2000; MODEL INDIRECT: Y IND M1 M2 M3 M4 X; OUTPUT: cinterval (bootstrap); However, when I run it, I got an error message like: *** ERROR MODEL INDIRECT is not available for analysis with ALGORITHM=INTEGRATION. I am puzzled.Does the error message means I can not use bootstrapping for logistic regression? 


Perhaps you are not using version 7.4. Also, note that special consideration are needed for mediation models with a binary Y and binary mediators. See our web page http://www.statmodel.com/Mediation.shtml and the article Nguyen, T.Q., WebbVargas, Y., Koning, I.K. & Stuart, E.A. (2016). Causal mediation analysis with a binary outcome and multiple continuous or ordinal mediators: Simulations and application to an alcohol intervention. Structural Equation Modeling: A Multidisciplinary Journal, 23:3, 368383 DOI: 10.1080/10705511.2015.1062730 


Dear Dr Muthen, I am performing mediation analysis with a multicategorical outcome using multinomial logistic regression. I calculated the indirect effects using the product of coefficients in MODEL CONSTRAINT. My question: can I trust the results for these indirect effects? They are different from the results obtained by single logistic regressions (obtained following your 2011 paper for calculate the indirect effects using the logit link) Thank you very much for your help 


I don't think it is clear what an indirect effect should mean for a nominal outcome. Typically, such effects are defined in terms of the expected value but a nominal outcome needs to score its categories to get a single expectation. I would recommend doing a series of analyses where the nominal DV is dichotomized in different ways and then use the counterfactual effects that Mplus now provides. 


Thank you for your advice, it really helps! Massimiliano 

Back to top 