Message/Author 


In a multilevel SEM, can the coefficients from the StdYX column on the MPlus outut be used to calculate total and indirect effects, in an analogous manner to a path model? 


The StdYX coefficients for the between and for the withinpart of the model can be used just as in a singlelevel model. 

Anonymous posted on Monday, September 24, 2001  2:19 pm



How do you then calculate the significance of the indirect effects? 


You would need to calculate the standard error for each indirect effect using the delta method. 


How do I find instructions for the delta method? 


I believe that this is discussed in Ken Bollen's book, Structural Equations With Latent Variables, beginning on page 390. 


Is it possible to request indirect effects by using the MODEL INDIRECT command for twolevel models in version 3? 


No, indirect effects are not available for multilevel models. 

Mary posted on Friday, December 02, 2005  1:02 am



I'm working on Mplus, doing multilevel SEM with nonrecursive. I want the indirect effects and total effects to be shown in the results. Is it possible? and how? Thank you 


MODEL INDIRECT is not yet available for TYPE=TWOLEVEL. You would need to calculate the indirect and total effects by hand. 

Keith posted on Monday, December 12, 2005  12:10 pm



Is MODEL INDIRECT available under type=complex? 


Yes. 

xixi posted on Friday, January 06, 2006  8:48 am



Does it mean that we can't use multilevel model to test mediating effect? I want to test the mediating effect of "satis" on the relationship between "ijc" and "retain". The following are my command syntax: DATA: File is D:\prepare for proposal\zp data test\mplus\test3.dat; Variable: Names are group satis ijc retain; Usevariables are groupretain; Between = ijc; cluster is group; ANALYSIS: Type = twolevel; MODEL: %WITHIN% retain on satis; %BETWEEN% retain on ijc; satis on ijc; And the error message is: *** ERROR in Model command Variable is a yvariable on the BETWEEN level but is an xvariable on the WITHIN level: SATIS How do I deal with this situation? Thanks! 


I think you may not be using the most recent version of Mplus, Version 3.13. If you are not, I would download it and try this model again. If you are, then please send your input, data, output, and license number to support@statmodel.com. 

student07 posted on Wednesday, August 15, 2007  9:06 am



Hi Drs. Muthén! is it possible to request indirect effects by using the MODEL INDIRECT command for twolevel models in version 4.1? (At least I get some output  I only wonder whether this can be used?) Thank you! 


Yes as long as numerical integration is not required. 


Linda, Is it possible to calculate indirect effects using Type = Twolevel in Mplus 4.2? If not, is there an article or book you would recommend on how to calculate indirect effects for multilevel models? Thanks, Lucy 


Yes, see MODEL INDIRECT. 


I have a multilevel SEM: Model: %Within% lbtog ON ltpcat t; liit ON lbtog ltpcom t; %Between% lbtog ON crectb04 tinact apertura intxaper; liit ON crectb04 tinact apertura intxaper; lbtog With liit; And I am interested in testing the indirect effect: Model indirect: liit IND ltpcat; My question is related to the possibility of getting bootstrap standard errors. I know that the bootstrap is not available in this situation, do you know of any other means to make this kind of analysis? Thanks in advance, Fernando. 


I don't know of any way to obtain bootstrapped standard errors with TYPE=TWOLEVEL in Mplus. 


Dear Dres Muthen, I am a psychologist (not a statistician) who is currently dealing with a nice (yet complex) dataset regarding a randomized clinical trial with up to 14 weekly measurement timepoints. Putative mediators and outcome were both collected weekly (total: up to 14 sessions) My main interest is to detect whether  overall  the putative mediators at timepoint X mediate symptom change for timepoint X+1. I am not sure whether to use a multilevel model (repeated measures nested within persons) and if yes, which type (multilevel? or complex?). Another problem is that the n is only 29 so there's not much power there to detect any effects... maybe i should try a growth model instead (change in mediators predicting change in symptoms with a timelag of one session?) any help would be appreciated. Best and thank you! Benjamin 


I would use a growth model as shown in the examples in Chapter 6 of the user's guide. How you include your mediators depends on your research hypotheses. 


Dear Linda, I would likt to show that changes in my mediator precede changes in outcome by a lag of one session. That is I am trying to model two growth curves: one for the outcome and one for the mediator. I am then trying to predict the slope of the outcome growth curve with a "t  1 timelagged" curve of the mediator...naturally, I am not quite sure how to set up the model, especially as my model fit is not so good (i s  for outcome: CFI 0.599, TLI 0.635; for mediator: CFI 0.519, TLI 0.562). Many thanks Benjamin 


Instead of having a growth curve for the mediator, you would use it as a timevarying covariate and lag it. I think Example 6.12 is close to what you want. You should get a goodfitting growth model for your outcome as a first step. 


