Message/Author 

Jon Heron posted on Wednesday, March 28, 2012  1:37 am



Hi Bengt/Linda As you know, the model indirect command can only be used with WLSMV when working with a binary mediator. With ML, the mediator is treated as a dummy variable in it's role as an independent variable  does this mean that multiplying the paths to derive an indirect effect is invalid due to scaling and constrained residual variances? many thanks, Jon 


You can also use ESTIMATOR=BAYES; MODEL CONSTRAINT; and MEDIATOR =LATENT. The reason you can't use a product indirect effect with ML and a binary mediator is that the mediator is treated as a latent response variable when it is a dependent variable and an observed variable when it is an independent variable. 

Xu, Man posted on Thursday, March 29, 2012  7:19 am



I read in other threads that when logit link is used, its latent response variable that is the dependent and independent variable. Is it valid t to calculate the mediationo use the NEW in this context? 


A product indirect effect is not valid for maximum likelihood in Mplus for the logit link or the probit link when the mediator is binary. 

Xu, Man posted on Thursday, March 29, 2012  10:44 am



Actually the mediator in my case would be ordinal, not binary (sorry I did not realise the centre of discussion is binary being different from ordinal here). I remember under some specification it was possible to request INDIRECT with an ordinal meditor so I just assume it would be valid to calculate the mediation with probit link. 

Xu, Man posted on Thursday, March 29, 2012  10:49 am



Sorry, in my previous previous post, I meant for when probit link is used, it is the latent response variable of the mediator that was used as depedent and independent, hence I thought it would be OK to calculate the product of regression coefficients in this case. 


An ordinal mediator is treated as a continuous variable. If you can use MODEL INDIRECT, you can compute the indirect effect as a product. 

Jon Heron posted on Monday, April 02, 2012  8:00 am



Hi Linda slightly delayed thanks for your response to my initial question. Looks like I have a few more options to play with. 

Jon Heron posted on Tuesday, April 03, 2012  7:42 am



Bit of an update, with no obvious questions inserted. [1] Bayes estimation (uses probit link) and gives results similar to probit/ML when using "mediator=observed;", and results similar to probit/WLSMV when using "mediator=latent;". That's good. [2] I had hoped I might be able to rig up some postestimation parameters using modelconstraint so that I can rescale the logit/ML output (e.g. using David Kenny's equations: http://davidakenny.net/doc/dichmed.pdf) but I'm unable to refer to the variance of the dependent variables in the models, ditto the parameter SE's, using Mplus labelling. Conclusion. Logit/ML/rescaling has some benefits such as sticking with OR's which are more readily interpretable. Stata's binarymediation function will run this automatically and also permit the use of bootstrapping, but this only works for rather simple models. Looks like I'll be sticking with probit/WLSMV in Mplus and taking the hit in terms of losing my beloved odds ratios. 


I assume you are considering a binary mediator M and perhaps also a binary outcome Y. [1] That's right. [2] The research that the Kenny note refers to is largely outdated now. Instead you should take a look at Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus. which is on our web site together with Mplus scripts. This paper goes through new causal effect literature and shows how you should define indirect and direct effects with categorical and other variables. It implies that you can stay with MLlogit and odds as you desired. 

Jon Heron posted on Tuesday, April 03, 2012  10:38 am



Yes, just binary M for now. Thanks for the ref :) 

Xu, Man posted on Wednesday, April 04, 2012  4:29 am



Dear Linda, My case is a more complicated situation so it would not be possible to get mediation output from MODEL INDIRECT. I test the mediation effect from an ordinal mediator with the slope and intercept of a growth curve as outcome variables. Few things in the model that I think might be useful to present here are TYPE=RANDOM; INTEGRATION=MONTECARLO; link=probit; PARAMETERIZATION=THETA; I think in this case latent response variable is used instead of the observed ordinal variable, so I thought maybe I could apply the simple calculation for mediation effect with MODEL CONSTRAINT. Is this valid to do? Thank you! 

