Message/Author 

Minseop Kim posted on Tuesday, August 10, 2010  1:02 pm



Dear Linda, Although I reviewed threads regarding categorical mediators, I am still confused. Usevariables are m1 m2 m3 X1 X2 X3; Categorical = X3; ! m1m3 are indicators ! X1 & X2 are continuous observed var ! X3 is dichotomous observed var Model: Y by m1 m2 m3 ; Y on X1 X2 X3; X2 X3 on X1; Model indirect: Y ind X1; Q1. Based on your answers, I thnik if I use ML treating categorical mediators as continuous variables, a coefficient (X1>X3) is a logit coefficient and the rest (X1 > X2, X1> Y, X2>Y, and X3>Y) are regression coefficients. If I don¡¯t specify the method of estimation, by default(WLS?), the coefficient (X1>X3) is a probit coefficient whereas the rest of coefficients are still the regression coefficient. Is it right? Q2. By the way, you also said ¡°A nominal variable cannot be used as a mediator. You could look at each category separately or use the nominal variable as a grouping variable." But, I think a nominal variable is a sort of categorical variable. Do you mean that if a nominal variable has more than two categories, it is impossible to fit a model with the nominal mediator? Q3, How can we interpret an indirect effect of X1 on Y via X3 if a coefficient (X1X3) is logit or probit coefficient and X3>Y is regression coefficients? Thanks 


If you treat a variable as continuous, the regression is a linear regression. You cannot use a nominal variable as a mediator. In Mplus, an indirect effect can be computed for a categorical mediator only when probit regression and weighted least squares estimation is used. 


Dear Mplus experts, I would welcome a new clarification on categorical mediators, indirect effects, and logit/probit. (1) Consider path X > M > F > u1u4 . M = categorical (ordinal) mediator . F = latent trait observed through ordinal outcomes u1u4. A) If M is predicted by a logit regression on X, then M is treated as a continuous covariate of F regression. No indirect effect X>M>F is available. B) If M if predicted by probit, then M is treated as its underlying LRV M*. The indirect effect, actually X>M*>F, is the product of the regression coefficients of X>M* and M*>F ; SE + significance are derived using a Sobel approach. With WLSMV estimator, we use MODEL INDIRECT; with ML, MODEL CONSTRAINT. What is the rationale for the difference A / B? Is it because with logit, the underlying LRV M* has a nonnormal (logistic) residual, thus the overall residual of X(M)>F has no known distribution? (2) Ordinal M has 3 levels. Simple regression M > F suggests a non linear relationship. Isn't it then better to regress F on 2 dummy binary variables M_2 and M_3, than on M as a continuous covariate? Is there any simpler model than having 2 paths: X>M_2>F X>M_3>F? Thank you very much for any help. 


11A. Yes. 1B. Yes for WLSMV. No for ML. The reason that it is yes for WLSMV is that m is treated as m* both when m is a dependent variable and an independent variable. The reason it is no for ML is that m is treated as m* when m is a dependent variable and m when it is an independent variable. 2. If m is ordinal, you can regress f ON m and m ON x; Creating two dummy variables for a mediator will not work. 


Dear Dr Muthen, thank you very much for your prompt answer. (1B[2]). In other threads, it is suggested that the indirect effect X>M>F can be derived in ML with probit. Instead of MODEL INDIRECT (WLSMV), we are instructed to use MODEL CONSTRAINT in ML/MLR: define the overall coef as the product of the two path's coefficients X>M(*?) and M(*?)>F. See e.g.: http://www.statmodel.com/discussion/messages/11/4560.html?1249594999 Did I get it right? I.e. may we write it as follows? (nu_ = intercepts, b_ = loadings, eps_ = residuals) F = nu_2 + b_2 M* + eps_2 = nu_2 + b_2 (nu_1 + b_1 X + eps_1) + eps_2 = (nu_2 + b_2 nu_1) + (b_1 b_2) X + (b_2 eps_1 + eps_2) How is the overall SE computed? (Sobel...) (2[2]). The simple regression of F on M suggests that M at level 2 has a stronger effect (regression coefficient) on F than M at levels 3 and 1. This nonlinearity makes me hesitant to consider M as a continuous covariate of F regression. How else may I model M mediating the influence of X on F? Thank you again for your greatly responsive support, and for developing and maintaining this excellent software. 