Hello! I would like to test a moderation effect on betweenlevel. Interaction between moderator (3level categorical) and independent variable is not significant, but if I do a multigroup analysis based on the moderator I find that the association between the independent variable and dependent variable is clearly significant in one of the groups but not in two others. Do you think this proves for moderation (after testing that the differences between groups are significant) or do you have some other ideas? Thank you very much! Lotta 


I would need to see the two full outputs to fully understand what you are saying. Please send them and your license number to support@statmodel.com. 


Hello, my question is about pvalues of indirect effect. I have a model of this type: X > M > Y in which both simple effects are significant: X > M : estimate = 0.651, p = 0.018 M > Y : estimate = 0.073, p = 0.020 However, the indirect effet (0.651*0.073 =0.048) is not significant (p=0.098), and I have trouble understanding this. My question is perhaps naive, but could you please explain to me why the pvalue of the indirect effect is not significant here, while the simple effects are both significant? Thanks, Guillaume. 


This can happen. The two regression coefficients may be positively correlated causing the denominator of the ztest to be large. You can see this is TECH3. 


OK. Thank you for your answer. Could you just tell me where I can find the complete formula of this ttest? Best regards, Guillaume 


Please see the Bollen SEM book. 


Good morning, Hopefully you can help me with the problems I have. I have data of 1670 immigrants in 720 neighbourhoods. I am interested in effects of neighbourhood composition (= between level) on majority language proficiency (= individual level). I am especially interested in the mediating role of social contacts (= individual level). Thus: neighbourhood composition > contacts > language proficiency. Language proficiency is categorical. 1) If I try to estimate it with multilevel, I cannot specify the contacts as 'within' because I have to include the the neighbourhood composition > contacts. But if I do not specify it as within, I get the warning : Unrestricted xvariables in TWOLEVEL analysis with ALGORITHM=INTEGRATION must be specified as either a WITHIN or BETWEEN variable. I guess that is because I have a categorical dependent variable. Is there a way to solve this? 2) If I try to estimate it with TYPE=COMPLEX with neighbourhood as cluster, I can estimate the direct and indirect effects. But is this the best way? The fit indices I get are CFI .819, RMSEA .057, I think this is not good? Moreover, my contact measures are negatively correlated at the between level, but positively correlated at the individual leve. Can I take that into account with TYPE=COMPLEX? I hope you can give me advice! Thank you! 


You will find a solution in UG ex 9.4 which uses weighted least squares estimation. 


Is it possible to do bootstrapping with type=complex in the new Mplus version 6 to check for mediation? Thank you for your answer! 


No. 


Dear Drs. Muthén, I am trying to estimate a multilevel SEM with indirect effects (in Mplus version 4.0). My data are nested (children within schools) so I am using a two level design, but as I have no predictors on the school level, I am only specifying a within model. The problem is the MODEL INDIRECT command, as soon as I add this to the model, it doesn't run anymore. Here is my input and error message: MODEL: %WITHIN% ws BY w_s1* w_s2 w_s3; ……. nb2 ON ws wn wh wtv nb1; agg2 ON nb2 ws wn wh wtv agg1; agg1@1; …. MODEL INDIRECT: %WITHIN% agg2 IND nb2 ws; agg2 IND nb2 wn; agg2 IND nb2 wh; agg2 IND nb2 wtv; agg2 IND nb2 nb1; OUTPUT: TECH1 TECH4 TECH8 SAMPSTAT STAND CINTERVAL; *** ERROR No valid keyword specified. (for full input see: http://pastie.org/private/vt5vw78zqnnlnnx63th2a ) I hope you can give me advice. Thank you in advance! Best, Roos 


You are not using MODEL INDIRECT correctly. %WITHIN% is not part of it. See the user's guide under MODEL INDIRECT and Example 3.16 to see the correct specification for MODEL INDIRECT. 


Hi, I am not sure what's wrong with the model command for indirect effect. Below is my model command and I got this error message: *** ERROR in MODEL INDIRECT command Statements in MODEL INDIRECT must include the keyword IND or VIA. No valid keyword specified. Please advise. Thanks. Model Indirect: AOC IND POS A1; AOC IND POS A2; AOC IND POS M1; AOC IND POS M2; AOC IND POS O1; AOC IND POS O2; AOC IND POS LMX; 


I would need to see the full output to understand why this message appears. Please send it and your license number to support@statmodel.com. 


I have a 2level model with no latent variables. I am specifying an indirect effect of a level 2 variable through a second level 2 variable on the level 1 outcome. Everything works fine and I obtain indirect effect estimates and standard errors. However, I do not get any direct or total effect estimates in the output. I am specifying it thus: %BETWEEN% y on x1 x2; x1 on x2; MODEL INDIRECT: yIND x1 x2; any suggestions? thank you, Patrick 


I believe you get those using VIA when there is more than one way to get from x2 to y. There is only one in your model. 

kirsten way posted on Thursday, February 09, 2012  5:44 pm



