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 email@example.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 two-level models in version 4.1? (At least I get some output - I only wonder whether this can be used?)
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 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?)
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 time-lagged" 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).
Instead of having a growth curve for the mediator, you would use it as a time-varying covariate and lag it. I think Example 6.12 is close to what you want. You should get a good-fitting growth model for your outcome as a first step.
I would like to test a moderation effect on between-level. Interaction between moderator (3-level 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?
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 x-variables 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 am trying to estimate a multi-level 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;
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 have a 2-level 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;
I have diary data (about 200 individuals reporting data on 5 workdays) and would like to predict a day-level outcome (EE2) from a day-level state variable(Md) and a day-level mediator (SAd). As a model I used the 1-1-1 MSEM fixed slopes model described by Preacher et al., (2010). As control variables, I wanted to include a level-1 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
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
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
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 individual-level variable on a between-level 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 cross-level effect from group level predictors to individual level outcomes.
My study is also testing a cross-level 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?
The way to have an effect from a variable Y observed for individuals on a group-level outcome W is to have the group-level part of Y have an effect on W on level-2. That's what Linda is saying. This is not a restriction particular to Mplus.
"These papers studied cross-level effect from group level predictors to individual level outcomes." That is talking about W having an effect on the group-level part of Y (not the other way around), and thereby influencing the variable observed for the individual.
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 two-level 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?
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!
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 left-hand side and one on the right-hand side. See the user's guide.
anne C posted on Monday, August 26, 2013 - 4:47 am
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?
Hi, I am starting with MPlus6. I want to calculate a multilevel moderated mediation model. Mediation is 2-1-1. Moderation is in the m-y relation. I want to incorporate L2 (c21,c22) and L1 (c11-c13) 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 y-variable on the BETWEEN level and an x-variable on the WITHIN level. This variable will be treated as a y-variable on both levels: m THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY DUE TO AN ILL-CONDITIONED FISHER INFORMATION MATRIX. THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY DUE TO A NON-POSITIVE DEFINITE FISHER INFORMATION MATRIX. THE CONDITION NUMBER IS -0.233D-16. THE STANDARD ERRORS OF THE MODEL PARAMETER ESTIMATES COULD NOT BE COMPUTED. PROBLEM INVOLVING PARAMETER 26.
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 cross-sectional. 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?
I would put my data in the wide format and not use multilevel modeling. Let the multivariate analysis take care of non-independence 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?
1-1-1 model with fixed slopes (MSEM)
TITLE: 1-1-1 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; ! Level-2 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
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.
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 right-hand side of a between-level 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
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 p-value or from estimate coefficient? Does more significant p-value 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
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 IV---M11---M2---DV1 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
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.
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).
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
I'm attempting to use Mplus 7.4 estimate the indirect effect at the within level for a twolevel model for an X->M1->M2-Y 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,
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 ;
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), 12-23. DOI:10.1080/10705511.2014.935843
shows that the effect on the observed binary outcome needs counterfactually-defined 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);
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.
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.
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);
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
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 p-value 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?
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?
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 non-significant (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.
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