Xu, Man posted on Wednesday, April 04, 2012  5:07 am



Or maybe I can never calculate a valid mediation effect because estimator is mlr instead of weighted least square in this case? I have to specify TYPE=RANDOM in order to get the model run with TSCORE option. 


If you are using MLR and have an ordinal mediator that is listed on the CATEGORICAL list, you cannot create an indirect effect as a product. Instead you would need to create it according to the formulas in the following paper: Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus. 

Ewan Carr posted on Friday, June 22, 2012  3:07 pm



Further to the above: I have a twolevel model, with a continuous outcome, and a binary mediator (full specification below). I'm testing a 211 mediation pathway — a level2 variable is mediated by a level1 variable. Some questions: 1) Should I list the binary mediator on the CATEGORICAL list (My guess: yes)? 2) Should/can I test the betweenlevel indirect effect using MODEL CONSTRAINT? 3) Is MEDIATOR = LATENT the default in Mplus? Based on the above reference, it seems the best option here. I'm using Bayesian estimation for this model. Many thanks in advance! Ewan  %WITHIN% y ON m; %BETWEEN% m ON x (a); y ON m (b); y ON x; MODEL CONSTRAINT: NEW(indb); indb=a*b; 


Yes, Yes, and Yes. 

Ewan Carr posted on Saturday, June 23, 2012  3:05 am



Great, thanks for the quick response. Ewan  

anonymous Z posted on Thursday, September 10, 2015  5:08 pm



Dear Dr . Muthen, I have a mediation model. X > M > Y X and Y are continuous, and M is dichotomous. Following your communication with Ewan Carr on June 22, 2012, I fit the model with Bayes estimation. M was a significant mediator. m ON x (a); y ON m (b); y ON x; I have two questions: a.How to explain “ a”? Should I follow logistic regression to create exp (a) to explain the association between X and M? b.I used MODEL CONSTRAINT to create: NEW(indb); indb=a*b; I am confused about “a*b”, because the “a” here is a log odds, which is quite different from “b”? Thank you very much, 


a. Bayes uses probit, not logit. Look at our Topic 2 handout for how to interpret a probit regression. b. I recommend that you instead use Model Indirect where you will get effects defined from "counterfactuals" as is described in the paper on our website: Muthén, B. & Asparouhov, T. (2015). 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 


Actually, in the current version of Mplus you need to use ML to get Model Indirect, not Bayes. You then have the choice of logit or probit for the M regression. Use Bootstrap = 1000; in the Analysis command and Cinterval(bootstrap); in the Output command. 

anonymous Z posted on Friday, September 11, 2015  6:49 am



Hi Dr. Muthen, Thank you so much for your prompt response. I chose to use Bayes because some of my variables are skewed even after transformation,and my sample size is quite small. 1. Is the combination of Bayes and Model Constraint still an option to get indirect effects? 2. I also found that bootstrapping cannot be performed with Bayes. So should I just look at the confidence interval for the new created variables for indirect effects? Thanks! 

anonymous Z posted on Friday, September 11, 2015  9:27 am



One followup question about mediation with Bayes estimation. Since bootstrapping cannot be performed with Bayes,what kind of method is used to test mediation? e.g., Is sobel test or other ways used by default? In my model, the indirect effects were significant, however, the direct effect of X on Y was NOT significant. Thanks so much! 


1. Yes. 2 and follow up. Bootstrap is not needed with Bayes. Bayes provides nonsymmetric credibility intervals. 

anonymous Z posted on Friday, September 11, 2015  12:20 pm



Thank you so much! 

anonymous Z posted on Tuesday, September 15, 2015  9:44 am



Drs. Muthen, With Bayes estimation, what option is available for the estimation of models with missing data? i.e, how missing data are dealt with? Thanks! 