I think the confusion arises from the fact that it is only when the mediator is categorical that indirect effects cannot be computed with ML using MODEL CONSTRAINT or MODEL INDIRECT. If the mediator is continuous and the final variable categorical, this is not a problem. Following is a summary: MODEL INDIRECT for weighted least squares and MODEL CONSTRAINT for maximum likelihood can be used for indirect effects when: x > continuous > categorical x > continuous > continuous MODEL INDIRECT for weighted least squares but no MODEL CONSTRAINT for maximum likelihood when: x > categorical > categorical x > categorical > continuous The reason that it is yes for WLSMV is that m is treated as m* both when m is a dependent variable and an independent variable. The reason it is no for ML is that m is treated as m* when m is a dependent variable and m when it is an independent variable. 


Many thanks for this clarification, Dr Muthen. I understand better now the differences. Actually, I wish to use logit links between factor F and ordinal outcomes u1u4, in order to have an easier oddsratio interpretation of the regression coefficients. This restricts the estimation choice to ML/MLR. To adapt to the framework you just told, I am rewriting my model in order to consider M now as continuous. I would like to know if the indirect effect b_ind (X > M > F) can then be obtained by multiplying the two regression coefficients b_1 (X > M) and b_2 (M > F), within a MODEL CONSTRAINT option? How safe is it to interpret the zscore of b_ind in order to infer the significance of the indirect effect? 


Yes. Very safe unless the sample size is less than say 50. 

jtw posted on Monday, May 30, 2011  1:58 pm



I have a mediating variable that is nominal in nature with six categories. I understand one cannot use this variable in observed form as a mediating variable in Mplus. I have seen the creating latent categorical variables from nominal variables work around (i.e., "Making an observed categorical variable u equivalent to a latent class variable c" handout). Can this procedure be generalized to the case where there are six categories? If so, what would the code be? I can't seem to get it to work. Thanks. As an alternative to the above procedure, would a simple dummy variable approach work (five dummies with one left out as reference) to assess mediation effects in this case? Thanks. 


I think modeling with a nominal mediator is an unresolved methods research topic. You can translate an observed nominal mediator into a latent class variable for any number of categories. But it isn't clear how to define indirect effects in this modeling, so that solution isn't all that's needed. I also don't think turning the nominal mediator into a series of dummy variables is a solution gets you to the goal of indirect effects. The closest one can get would seem to be to dichotomize the nominal variable and define indirect effects via the underlying continuous u* as mediator using WLSMV. 

jtw posted on Tuesday, May 31, 2011  7:56 am



Thanks. I have a follow up question. You note that one could dichotomize the nominal variable as probably the best approach to assessing indirect effects at this point in time. Generally, I understand the logic of using the underlying continuous u* as the mediator but when you say to dichotomize the six category nominal variable, do you mean collapse the six categories into just two? In my case, I don't think theory would justify this option. Alternatively, did you suggest creating five dichotomies and treating them as categorical mediators simultaneously within the same model? Or, create the five dichotomies and use subsamples to test each condition versus the reference group separately when defining the mediating variable as categorical (e.g., Model 1 subsample: Cat1 vs. ref group; Model 2 subsample: Cat2 vs. ref group, etc.)? Any clarification would be most helpful. Thank you in advance for your time. 


Answers to your 3 paragraphs: 1. Yes, that's what I suggested. So for example "taking the bus" versus all other modes of transportation. 2. No, I don't suggest breaking up into several dummies  I don't know how that would be correctly analyzed in a mediation context. 3. I am not sure about this approach. Perhaps you simply want to do a multiplegroup analysis with the 5 categories, and forego the mediation aspect. 

Kesinee posted on Tuesday, October 11, 2011  3:31 pm



Dear Dr. Linda, Regarding to your post on Monday, May 09, 2011  10:02 am “MODEL INDIRECT for weighted least squares but no MODEL CONSTRAINT for maximum likelihood when: x > categorical > categorical x > categorical > continuous ” Could you please give me, some references? Thank you. Sincerely yours, Kesinee 


See Introduction to statistical mediation analysis by David MacKinnon. 

Kesinee posted on Wednesday, October 12, 2011  6:16 am



Dear Dr. Linda, Thank you very much. Sincerely yours, Kesinee 