Hello, Is it possible to do bootstrapping with type is two level random in the new Mplus version 6 to check for mediation? Thank you for your answer! 


No, this is not currently possible. 


I have diary data (about 200 individuals reporting data on 5 workdays) and would like to predict a daylevel outcome (EE2) from a daylevel state variable(Md) and a daylevel mediator (SAd). As a model I used the 111 MSEM fixed slopes model described by Preacher et al., (2010). As control variables, I wanted to include a level1 lag variable EE2b representing the dependant variable EE2 on the previous day (EE2b). Doing so yields unplausibel results (compared to what I get when doing a similar model in R) and an Mplus error messages. My code was. ... USEVARIABLES = id EE2 EE2b SAd Md; MISSING ARE ALL (99); CLUSTER IS id; CENTERING = GRANDMEAN (SAd EE2b Md); ANALYSIS: TYPE IS TWOLEVEL RANDOM; MODEL: %WITHIN% SAd ON Md(aw); EE2 ON SAd(bw); EE2 ON EE2b Md; %BETWEEN% Md SAd EE2; SAd ON Md(ab); EE2 ON SAd(bb); EE2 ON EE2b Md; MODEL CONSTRAINT: NEW(indb indw); indw=aw*bw; indb=ab*bb; It would be great if you could give me some advice. Thanks in advance Ute 


Please send the output and your license number to support@statmodel.com and explain what about the results is implausible. 


Dear Linda, I am aware that MODEL INDIRECT is not yet available for TYPE=TWOLEVEL. But, I need to report the indirect effects in the paper. I would like to know how to calculate the indirect effects by hand. Many thanks. Pat 


Dear Linda, In relations to previous, all variables are continuous variables. Thanks. Pat 


MODEL INDIRECT is available with TYPE=TWOELEVEL. Indirect effects with all continuous variables are the product between the regression coefficients involved in the indirect effects. 


Dear Linda, Sorry I didn't make it clear. I can't request for the indirect effect from within to between level variables from the multilevel analysis with TYPE = TWOLEVEL. Can I calculate the regression coefficients involved in these indirect effects as advised? Thanks. Pat 


Also, please could you advise how to calculate the significance level of the indirect effects? Thanks. Pat 


You can't have an indirect effect that uses one within coefficient and one between coefficient. You can on between regress the between part of the individuallevel variable on a betweenlevel covariate. 


Are you suggesting that it is invalid to calculate the cross level indirect effect even by hand or that Mplus does not provide this feature in TWOLEVEL analysis type? I have seen some published papers used Sobel test to examine the significance level of the mediating effect. These papers studied crosslevel effect from group level predictors to individual level outcomes. My study is also testing a crosslevel effect, but from individual level predictors to group level outcomes. Do you think that I can use Sobel test to examine the significance level of the mediating effect for my case? Thanks. Pat 


The way to have an effect from a variable Y observed for individuals on a grouplevel outcome W is to have the grouplevel part of Y have an effect on W on level2. That's what Linda is saying. This is not a restriction particular to Mplus. Quoting you: "These papers studied crosslevel effect from group level predictors to individual level outcomes." That is talking about W having an effect on the grouplevel part of Y (not the other way around), and thereby influencing the variable observed for the individual. 


Hai, I test a multilevel mediated moderation model in Mplus. Actually my moderation affects an indirect and not mediating effect (because the interaction term relates to the mediator but not to the outcome). Below my model and questions: At both levels of analysis, IVs are: com, pre, pro, preXcom & proXcom. Mediators are: jc1, jc2 & jc3. Outcomes are: we & adapt. The indirect/mediating processes I’m interested in are: 1. pro to we (via jc1, jc2, jc3) 2. pro to adapt (via jc1, jc2, jc3) 3. preXcom to we (via jc1, jc2, jc3) 4. preXcom to adapt (via jc1, jc2, jc3). Pro is expected to relate to we & adapt, therefore, I assume processes 1 and 2 refer to mediation. preXcom is not expected to relate to we or adapt, therefore, I assume processes 3 and 4 refer to indirect effect. I know that Bootstrap is not available in a twolevel model, but I want to show to the reviewers that I take into account mediation/indirect effects in my paper. i. Can I follow the 4 steps of Baron & Kenny and conduct Sobel tests to test processes 1 and 2? ii. If I ask for indirect effects through the IND command for the processes 3 and 4, is this enough, or is it inadequate when there is not a Bootstrap next to it? iii. For the processes 1 and 2, I can also ask for indirect effects through IND in Mplus. Would that be preferable compared to Sobel? Thank you very much in advance. Paris 


Because you cannot use the BOOTSTRAP option with TWOELEVEL, I would suggest ESTIMATOR=BAYES. 


Hi, I want to analyze if three latent varialbes mediate (F2, F3, F4) the effect between variable F1 and F5 by using the bootstrap technique. Therefore I have used the model indirect option (F5 IND F1), but the output never shows all three as mediators. What could I be doing wrong? Or ist it not possible to have three mediators? Thank you very much! 


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