Like ML, Bayes is a fullinformation estimator so it gets consistent estimates under MAR. ML and Bayes therefore give similar results with missing, where the estimates get closer with increasing sample size. Bayes is actually more flexible than ML because it avoids timeconsuming numerical integration that is required for some models. Bayes also offers multiple imputation. 

anonymous Z posted on Tuesday, September 15, 2015  1:37 pm



Thanks so much! Dr. Muthen! 

anonymous Z posted on Friday, September 18, 2015  9:27 am



Hi Drs. Muthen, With Bayes estimation, how to do the comparison between nested models? Thanks, 


For many types of models we give DIC and BIC for Bayes  and more models will have these in the forthcoming version 7.4. 

anonymous Z posted on Tuesday, September 22, 2015  9:11 am



Hi Dr. Muthen, Thank you very much for your reply. I just found that with a dichotomous mediator, Mplus does not give DIC and BIC for Bayes. I wonder if I need to include any extra commands in this case in order to get DIC and BIC. Thanks, 


If DIC and BIC do not come out automatically, they are not available. There is no option to ask for them. 


I have x1(cont)>m(bi)>y(cont) with a categorical mod(4 levels). My goal is modmed with indirect effects/bootstrap CIs for each level. NAMES ARE x1 x2 m y; USEVARIABLES x1 x2 m y; CATEGORICAL are m; GROUPING is x2 (1=1,2=2,3=3,4=4); ANALYSIS: bootstrap = 100; MODEL: m on x1; y on m x1; Model 1: m on x1; y on m x1; MODEL INDIRECT: y via m x1(a1); Model 2: m on x1; y on m x1; MODEL INDIRECT: y via m x1(a2); Model 3: m on x1; y on m x1; MODEL INDIRECT: y via m x1(a3); Model 4: m on x1; y on m x1; MODEL INDIRECT: y via m x1(a4); OUTPUT: cinterval(bcbootstrap); MODEL TEST: 0 = a1a2; 0 = a1a3; 0 = a1a4; 0 = a2a3; 0 = a2a3; 0 = a3a4; 1. I get MODEL TEST error saying a1 is not found (bootstrap removed) 2. Defaults run probit WLSMV; does this automatically calculate indirect effects using the counterfactual method as in Muthén,(2011)? 3. When I run ML for probit or logit I no longer get indirect effects. I was hoping to use logit to get odds ratios. How can I use MODEL CONSTRAINT to use logit/ML? I've looked through examples but can't get it 4. Should I standardize variables for mplus model? 


1.You can't put parameter labels in Model Indirect. They should be in the Model command. 2. No, use ML or Bayes. 3. You don't get counterfactuallydefined causal effects when saying VIA. Use IND and mention the mediator  see UG on our website, pages 702  4. No. 


Thank you. NAMES ARE x1 x2 m y; USEVARIABLES x1 x2 m y; CATEGORICAL are m; CLASSES are cg(4); KNOWNCLASS is cg(x2=14); ANALYSIS: TYPE = MIXTURE; bootstrap = 100; ESTIMATOR = ML; LINK = LOGIT; MODEL: m on x1; y on m x1; MODEL INDIRECT: y IND m x1(1 2); Model 1: m on x1; y on m x1; MODEL INDIRECT: y IND m x1(1 2); Model 2: m on x1; y on m x1; MODEL INDIRECT: y IND m x1(1 2); OUTPUT: cinterval(bcbootstrap); 1. Does this give counterfactuallydefined causal effects correctly using IND? 2. I don't understand how my continuous x1 variable is interpreted to calculate the causal effects. Is this only using values 1 and 2? (1 2) 3. I get error Unknown class model name 1 specified in Cspecific MODEL command when I try to compare by group x2 


Please send your output to Support along with your license number. Page 703 of the UG on our website mentions how the x values in parentheses are used. You consider a change from the second value to the first. Typically they are chosen as 1 SD above the mean versus the mean. 