Hi Dr. Muthen, I have reviewed your paper here (http://www.statmodel.com/download/causalmediation.pdf) on nominal mediation. I have an outcome which is continuous, and a mediator which is nominal with ten categories. How reliable is the method described in the paper noted above when you have ten categories in the nominal mediator? Thanks for considering this question, Selahadin 


You should have a large enough number of observations in each category  how many is unknown without a simulation. I think the approach is cumbersome from an interpretation point of view with many categories. 


Thanks a lot Selahadin 


Good morning Bengt, In follow up to the question above, we were wondering if instead of a nominal mediator with ten categories, would a nominal mediator with three categories work? More specifically, I have a dichotomous outcome with one nominal mediator (with three categories) and 9 dichotomous mediators. Eight of the nine dichotomous variables are thought to act on the outcome in a second level mediation through the ninth dichotomous variable (a>b>c>d). How feasible is the new causallydefined effects method for this complex model? We feel confident that we have a large enough sample (with nearly 400k observations). Selahadin 


Secondlevel (chained) causallydefined mediation with both nominal and binary mediators would be quite complex to set up I would think. Both the use of a nominal mediator and the use of a chain of mediators is new; I haven't seen applications of it. I would try to simplify the model or the analysis if possible. 


Thanks a lot. 


Hi Drs. Muthen, I have a categorical mediating variable (0/1) and one binary independent variable. Also, there were 16 covariate variables (dichotomous and continuous). A dependent variable is continuous variable. I would like to calculate indirect effect. Here is my code. CATEGORICAL=M; ANALYSIS: estimator=WLSMV; PARAMETERIZATION = THETA; MODEL: M on X; Y on M; Y on Cov1 to COV16; X with COV1COV16; M with COV1COV16; Model Indirect: Y ind M X; Well, it didn't work. WARNING: VARIABLE COV1COV16 MAY BE DICHOTOMOUS BUT DECLARED AS CONTINUOUS. NO CONVERGENCE. NUMBER OF ITERATIONS EXCEEDED. Any suggestions? 


You get this message because you include the covariates in the model: X with COV1COV16; M with COV1COV16; The model is estimated conditioned on the covariates. You should remove the above statements. 


Thank you for your suggestion. Is there any way to include these paths? The reason why I inlcuded all cov variables is that I would like to test whether the mediating variable impact the dependent variable controlling all covariate variables. 


The following two lines test the impact of m on y controlling for the exogenous covariates: Y on M; Y on Cov1 to COV16; You don't need the WITH statements and should not include them. 


I really appreciate your help. I have three more questions. 1) When I used bootstrap option, I coudldn't get CFI, TLI, RMSEA...but I got only WRMR. WRMR is 1.672 (I think it indicates that model fit is not good). If I am interested in getting only indirect effects, is it okay to ignore poor model fit? 2)How can I get TLI, CFI.... and so on with bootstrap option? 3)When I looked at the diagram porvided from Mplus, all cov variables are correlated even though I didn't put the paths among those variables? Could you explain why the diagram showed like this? Again, thank you so much for your BIG help. 


The BOOTSTRAP option bootstraps only standard errors. Run the model without the BOOTSTRAP option to get the fit statistics. Ignore WRMR. It is an experimental fit statistic. In regression, the model is estimated conditioned on the covariates. Their means, variances, and covariances are not model parameters. They are not uncorrelated during model estimation. This is why the arrows are in the diagram. 


Thank you Dr. Muthen. This would be the last question. I am only interested in mediating effects. In the model, CFI=0.645; TLI=0.223;RMSEA=0.083. Even though model fit is very very poor, can I use (or trust) parameter estimates (mediating effect)? Thank you, 


Dear Dr. Muthen, When I put the paths from 16 cov variabls to the mediating variable, CFI and TLI were 1.000. RMSEA is 0. HOwever, the relationships between the mediating variable and 16 covs were not causal effects, but they have relationshps. When I put <> among covs and the mediating variable (M), the model didn't work. However, I put > from covs to the M, the model worked really well. Should I use > (causal effect) instead of <> (correlation) even though they are not causal effects? 


If model fit is poor, you cannot use the results for the mediation part of the model. Misfit means that the model does not represent the data well. Your model should be based on theory not searching for a model that fits the data by experimentation. 

Lars Bocker posted on Wednesday, January 29, 2014  7:57 am