Cecily Na posted on Saturday, April 06, 2013  9:48 am



Hello Linda, I have an SEM where the indirect path coefficients from A to B are positive, but the direct effect from A to B is negative. What's the command for me to get the total effect? Does it mean that my model has some problems? Thanks! 


The total effect is obtain by using an IND statement with one variable on the lefthand side and one on the righthand side. See the user's guide. 

anne C posted on Monday, August 26, 2013  4:47 am



Hello, I am running a mediation analysis using TYPE=Complex because of the structure of my data. I obtain a significantly positive direct effect c': Y> X, a significantly positive "a" path: Y>M, a significantly negative "b": M>X. when I run the same analysis on M>X only (ignoring Y) I get positive non significant coefficient. Is it correct to conclude that "the effect of Y>X is positive" while the effect of M>X, not due to Y, is negative? Thanks in advance 


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


Hi, I am starting with MPlus6. I want to calculate a multilevel moderated mediation model. Mediation is 211. Moderation is in the my relation. I want to incorporate L2 (c21,c22) and L1 (c11c13) control var. Input: Between are x c21 c22; Define: mz = m * z; Analysis: Type = twolevel; Model: %WITHIN% y m z mz; y ON m (g1) z (g3) mz (g2) c11 c12 c13; %BETWEEN% y x m z mz; m ON x (b) c11 c12 c13 c21 c22; y ON m (g1) z (g3) mz (g2) c11 c12 c13 c21 c22; MODEL CONSTRAINT: NEW (indirect mod); mod= 1,1; indirect = b*(g1+g2*mod); OUTPUT: CINTERVAL; Warning: In the MODEL command, the following variable is a yvariable on the BETWEEN level and an xvariable on the WITHIN level. This variable will be treated as a yvariable on both levels: m THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY DUE TO AN ILLCONDITIONED FISHER INFORMATION MATRIX. THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY DUE TO A NONPOSITIVE DEFINITE FISHER INFORMATION MATRIX. THE CONDITION NUMBER IS 0.233D16. THE STANDARD ERRORS OF THE MODEL PARAMETER ESTIMATES COULD NOT BE COMPUTED. PROBLEM INVOLVING PARAMETER 26. What could I be doing wrong? Thanks. 


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


Hi, I am testing a multiple mediation model: x1, x2 (predictors); m1, m2, m3 (mediators) and y1, y2 (outcomes). Every variable has been measured twice. The two measures are nested within persons, resulting in a multilevel mediation. I'm testing this model and getting results both at the between and at the within level. This model is essentially crosssectional. But is there a way to restructure my dataset in such a way that any path from x or m variables to y variables is lagged? So all x/m > y paths are longitudinal (T1 to T2) but not the x > m paths? Thank you in advance! Paris 


I would put my data in the wide format and not use multilevel modeling. Let the multivariate analysis take care of nonindependence of observations due to repeated measures. 

jonas helao posted on Friday, January 24, 2014  1:55 pm



I have a question. I have binary mediators and a binary outcome. I want to build a random intercept (fixed slope) model. Can I use this specification or is this specification only allowed for continuous outcomes/mediators? 111 model with fixed slopes (MSEM) TITLE: 111 mediation (MSEM) DATA: FILE IS mydata.dat; ! text file containing raw data in long format VARIABLE: NAMES ARE id x m y u; USEVARIABLES ARE id x m y u; CLUSTER IS id; ! Level2 grouping identifier within = x m y between = u ANALYSIS: TYPE IS TWOLEVEL RANDOM; MODEL: ! model specification follows %WITHIN% ! Model for Within effects follows m ON x(aw); ! regress m on x, call the slope "aw" y ON m(bw); ! regress y on m, call the slope "bw" y ON x; ! regress y on x %BETWEEN% ! Model for Between effects follows y ON U MODEL CONSTRAINT: ! section for computing indirect effects NEW(indw); ! name the indirect effects indw=aw*bw; ! compute the Within indirect effect 


You need the CATEGORICAL option for the mediators and outcome if they are binary. Otherwise, I think the specification looks okay. You don't need RANDOM for a random intercept model only for a random slope model. See Examples 9.1 and 9.2. The indirect effect cannot be defined as the product with maximum likelihood estimation and a categorical outcome. See the following paper on the website for the proper specification: Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus. These effects will be automated in the next version of Mplus. 

jonas helao posted on Saturday, January 25, 2014  11:27 am



Thank you. What do I have to change in the code above? It is not clear for me in the reference. 

jonas helao posted on Saturday, January 25, 2014  1:05 pm



I mean: how to model the indirect effect. The rest is clear to me. 


If you can't understand how to specify the indirect effects from the paper mentioned above, you will need to wait until Version 7.2 where they will be automated. 


