Message/Author 

Anonymous posted on Monday, March 29, 2004  8: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. 


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  11:10 pm



thanks. does this mean an observed variable can be a mediator and a moderator in the same model? thanks again 


I believe that this is the case. I have never actually done this though. 

Anonymous posted on Wednesday, January 12, 2005  4:53 pm



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 nonlinear 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! 


Yes. 

Zoogah posted on Saturday, August 20, 2005  2:07 am



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  10: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!!! 


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 nonnormal Likert variables. British Journal of Mathematical and Statistical Psychology, 38, 171189. Muthén, B. & Kaplan D. (1992). A comparison of some methodologies for the factor analysis of nonnormal Likert variables: A note on the size of the model. British Journal of Mathematical and Statistical Psychology, 45, 1930. 

Zoogah posted on Monday, August 22, 2005  4:08 pm



Linda, Thank you very much. The mediating variable is ordinal. I will treat it accordingly. 

Mary Anders posted on Thursday, July 13, 2006  7: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 (01). 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. 


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  10: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  7: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  7:17 pm



Question: Moderation and Mediation in the same model (single level) _____________ (NOTE: Based on crosssectional 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? 


MODEL INDIRECT is not available with TYPE=RANDOM. There is no way to change this. You would need to compute the indirect effects yourself. 


A colleague has run a path analysis with the following variables: 1. Independent variables: x1x10, a mixture of continous and categorical variables. 2. Mediators m14, 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=1x) = 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=1x for the total effect of x1 on y1 through m1, could he use: p(u=1x) = 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? 


This sounds correct. 


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 


I would instead use the mediating variable as a grouping variable. 


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 211 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! 


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 


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! 


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 pvalue should be interpreted. Chisquare and the degrees of freedom are adjusted to obtain a correct pvalue. DIFFTEST should be used to compare nested models. That would seem to suggest partial mediation. 


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? 


Regression coefficients in this case are probit regression coefficients. 


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 


Sebastian, Try the following: USEVARIABLES ARE Y1 X1 X2 M interact; /Amir 

Dan Shefet posted on Monday, June 21, 2010  6: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 


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


Weighted least squares is an estimator. See Example 3.12. 


Hi, I would like to test if two variables are mediators of the same xy 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! 


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. 


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 apath 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? 


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. 


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. 


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 


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. 


Thanks a lot for your answers. 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. 


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. 


Good Morning, Would you have a look at the output? It would be great! Otherwise thanks for the answers you've gave me! 


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  10: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)? Thanks in advance. 


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  7:44 am



Thanks for your quick answer. 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  8: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,813,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; Thanks in advance. 


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  3:30 pm



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. 


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  2:52 pm



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? Thanks in advance. 


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  4:39 pm



Thanks for your quick answer. It was very helpful! 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  4:57 pm



Sorry, of course without GROUPING IS in the DEFINE command... 


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  1:26 pm



Good morning. I'm new to MPLUS and am attemptin to rerun 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! 


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*(x13); 

Rebeca posted on Friday, December 02, 2011  5:54 pm



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. 


Please send the output and your license number to support@statmodel.com. 

H. R. posted on Monday, January 23, 2012  1:34 pm



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. 


DV on IV1 IV2 IV1*IV2; is correct. 

H. R. posted on Wednesday, January 25, 2012  6:04 pm



Thanks a lot, Linda. 


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! 


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. 


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! 


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  10: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! 


That graph is available in Mplus for regression of a latent class variable on covariates. It is not available for a nominal observed DV. 


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 nonnormally 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? 


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. 


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? 


Yes. 


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 pvalues 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 pvalues). I'm running the analyses with bootstrapping,asking for standardized estimates and CI's.Which indicator should be prioritized in drawing conclusions? Thanks in advance 


The pvalues and confidence intervals will agree if the confidence intervals are symmetric. BOOTSTRAP and BCBOOTSTRAP confidence intervals are not symmetric. 


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. 


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. 


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 (k1) 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 


If the covariate is ordinal just say y on education. This is no different from putting a factor behind the covariate. 


ok, thank you very much. 

Ciara Wynne posted on Monday, October 29, 2012  11: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. 


Please send the output and your license number to support@statmodel.com. 

Leslie Roos posted on Thursday, January 17, 2013  8: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  8: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 


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  3:28 pm



Hello, Thank you, as always for your excellent advice! A couple followup 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 


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 Sunday, May 12, 2013  12:08 am



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! 


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. 


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 


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. 


Thank you! Annie 


Hello  I am looking to test a simple mediation model (all three variables are measured and continuous), but have withinsubjects 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 addon? the multilevel addon?), 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 


How is the nesting of the data? Is it repeated measures of the same variable across time or students nested in classrooms? 


It is repeated measures data... 


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  1:04 pm



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; 


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  10: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 


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  9: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 


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 Wednesday, April 23, 2014  5:14 am



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! 


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. 


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! 


You should say F3 IND F2 F1; 

db40 posted on Sunday, August 10, 2014  11:32 am



Dear Dr.Muthen, Can I just query, that if I total effect that is nonsignificant and a direct effect that is also nonsignificant but significant indirect effect, what is this? partial or nothing? 


You then have a fully mediated effect. You may want to ask these general modeling questions on SEMNET. 


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.660D12. 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); 


Send output and license number to Support so we can diagnose this. 


Hi! I am interested in a moderated mediation where 'mod' moderates the bpath 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 


Please send input, output, data, and license number to Support. 


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


Yes; see the AikenWest regression interaction book. 


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. 


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. 


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 3step 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 


See my answer yesterday to Daniel Beale. 


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 


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 


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 leastsquares or Bayes. Here is an early article of this kind: Xie, Y. (1989). Structural equation mode ls for ordinal variables. Sociological Methods & Research, 17, 325352. 

Back to top 