I have a problem running a mediation analysis with a single binary mediator where I listed the mediator on the Categorical statement. I also listed M and the other predictors so their variances would be estimated by Mplus (to bring the predictors into the model). Mplus with the ML estimator stopped with a message that said the variance of a categorical predictor can’t be estimated with the ML estimator. The estimator needs to be changed to a Weighted Least Squares estimator (WLS, WLSM, WLSV, or WLSMV). But WLS mediators perform a probit regression and I need logistic. 1. How do I move forward? 2. Are there options other than the ones below where I can run the mediation analysis using a logistic regression and FIML?. Option #1: don’t list M as categorical. Option #2: remove M from the list of variables to have their variances estimated. (But Linda you’ve posted that researchers shouldn’t estimate the variances of a subset of the independent variables; we should estimate variances of all independent variables or none of them. My understanding is that if I don’t estimate the variance of a variable listed as a predictor, the predictor will be treated as being uncorrelated with the variables whose variances are estimated. 3. Is there a problem with Option #1? Is doing that “good form”? acceptable? 


You should list the mediator as categorical. You should not put observed exogenous predictors on the CATEGORICAL list. You cannot bring predictors into the model with weighted least squares. You can do this only with maximum likelihood. And you must bring them all in not a subset. 


Thanks for your reply, Linda. I'm still not sure how to fix my problem. Per your reply: 1. I will keep the mediator AAIINS on the categorical statement. 2. I did not list any observed exogenous predictors on the CATEGORICAL statement. Only the binary mediator AAIINS and the binary outcome variable SSINS are listed on the CATEGORICAL statement. 3. Referring to bringing predictors into the logistic regression model, you said in your reply: "And you must bring them all in not a subset". However, my problem occurs when I try to bring the mediator variable AAIINS into the model since it is a predictor of the outcome variable SSINS. Here's the message I get with ML as the estimator when I try to bring AIINS into the model: *** ERROR in MODEL command Variances for categorical outcomes can only be specified using PARAMETERIZATION=THETA with estimators WLS, WLSM, or WLSMV. Variance given for: AAIINS When I don't don't bring AAIINS into the model, my model runs fine. So is the solution not to include the binary mediator AAINS in the list of predictors brought into the model? 


Regarding 3, "bringing in the predictors" should here be understood as bringing in the covariates (the exogenous vbles, the IVs). The mediator is already a DV in the model so no special mention of this is needed (it does not have a variance parameter). ML then proceeds with logistic link. But when the mediator is binary indirect and direct effects should be computed using the counterfactual approach discussed on our Mediation page http://www.statmodel.com/Mediation.shtml Mplus scripts for such examples in our new book are shown for Chapter 8 at http://www.statmodel.com/Mplus_Book_Tables.shtml 


Bengt, thank you for the clarification and guidance. Much appreciated! 

Helen Coo posted on Monday, August 21, 2017  12:30 pm



I am trying to estimate the indirect and direct effects for a model where I have a binary mediator and a continuous outcome, using ML as the estimator. These effects were computed when I ran the model using the subset of cases with no missing values on the covariates. However, when I brought the covariates into the model (see below) to use all available data (FIML) I got the following message: COUNTERFACTUAL EFFECTS ARE NOT AVAILABLE FOR THIS MODEL. Is there some way around this? I couldn’t see anything in your new book about estimating indirect effects with a binary mediator and missing covariate values. Thanks… Usevariables = y x cov m; Categorical = m; Missing all (888); Analysis: estimator = ml; BOOTSTRAP=1000; INTEGRATION=MONTECARLO; Model: m ON x cov; y ON x m cov; x cov; MODEL INDIRECT: y IND m x; Output: cinterval(bootstrap); 


Missing covariates is discussed in book Section 9.8 but that is for a continuous mediator. To be able to answer this, send your input, output, and data to Support along with your license number. 

Back to top 