Hi, I am running a multilevel model described by Hayes in his handouts (www.afhayes.com/public/aps2013.pdf) slide 25. My problem is with my dependent variable that is highly skewed. When I define it as a categorical or as a censored variable I receive an error message. So these are the MPLUS code lines: INPUT INSTRUCTIONS ... VARIABLE: .. categorical are pctunrep; usev are pctunrep moral AUTOR ; cluster = organiz; between = AUTOR ; analysis: type = twolevel random; estimator=mlf; model: %within% s_b  pctunrep on moral; %between% [s_b] (bw); s_b with moral pctunrep; moral on AUTOR (a1); pctunrep on moral (bb); pctunrep on AUTOR (cp1); MODEL CONSTRAINT: new (dir1 ind1 ) ; ind1 = (a1)*(bw+bb); dir1 = cp1; this is the error: *** ERROR in MODEL command Observed variable on the righthand side of a betweenlevel ON statement must be a BETWEEN variable. Problem with: MORAL *** ERROR The following MODEL statements are ignored: * Statements in the BETWEEN level: PCTUNREP ON MORAL When I omit categorical are pctunrep; the model runs perfectly. All the best Claudio 


When you add the CATEGORICAL option, numerical integration is required. This is the difference. You can put a factor behind moral and use that on the righthand side of on, for example, fmoral BY moral@1; moral@0; 


great ! I'll try ! thanks Linda ... as usual ! All the best Claudio 


hi Linda still problems when using the solution you suggested. Here's the model analysis: type = twolevel random; estimator=mlf; ALGORITHM=INTEGRATION; model: %within% fmoral_W by moral@1; moral@0; s_b  pctunrep on fmoral_W; %between% fmoral_B by moral@1; moral@0; Fautor by AUTOR@1; AUTOR@0; [s_b] (bw); s_b with fmoral_B pctunrep; fmoral_B on Fautor (a1); pctunrep on fmoral_B (bb); pctunrep on Fautor (cp1); MODEL CONSTRAINT: new (dir1 ind1 ) ; ind1 = (a1)*(bw+bb); dir1 = cp1; here the problems... THE ESTIMATED WITHIN COVARIANCE MATRIX COULD NOT BE INVERTED. COMPUTATION COULD NOT BE COMPLETED IN ITERATION 1. CHANGE YOUR MODEL AND/OR STARTING VALUES. THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY DUE TO AN ERROR IN THE COMPUTATION. CHANGE YOUR MODEL AND/OR STARTING VALUES. Any suggestion ? Thanks Claudio 


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


Dear Prof. Bengt and Linda, My model consists only mediation effect. I have one IV, 3 mediators, and two DVs. DV is dependent variable, IV is independent variable, M11 and M12 are two parallel mediators, M2 is the third mediator. The structure of my model is: M11 ON IV; M12 ON IV; M2 ON M11 M12; DV1 ON M2 M11 M12 IV; DV2 ON M2 M11 M12 IV; Question1: I want to compute all possible direct and indirect effects from IV to DV1 and DV2. Should I write syntax like this? Model indirect: DV1 ind IV; DV2 ind IV; Output: STDXY CINTERVAL(BCBOOTSTRAP); Question2: Should I also add the following syntax in “Model indirect” section? Is the following “via” syntax already included in “DV1 ind IV; DV2 ind IV;”? DV1 via M2 M11 IV; DV1 via M2 M12 IV; DV1 via M11 IV; DV1 via M12 IV; DV2 via M2 M11 IV; DV2 via M2 M12 IV; DV2 via M11 IV; DV2 via M12 IV; Question3: From abovementioned 8 relationships, I want to find which one is the main relationship from IV to DV1, and which one is the main relationship from IV to DV2. How could I find the dominant path, from pvalue or from estimate coefficient? Does more significant pvalue stand for main relationship or the big value of estimate coefficient stand for main relationship? Thank you so much and I look forward to your reply. Warm regards Xiaoshuang 


Q1: Yes Q2: Yes Q3: A simple approach is to go by biggest estimated effect among those that are significant. You can also test if two or more effects are significantly different using Model Constraint but that is more advanced. 


Dear Prof. Bengt, Thank you so much for your reply! From my result of STANDARDIZED TOTAL, TOTAL INDIRECT, SPECIFIC INDIRECT, AND DIRECT EFFECTS, only the followings are significant: Effects from IV to DV1 Total 0.468 0.065 7.232 0.000 Specific indirect DV1 M2 M11 IV 0.229 0.091 2.529 0.011 Effects from IV to DV2 Total 0.243 0.073 3.324 0.001 Question1: Do these results mean that only mediation path about IVM11M2DV1 is significant? Since only one specific indirect path is significant, the rest 7 relationships are all meaningless? There is no mediating path from IV to DV2. What could I do to modify these results? Question2: Effects from IV to both DV1 and DV2 are significant. Does this mean the path from IV to DVs without mediation is significant? Thank you very much and I look forward to your reply. Warm regards Xiaoshuang 


