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. 

Back to top 