Dear Linda and Bengt, In my model I have several independent variables which predict y through two mediators, one of which is nominal (m1). m1 m2 y ON x1x10; y ON m1 m2; m2 ON m1; 1) Would the only way to model this nominal mediator be through a mixture analysis latent class approach described in your paper on causal mediation? I have problems applying the corresponding syntax in table 50 and 51, particularly the model constraint part, to my model. 2) Or could my 4category nominal mediator also be represented through specifying three (or four?) correlated dummies in one model? As the choice for one dummy excludes the choice for the others, I guess these correlations should be (very close to) 1. 3) Or would you advice me to simplify the nominal mediator into one dummy. This would be less ideal from a theoretical point of view, but might be the only feasible option. Thanks in advance... Lars 


1) that would be the best way. 2) I haven't explored how well this would work. 3) Probably the easiest approach. And you would have to use WLSMV unless you take the causal approach, so that the mediator is a latent response variable and you get linear regressions for both mediator and distal. 


Is there any way to do moderated mediation with a nominal mediator with multiple group analysis? Currently only one knownclass variable can be specified in Mplus. 


It's a little involved but you can combine the class variables of the nominal and the groups so that if you have 3 nominal categories and 2 groups you would have 6 classes for the single Knownclass variable. You just have to set the parameter restrictions right. 


Hi, Is there a way in Mplus to test for mediation where X is continuous, M is dichotomous, and Y is a count specified as negative binomial? As far as I understand from previous posts, a dichotomous M should be estimated using WLSMV but the negative binomial Y requires MLR. Thanks! 


Use ML  this will give you the correct counterfactuallydefined indirect and direct effects. The mediator will be treated as binary in both regressions but that is ok visavis the effects (see our new book). 


Hello, I am looking into using latent class membership as a nominal mediator (my predictor and outcome variables are both continuous). I have been reading your causal mediation paper (http://www.statmodel.com/download/causalmediation.pdf) which refers in section 8 "Mediation modeling with a nominal mediator" to reference sections 13.4 for causal effects of a continuous outcome and 14.7 for Mplus syntax. However, these sections 13 and 14 seem to be omitted from the appendix. I have also bought your book "regression and mediation analysis using Mplus" which contains a wonderful example 8.5.3. on data with a nominal mediator and a binary outcome. Both the MODEL part and MODEL CONSTRAINT seem very complex for my Mplus skills. Do you know where I can find and example of input for a continuous predictor, nominal mediator, and continuous outcome? Is section 13.4 of the causal mediation paper available somewhere? Or what changes would I have to do to the MODEL CONSTRAINT part of the nominal mediator, binary outcome example in your book to use a continuous outcome? Thank in advance. Chris 


You find the paper under http://www.statmodel.com/Mediation.shtml You will find what you search for by noting that there are 3 clicks here: Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus. Click here to download the paper. 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. 


Thanks for providing the resources. I do have a few followup questions based on the syntax in the appendix table 48: Input from step 2 y ON xm knownclass in the causal mediation paper: (1) The example for a nominal M, continuous Y using a latent variable to represent M uses the knownclass option after step 1 of generating data. I have used step 1 of the manual BCH paper to generate a dataset with 4 latent classes I would like to use as the nominal mediator. Is it still appropriate to use knownclass when the latent classes aren't really known a priori? (2) In the MODEL part: What are the numbers behind the * and where do they come from (ex. [c#1*1](gamma01))? It looks like we're freeing up some parameters, but I'm not sure what this means and why those exact values are being used? (3) Similarly, in the MODEL CONSTRAINTS: multinominal denominators (ex. NEW(denom0*1.9744 denom1*2.5585 ...)) are being created, but I'm again unsure of where those numbers come from. For points (2) and (3): What kinds of changes do I have to make to extend this syntax from 3 to 4 classes? Thanks again for your help. 


(1) Knownclass should not be used when the classes are unknown. The nominal mediation approach is appropriate also for unknown latent classes. (2)  (3) Table 48 shows a Monte Carlo simulation study and in such studies the values after the * in Model statements give the true values used in the Monte Carlo summary. You wouldn't use such values in a realdata analysis. Regarding your last question, you can simply say c on x and all classes will be regressed on x. The following statement don't need to be mentioned but are default in a realdata analysis: [c#1*1] (gamma01); [c#2*.5] (gamma02); Because this is an advanced analysis you may want to consult with an Mplus mixture modeling expert. It can be hard to learn it step by step this way given that there is no explicit literature on it. 


Are the indirect effects estimates provided by the Mplus output correct for a model with binary x and m and continuous y considering the a and b paths are on different scales (WLSMV estimation)? Or should I use the equations in the counterfactual paper to calculate this correctly? 


I would use the counterfactual effects for this. See our new book. 

Back to top 