You may want to direct these interpretation questions that are not directly Mplus related to a general discussion forum such as SEMNET. 


Hi Bengt and Linda, I am running a parallel process mediation model. I notice that after I add a certain number of paths (based on the modification indices), I no longer get results on specific indirect and direct paths (that is, the output no longer shows these); I only have total and total indirect. I am not sure what I did wrong. Thanks, Christine 


We need to see your output to see exactly what the situation is  please send to support. 


Hello Professor, Per my reading of this thread, it is impossible to perform bootstrap in twolevel (random) analysis, right? Then, is the indirect effect from "twolevel (random) analysis" based on sobel test? If not, what kind of estimation method does it use? Thanks! 


Bootstrap for twolevel is not implemented in Mplus yet  it is a bit of a research topic. Twolevel random uses the Delta method SEs (of which Sobel's test is a special case) with ML SEs and symmetric confidence intervals, that is, assuming a close to normal estimate distribution. That can be relaxed by using Bayes confidence intervals (called credibility intervals). 


Than you so much. The information helps me quite a lot. Have a wonderful day! Jaewan 


Hi I seem to have problem opposite Christine Meng 24April, 2015. The outputs I get using version 7 for Total,Total indirect, Specific In Direct and Direct effects using output: sampstat stdyx cinterval(bcbootstrap) Are different from what Geiser ( Data Analysis with mPlus) gets using version 5.1? I do not get (i) Total (ii)Direct effects. Where can I get them? Rohan 


If you say Y IND x; you get all effects. 


Thank you so much, yes that did the trick. 

Jinxin ZHU posted on Monday, December 21, 2015  5:21 pm



Dear Linda, I am now using Mplus Version 7.2 to conduct a twolevel analysis with categorical variables as indicators of a factor. I got the Error Message :"MODEL INDIRECT is not available for TYPE=TWOLEVEL with ALGORITHM=INTEGRATION.". Is there any solution to this problem or has it been fixed in the latest version? Thank you so much. 


You can use Model Constraint to define effects. 

DavidBoyda posted on Saturday, February 27, 2016  9:32 am



Dear Dr muthen, I think I have encountered a situation that I am unable to explain. I have a model whereby the total effect of X  Y is insignificant while the ab paths are. I havent come across this before and Im wondering why the results tell me that the indirect effect is significant: y3 on X8 0.167 0.407 0.409 0.682 m5 on x8 0.978 0.379 2.578 0.010 M5 on y3 0.990 0.162 6.122 0.000 Y3_M5_X8 0.969 0.413 2.345 0.019 


That can happen. A negative direct effect can cancel out a positive indirect effect. It may be discussed in the MacKinnon mediation book. If m5 is the mediator why do you say m5 on y3 instead of y3 on m5? 

DavidBoyda posted on Monday, February 29, 2016  8:27 am



Thank you so much Bengt. Oh when I posted that syntax I was in a rush  the Mplus code is correct. Apologies for that. 


Dear Bengt and Linda, I'm attempting to use Mplus 7.4 estimate the indirect effect at the within level for a twolevel model for an X>M1>M2Y change where M1 and M2 are continuous and Y is binary. Numerical integration is invoked so MODEL INDIRECT is not available. I was curious to know if it is legitimate to use MODEL CONSTRAINT as shown below to compute the indirect effect at the within level as the product of the three direct effect pathways? Bengt's reply to a similar question on 12/21/2015 implies this is possible, but I wanted to double check whether it would apply to this type of regression model with a binary Y. Thanks so much, Tor Neilands Within is interv gender; Categorical are hivtest ; Analysis: Type = Twolevel ; Estimator = WLSMV ; Model: %Within% dose_con ON interv (a) gender ; cmscore ON dose_con (b) interv gender ; hivtest ON cmscore (c) dose_con interv gender ; %Between% dose_con; cmscore; hivtest; Model Constraint: New ind ; ind = a*b*c ; 


I think you can do that if you are aware that you are getting the indirect effect for the continuous latent response variable behind the observed binary hiv outcome. 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 shows that the effect on the observed binary outcome needs counterfactuallydefined effects. But this hasn't been explicated for a model with sequential mediators nor for a multilevel version of that. 


I am interested in modeling the indirect effect of two predictors (x1 x2) through one mediator (m) to a dichotomous outcome (y). This model constraint command seems to give me the indirect effects separately for x1 and x2 through m to y. How would I revise this to obtain the indirect effect of x1 through m to y after accounting for the effect of x2 through m to y? Thank you in advance for your help. MODEL: Y ON M (b1); Y ON X1 (cdash1); ! direct effect of X1 on Y Y ON X2 (cdash2); ! direct effect of X2 on Y M ON X1 (a1); M ON X2 (a2); MODEL CONSTRAINT: NEW(a1b1 ORa1b1 a2b1 Ora2b1); a1b1 = a1*b1; ! Indirect effect of X1 on Y via M ORa1b1 = exp(a1*b1); a2b1 = a2*b1; ! Indirect effect of X2 on Y via M Ora2b1 = exp(a2*b1); 


The indirect effect of x1 on y controls for x2 and vice versa. Note also that there is a better way to express effects for a dichotomous outcome  using only a and b is not sufficient. This is described under the heading: Counterfactual causal effects for mediation modeling on our Mediation webpage: http://www.statmodel.com/Mediation.shtml 


Hello, I am running a mediation model with type=complex. This is my syntax: m on x (a); y on m(b); give on x (cdash); MODEL CONSTRAINT: new (direct indirect total); indirect = a*b; direct = cdash; total = cdash+a*b; Is there any way to get output of the standardized regression coefficient of the direct, indirect, and total effects? Currently all I see in the output is the unstandardized effects... Thank you! 


Have you included the STANDARDIZED option in the OUTPUT command? 


Hi Linda, yes, I included the standardized option in the output and I see the standardized results of the usual regression coeficient (i.e., 'm on x', 'y on m'...). The only thing that I don't see is the standadized results of the New/Additional Parameters. Thank you again for the help 


That is not provided because it depends on which variables are involved. You can express the standardization in Model Constraint by expressing the relevant variances in terms of model parameters. 


I am looking to run a mediation model using the code below, and am getting this message: "*** ERROR in ANALYSIS command BOOTSTRAP is not allowed with ALGORITHM=INTEGRATION." Do you know how I should modify my code to run the model with bootstrapping? As you can see, I do not specify ALGORITH=INTEGRATION. Thank you!  VARIABLE: Names ID X M cv Y; USEVARIABLES X M cv Y; count is y(nb); ANALYSIS: TYPE = GENERAL; ESTIMATOR is ML; BOOTSTRAP = 1000; ! In model statement name each path using parentheses MODEL: Y ON cv; Y ON M (b1); Y ON X (cdash); ! direct effect of X on Y M ON X (a1); ! Use model constraint to calculate indirect and total effect MODEL CONSTRAINT: NEW(a1b1 TOTAL); a1b1 = a1*b1; ! Indirect effect of X on Y via M TOTAL = a1*b1 + cdash; ! Total effect of X on Y OUTPUT: sampstat CINT(bcbootstrap); 


Are you using version 7.4? 


I am using version 6.1. 


This is not available in Version 6.1. 

Belen Tena posted on Friday, January 20, 2017  12:54 am



In this thread I read that MODEL INDIRECT was not available for TYPE=TWOLEVEL. I want to use TWOLEVEL RANDOM: Is MODEL INDIRECT now available for version 7? Don't I need to use MODEL CONSTRAINTS to define the indirect effects? Thanks 


When Model Indirect is not available, use Model Constraint for the effects. 


Hi, I am running a multilevel model described by Hayes in his handouts (www.afhayes.com/public/aps2013.pdf) slide 25. So these are the relevant MPLUS code lines: analysis: type is random twolevel; MODEL: %within% wrong benefit harm; sb wrong on benefit harm; %between% cond benefit wrong harm; [sb] (bw); benefit on cond (a); wrong on benefit harm (bb); wrong on cond harm (cp); sb with benefit wrong ; MODEL CONSTRAINT: NEW(indirect direct); indirect = a*(bw+bb); direct = cp; When I run the code this way, the estimate of the indirect effect has a pvalue of .004. What I am puzzled about, is that in an earlier version of Hayes' code, which is described as serving the same purpose, the direct effect is not named (so no (cp) after "wrong on cond harm" and no direct = cp in the model constraint.) And when I run the model without those "cp" pieces, the results for the indirect effect look quite different (p=.11). I'm confused  from my reading of the code, all that the (cp) is doing is simply naming that direct effect. Can someone help me understand why that small change would alter my indirect effect results? 


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


I am trying to figure out how I can get standardized results for direct and indirect results when I use model constraint in a two level model. On September 28, 2016, you specified that: That is not provided because it depends on which variables are involved. You can express the standardization in Model Constraint by expressing the relevant variances in terms of model parameters. Could you pleas say a bit more about how you would do this? Thanks in advance. 


Use Model Constraint to create ind = a*b and then standardize by stind = ind*sdx/sdy; where you have to express sdx and sdy (their modelestimated standard deviations) in terms of model parameters. 


Dear Mplus Team, I am running a relatively complex model  to obtain estimates of the indirect effects I run it with 2,500 bootstraps. I include in my analytic sample individuals who have missing responses on some variables; additionally for some of the binary variables relatively few individuals are in one of the two categories (I still wish to use these variables as are important for my analysis). When I run the model approximately 3% of the bootstrap draws do not complete. Looking at the output obtained from the TECH9 command the only reported issues (which occur in around 1% of the draws) are an empty cell in a bivariate table (i.e. I never obtain "No convergence. Number of iterations exceeded" etc.). What is causing me confusion is the discrepancy between the number of non converged bootstrap draws and the number of draws for which I obtain a warning message from the output of the TECH9 command. 1) Do you know of a precise (and readily implementable way) to identify which draws did not converge (versus which ones warned of an empty cell in a bivariate table)? 2) Do you know of any (hopefully published) rules of thumb concerning what level of "non completion" in bootstrap draws is generally considered acceptable? Any guidance would be very appreciated Best Dan 


Hello Drs. Muthen, I'm running a PATH analysis with mediation. X, Y, and M are all categorical and I have four categorical covariates. The correlation between X and Y is positive and significant and if I run a PATH analysis without the covariates (just to see the relationships), the direct path between X and Y remains positive and significant (with a positive, significant indirect path). All of this makes sense, as all three of these relationships are hypothesized to be positive. When I introduce the covariates into the model (regressing M and Y onto the 4 variables, but NOT X, as instructed in one of your other threads), the relationship between X and Y becomes nonsignificant (ok, fine... there's full mediation), but the relationship changes to negative (95% CI: 0.075, 0.006). Perhaps the change in sign doesn't matter because the relationship is no longer significant, but the change caught me by surprise and without explanation. However, one of the covariates is very strongly related to Y, M is (obviously) strongly related to Y, and the correlation between X and Y wasn't that strong to begin with (though significant), so maybe it's much ado about nothing, but I wanted to check so that I can allay the concerns of my colleagues and reviewers. Thank you! Jordan 


I think your results seem possible/ok. But with Y and M categorical I would recommend using the modern approach to indirect and direct effects using counterfactuals. This is described in our Topic 11 video and handout at http://www.statmodel.com/course_materials.shtml 


Dear, Since I have categorical mediators/outcomes (including missings), I have used a numerical INTEGRATION (montecarlo). Is there any way to obtain indirect effects, since the MODEL INDIRECT command does not work in my case? Thanks and happy holidays everyone! 


This works  see UG about Model Indirect and counterfactual effects (also described in our book Regression and Mediation Analysis using Mplus). 


Dear! I need to test a three level serial mediation model with independent variable(level 1), mediator 1 (level 1), mediator 2 (level 2) and dependent variable(level 2) such that employees are nested in supervisors and the supervisors nested within hotels and restaurants. Kindly can I request for the code as well as the way to interpret the results. Regards 


Is the level 2 mediator the level2 part of the level 1 mediator or is it another variable altogether? Does the independent variable on level 1 vary also on level 2? 

kenny posted on Sunday, January 28, 2018  10:56 pm



Hi Prof Muthen, I would like to ask in Mplus 8, is specific model indirect still provided in output file when using "IND" command? 


You get that if you don't mention the mediator, so y IND x; 

Katy Roche posted on Wednesday, August 22, 2018  8:19 am



Since we cannot run bootstrapping on a model that uses type=complex, what options exist for testing indirect effects? Should I generate replicate weights to obtain bootstrapped SEs and CIs with clustered data even if I'm not using complex survey data (e.g, I don't use weight otherwise)? 


Bootstrap is available for type=complex. See User's Guide example 13.19. If you don't have a weight variable you will need to add a weight variable of 1 like this: variable: usevar= ... w; weight=w; define: w=1; 


Hi Mplus Team, I'm running a series of related multilevel models using Bayesian estimation. I'm interested in calculating indirect paths using the random slopes from level 1. Level 2 of my models simply have all random slopes and intercepts correlating with each other. For the indirect paths I am using the formula Random slope of Var1 on Var2 * Random slope of Var2 on Var3 + the correlation of those random slopes. I have two questions that have come up during this process: 1. Some of the models will run when I have one or two indirect effects, but when I add a third (or more) I get the following error: *** FATAL ERROR THE VARIANCE COVARIANCE MATRIX IS NOT SUPPORTED. ONLY FULL VARIANCE COVARIANCE BLOCKS ARE ALLOWED. USE ALGORITHM=GIBBS(RW) OR ALGORITHM=MH TO RESOLVE THIS PROBLEM. I'm having trouble understanding why this error is occurring. Is the error resulting from my approach to calculating the indirect effects? 2. I understand that Mplus currently does not calculate standardized estimates of indirect effects with Bayesian estimation. Would you please recommend a resource for how I might go about calculating these by hand? Thank you in advance. 


1. See our FAQ: Bayes block diagonal covariance matrices 2. Use Model Constraint to express the standardized indirect effect ("ind")as ind*sx/sy where sx is the standard deviation of x and sy the one for y. Values of sx and sy can be used, but better is to express these in terms of model parameters. 

Back to top 