Message/Author 


I am attempting to test a moderated mediation model where X>M>Y (all observed variables) is moderated by w, a binary variable (gender). I know how to examine this with a multiple group approach but am attempting the approach described in Preacher, Rucker & Hayes (2007) in Figure 2 model 5 where W influences paths a and b of the mediation chain. With some help from Preacher & Hayes, I have modeled this as pasted below. However, all of the estimates SEs, ps, CIs are exactly the same for all of the paths with the exception of X>M and M>Y. This seems very odd to me. Can you point me to what I might be doing wrong? Thank you. ANALYSIS: BOOTSTRAP = 1000; MODEL: M WITH MW; M ON X (a1) W XW (a3); Y ON M (b1) X W XW MW (b2); MODEL CONSTRAINT: NEW(eff1 eff2); eff1=(a1+a3*1)*(b1+b2*1); eff2=(a1+a3*2)*(b1+b2*2); OUTPUT: CINTERVAL(bcbootstrap); 


Can you send your input, data, output, and license number to support@statmodel.com. 


I should have seen this earlier. The label b2 after x, w, ex, and mw holds all of those regression coefficients equal. It should be stated as: Y ON M (b1) X W XW MW (b2); 


Thank you. The results make much more sense now. Now it is only the M on W and M on MW results that are identical. Does it make sense that this would be the case? Might this be because the MW crossproduct involves a binary variable (coded 1 & 2)? 


I think you mean M on w and Xw. It is the same issue. The label needs to be on the next line. M ON X (a1) W XW (a3); 


Ah, yes. All looks well now. Thank you again for the help. 


Drs. Muthen, I am attempting to fit a Moderated Mediation model with simple (single level) survey data. Specifically, I wish to examine the moderating influence of a dichotomous variable (Mod) effect coded (1, +1) on the 'A', 'B', and 'Cprime' paths as seen in Edwards and Lambert (2007; Model H). I realize that the multigroup function of Mplus may be used in this specific instance(e.g. a categorical moderator), however I would like to retain the more traditional 'cross product' approach for two reasons: 1) To replicate OLS estimates for all paths, 2) I am often interested in similar models with continuous moderators where multigroup analysis is not appropriate. IV and Mod were centered prior to importing into Mplus, and product terms were created using a DEFINE statement. I use the following code: MODEL: Med on Mod IV IVxMod; ! 'A' Path Y on Mod IV IVxMod Med ModxMed; ! 'B' and 'Cprime' Paths MODEL INDIRECT: Y IND Med IV; The resulting model has df = 1 and a significant ChiSq. Examination of RESIDUAL matrix suggests a notable covariance between Med and ModxMed. Adding a covariance parameter results in a notpositive firstorder derivative matrix. I have run into this problem before in the past, and I have a hunch that it stems from the fact that Med is an endog variable. Any advice? Thanks 


If you obtain standard errors, the message most likely comes from the fact that the mean and the variance of your binary variable are not orthogonal. You can ignore the message if this is the case. 

Hong Deng posted on Thursday, May 10, 2012  8:10 pm



Dear Drs. Muthen, I’m trying to test a moderated mediation model with nested data. Data for all my variables were collected from individual and the level of interest is individual too. Basically it is a 111 mediation model (xmy)with a level 1 moderator (w). It should be an easy one if my data isn’t nested in several clusters. Is it possible to test such a model in Mplus? How should I write my Syntax. Thanks very much. 


Moderation can be handled by a multiple group analysis if the moderator is categorical or by creating an interaction term between the moderator and the variable being moderated. You can use TYPE=COMPLEX to take the nonindependence of observations into account. Modify Example 3.11 and add CLUSTER to the VARIABLE command and TYPE=COMPLEX to the ANALYSIS command. 


I am attempting to conduct a moderated mediation analysis where all variables are latent variables formed with continuous indicators. In my model, the independent variable (X) functions as a moderator of the b1 path (the path from the mediating variable to outcome). This model is illustrated in Preacher, Rucker & Hayes (2007)  Figure 2, Model 1. I get an error message that says: MODEL INDIRECT is not available for TYPE=RANDOM. 1. Is it possible to do moderated mediation with a latent interaction variable? 2. Any guidance as to how to generate syntax for this model would be greatly appreciated. Best, Elizabeth 


This type of model is discussed in Section 3 and Section 5 of Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus. which is on our web site under Papers, Mediational Modeling. As stated in Section 3, Model Indirect cannot be used for this type of model. Section 5 shows how to define the direct and indirect effects instead using Model Constraint. 


Dear Drs. Muthen, I am currently running a moderated mediation model (X > A > Y with the pathway from A to Y being moderated by gender) using the following syntax: Y on X; A on X(Med1); Y on A(Med2); Y on Gender A*Gender; MODEL CONSTRAINT: NEW(Indir1); Indir1=Med1*Med2; This model revealed significant moderated mediation; however, correlations suggested that moderation could also be expected on the pathway between X and A. When I checked for moderation of this pathway it also revealed significant moderated mediation. I've been told that presenting a model with both moderated pathways is inappropriate and that I need to check to see which model is best; however I am unsure of how to do this. Do you have any advice or syntax for such a problem? Many thanks in advance, Paula 


I would suggest a 2group analysis with gender as the grouping variable. You can then easily test if the two paths are the same or different across gender. I can't see why a model with both paths differing across gender would be inappropriate. 

Luisa Rossi posted on Thursday, October 25, 2012  4:32 am



Dear Drs Muthen, I have been running some mediation analyses and found that the x>y relationship was mediated by m. I would now like to see if the a and b paths of the indirect models are different depending on whether respondents score high or low on a number of personality measures. So far, I have used multiple group comparisons with difftest to assess this. I am now thinking there may be a better way to do it but I am not sure. Can you help? Thanks, Luisa 


Why are you dissatisfied with your approach? Is it because your moderator is continuous and you are categorizing it? See Example 3.18 in the Version 7 Mplus User's Guide on the website for another approach to moderated mediation. 

Luisa Rossi posted on Thursday, October 25, 2012  10:08 am



Hi Linda, Thanks for the tip! I will look at the example. I am unsure whether multiple group comparison is the most effective way to look at moderated mediation or whether reviewers may criticize it. Thanks again! 


There are two ways to look at moderation. One is multiple group and the other to create an interaction variable. 

Luisa Rossi posted on Tuesday, October 30, 2012  7:03 am



Hi Linda, I work with survey data so I had to impute my dataset to account of missing data. I noticed that difftest cannot be used with imputed data so I am thinking about using the interaction variable approach. The example you recommended above seems to be based on path analysis (?) as it is able to use the define option after the usevariable one. I am working with latent variables so I first need to define them  however, mplus is not happy for me to use 'define' within the 'model' option. What can I do? 


With latent variables, you should use the XWITH option for interactions. DEFINE is for observed variables. You don't include it in the MODEL command but above or below it. 

Luisa Rossi posted on Wednesday, October 31, 2012  5:15 am



Thanks Linda! AS I am interested in the potential moderating role of w on path a and b, I adapted the model 5 example in Preacher, Rucker, and Hayes (2007) but I used the XWITH command to obtain the two interaction terms mw  m XWITH w; xw  x XWITH w; and included these interaction terms in the model as they suggest: MODEL: y on m (b1) x w mw (b2) xw; m on x (a1) w xw (a3); I find that there is no evidence for a moderating role of either mw or xw (Ps>.05). However, when I had run the multiple group comparisons using w as the grouping variable I had found that it moderated path a (not b)... I am slightly confused on why this might be... can you help? are the 2 approaches not 100% comparable? 


These two approaches should yield identical results. Please send the two outputs and your license number to support@statmodel.com. 

C. Lechner posted on Monday, January 14, 2013  7:58 am



Dear Drs. Muthén, I am testing a moderated mediation model where the moderator is a latent variable; i.e., there is a latent interaction using the XWITH command involved. Because this requires TYPE=RANDOM, the STANDARDIZED output is not available in these analyses. However, I would like to report Rsquare values for my outcomes. > Is there any way to obtain Rsquare values for these analyses? Many thanks in advance! Clemens 


See the FAQ Latent Variable Interactions on the website. 

C. Lechner posted on Thursday, January 17, 2013  7:38 am



Thanks, Linda. I have a followup question: Using the formulas provided in the FAQ, I programmed myself an Excel spreadsheet that calculates Rsquare, change in Rsquare, and standardized path coefficients. It reproduces the numbers from your example on p. 6 in the FAQ sheet perfectly well. However, I wonder how one would generalize the equations from the FAQ sheet to include covariates. In my model (otherwise identical to Fig.2 on p.7), all three latent variables are regressed on a set of covariates. > How do I get the total variances of the latent variables in this case? My approach was to sum all the product terms of the squared regression weights and the variance of the respective predictor, plus the residual variance of the latent variable (which I get in the output). E.g., for a latent variable eta2, regressed on eta1 and covariates x1 and x2, where b1 to b3 denote regression coefficients and zeta2 the residual variance of eta2, the total variance would be obtained by computing: Var(eta2) = b1^2 * Var(x1) + b2^2 * Var(x2)+ b3^2 * Var(eta1) + Var(zeta2). However, this seems to systematically underestimate rsquare. > Have I overlooked anything? > Is there any way to directly get the total variance of a latent variable that is regressed on a set of covariates in the Mplus output? 


You need the variances of the two factors in the interaction. I think you are using the residual variances. If the variances are not available in TECH4, you will need to compute them. 

C. Lechner posted on Thursday, January 17, 2013  9:42 am



TECH4 is unavailable for TYPE = RANDOM. I tried to compute the variances of all latent variables in the way described above. Referring to the notation in Figure 2 in the FAQ sheet, extended by two covariates x1 and x2 for each latent variable, I compute Var(eta1) = b11^2 * Var(x1) + b12^2 * Var(x2)+ ß^2 * Var(eta2) + Var(zeta1) Var(eta2) = b21^2 * Var(x1) + b22^2 * Var(x2)+ Var(zeta2) Var(eta3) = b31^2 * Var(x1) + b32^2 * Var(x2)+ ß1^2 * Var(eta1) + ß2^2 * Var(eta2) + 2*ß1*ß2*Cov(eta1,eta2)+ß3^2*Var(eta1*eta2) + Var(zeta3) where eta1 is regressed on eta2 (coefficient ß), eta3 is regressed on eta1 (coefficient ß1), eta2 (coefficient ß2), and their interaction (coefficient ß3), all three latent are regressed on the covariates x1 and x2 (coefficients bij), zeta_i denote residual variances for the latent variables; and where Var(eta1*eta2) = Var(eta1)*Var(eta2)+[Cov(eta1,eta2)]^2 and Cov(eta1,eta2) = ß*Var(eta2). > Is this correct? There must be something missing. Rsquares are substantially smaller than the ones Mplus computes for a model without interaction. 


In your eta1 equation you have to express eta2 in terms of the x's so that eta1 is written as a function of these x's. You also have to take into account that the x's are correlated and add a term like for the et1 equation: 2*Cov(x1, x2)*b11*b12. 

C. Lechner posted on Friday, January 18, 2013  1:04 am



Thanks you, Bengt – I think the covariance term is what I had overlooked. I'll add it and see whether the numbers add up to something that makes sense then. As this involves a lot of manual computation when more covariates are involved, I wonder whether there is any easy workaround? E.g., could one simply estimate the factor variances in a measurementpart only model (without the covariates and structural paths) and use those as input for the calculations of standardized parameters and rsquare in the final model? I'm afraid that would bias the variance estimates, wouldn't it? 


It might be too approximate. 

ywang posted on Friday, March 29, 2013  12:49 pm



Dear Drs. Muthen: I have a question about how to decide the signficance of the moderated medaition. M is a mediator and W is a moderator (gender, 0 and 1). For the following input: ANALYSIS: BOOTSTRAP = 1000; MODEL: M ON X (a1) W XW (a2); Y ON M (b1) X W XW MW (b2); MODEL CONSTRAINT: NEW(eff1 eff2); eff1=a1*b1; eff2=(a1+a2)*(b1+b2); Should we test the indirect effect of a2*b1 and a1*b2 in order to conclude the signficant moderated mediation? Thank you very much in advance! 


Seems like you have set it up right. One thing you want to test is the difference between eff1 and eff2. To test significance of the moderation in the mediation, don't you want to test that a2*(b1+b2) is significant? Both the difference and this last term can be given NEW names so you get ztests. 


Hello! I wanted to ask a question about a post from the first author on this post regarding a model he created from your 2007 Conditional Indirect Effects Paper, working from "Model 5". In line with the model, I am confused about the role of eff1 and eff2. Having performed previous mediations with the eff1 = a*b, this makes sense to me based on the M ON (X & XW) and Y on (M & MW) paths. I am confused about the eff2 role of multiplying each by 2  what would this be representing? Thank you! Leslie MODEL CONSTRAINT: NEW(eff1 eff2); eff1=(a1+a3*1)*(b1+b2*1); eff2=(a1+a3*2)*(b1+b2*2); OUTPUT: CINTERVAL(bcbootstrap); 


One and two standard deviations above the mean of zero for the moderator. 


Hello, I am attempting to complete a moderated mediation in which my predictor and mediator variables are latent and I have a categorical and latent outcome. The format follows Preacher’s Model 5 in which the moderator impacts both paths a and b. The moderator variable has 4 categories (Black, White, Hispanic, Other). Would it be best to utilize the multiple group function, comparing all 4 racial groups together? Though, I am unsure of how to complete group comparisons from there. Or would it be better to run models with several dummy codes representing the moderator? 


I would suggest doing multiplegroup analysis, letting the a and b paths vary. 


I found most other researchers would calculate the critical ratios of differences(CRD) by dividing the difference between two estimates by an estimate of the standard error of the difference (Arbuckle, 2003). A CRD greater than 1.96 indicates that there was a significant difference between the two parameter estimates at p < 0.05.However, they usually do this in the Amos software. However, in the Mplus result part, I cannot find the standard error of the difference. I am wondering how can you do this through the results provided by Mplus? 


My question is, I want to do multigroup analysis to identify whether the path coefficients differ significantly between east and west. We compared the first model, which allows the structural paths to vary across cultures, with the second model, which constrains the structural paths across cultures to be equal to examine the cultural differences. All the other paths (i.e., factor loadings, error variances and structure covariances) were constrained to be equal. However, I found the factor loading are still different in the Mplus result part. Are there other things that need to be constrained equally? By the way, do you have any sample code for me to do such a multiple group comparison of the mediation model? Thanks. 


You can use MODEL TEST to do the CRD test. See the user's guide. See the Topic 1 course handout on the website under multiple group analysis to see the inputs for testing for measurement invarinace. 

JOEL WONG posted on Tuesday, October 08, 2013  5:28 pm



I am attempting to test a first and second stage moderated mediation model. I have one predictor, one outcome, one mediator, and one moderator (W). W is hypothesized to moderate the relationship between the predictor and the mediator and the relationship between the mediator and the outcome. This model is described as model 58 in Hayes' PROCESS manual  see http://mres.gmu.edu/pmwiki/uploads/Main/process.pdf Does anyone know the Mplus syntax for this model? Preacher et al. (2007) provides the Mplus syntax for several moderated mediation models, but it doesn't include this model. Thank you. 


UG ex 3.18 describes the case of a moderator Z that moderates the influence of the predictor X on M and X on Y. That involves creating X*Z in Define. A plot of the effects and their confidence bands are obtained by LOOP. So that's the first part of your question. The second part is the moderation of the M>Y relationship. This calls for creating M*Z and regressing Y on it. LOOP could be used here as well. 


Hello, Thank you for your previous suggestion in running my moderated mediation with 2 latent predictors, continuous mediator, and binary outcome. I have 4 groups, and have tested the model using the indirect command and bootstrapping (with BC confidence intervals). To compare the effect size of the indirect effects across groups. Would it be acceptable to examine whether the confidence intervals between groups overlaps as a means of testing for significant differences? Or is there a better way to test whether the effect sizes are significantly different (e.g. running a difftest where I constrain paths a and b and compare them to a nonconstrained model)? Also, when I run the mediation for the whole sample, the mediation is significant. However, when I run the mediation using multigroup, the indirect effect is no longer significant in any of my four groups. Would it be safe to say that this could be due to sample size issues (as, I have already established measurement invariance in my predictors) 


You should use DIFFTEST. Yes, lower power could be the reason for this. 

Laura Baams posted on Tuesday, October 29, 2013  9:02 am



Hi, I am running a bootstrap multigroup mediation model with observed variables. Two predictors (x1, x2), two mediators (m1, m2) and one outcome (y). There are 5 groups for the multigroup part. I have compared model fit of a model in which I constrain all paths to be equal across groups, and a model in which they are not equal, and variations of this. The model with the best fit, is the one where groups 1 and 2 are constrained to be equal, and group 3 and 4 are constrained to be equal. I need to report the standardized estimates, but these are not equal for groups 1 and 2, or 3 and 4, while the unstandardized estimates are. From other posts I understand that Mplus does not constrain standardized estimates, does this mean I cannot report standardized estimates in this case? Is there a way I can still obtain standardized estimates (that are equal across groups 1 and 2; and 3 and 4)? Thanks so much! 


The standardized coefficients are standardized using different standard deviations for each group. This is why the coefficients are different. It is not because they are not constrained to be equal in the analysis. 


Dear Drs Muthén, I am running a moderated mediation model based on Preacher, Rucker & Hayes (2007) model 3: the path from mediator m to y is moderated by w. The output shows that all paths are significant at p =.000. However, the fit indexes are as follows: AIC 195.379 BIC 221.996 SampleSize Adjusted BIC 171.948 ChiSquare Test of Model Fit Value 12.001 Degrees of Freedom 2 PValue 0.0025 RMSEA Estimate 0.358 90 Percent C.I. 0.182 0.565 Probability RMSEA <= .05 0.004 CFI 0.958 TLI 0.852 ChiSquare Test of Model Fit for the Baseline Model Value 243.003 Degrees of Freedom 7 PValue 0.0000 SRMR 0.311 Can I consider that my model is significant, relying on the significance of the paths? Thank you for your input, Patricia 


Model fit is not assessed using the significance of the model parameters. The fit statistics indicate that leaving out the two paths represented by the two degrees of freedom create a lack of fit. 

Hannah Lee posted on Sunday, March 30, 2014  2:17 pm



Hello, I am trying to run a moderated mediation model (Similar to Model 2 as Hayes and Preacher 2007 shows). The IV, Moderater are latent constructs and I am unable to use the MODEL INDIRECT with the latent interactions. So I referred to Muthen (2011) sections 3 and 5 using BOOTSTRAP=1000; and OUTPUT: cinterval(bootstrap); But I keep getting the error message that bootstrap cannot be used with TYPE=RANDOM. How can I get the indirect/total effects? ==================================== ANALYSIS: TYPE = RANDOM; bootstrap = 1000; MODEL: x1 BY CPI1CPI3; x2 BY CPC1CPC3; w BY CCC1CCC3; m BY NPA1NPA5; d BY Perf1 Perf6; x1xw  x1 XWITH w; x2xw  x2 XWITH w; d ON m (b1) x1 x2 w x1xw x2xw c1 c2; m ON x1 (a1) x2 (a2) w x1xw (a3) x2xw (a4) c1 c2; MODEL CONSTRAINT: new (ind wmodval); wmodval = 1; ind=(a1+a3*wmodval)*b1; ind=(a2+a4*wmodval)*b1; OUTPUT: SAMPSTAT STAND; cinterval(bootstrap); *** ERROR in ANALYSIS command BOOTSTRAP is not allowed with TYPE=RANDOM. 


Drop the bootstrap request. If your sample size is not small it is unlikely that bootstrap SEs would be very different from regular ML SEs. 

Hannah Lee posted on Sunday, March 30, 2014  7:07 pm



Thank you, Dr. Muthen. Would N=201 sample size be sufficient? Some of the tvalues for the indirect effects come out to be borderline significant. I was wondering if this may be improved if I were able to bootstrap. 


I would not worry unless the sample size is less than 100. I would be conservative as far as significance goes given that you are not doing a single test but several tests. 

CW posted on Tuesday, April 22, 2014  10:53 am



I have used the following syntax to test a moderated mediation model: y ON m (b); m ON x (gamma1) z xz (gamma2); However, I am now realizing that this did not include a test of y on x, which seems like the typical c path in a mediation model. Can you explain to me why did is not present in this syntax, and is it necessary? Thank you! 


Whether you include a direct effect in your model is up to you. Your research hypothesis should determine this. 

Alvin posted on Thursday, May 01, 2014  10:31 pm



Hi there, I estimated a moderated mediation model (similar to that of Hayes and Preacher). All looks good except I did not get fit statistics in my output, even though I did it without bootstrap. Can you advise? many thanks Here's the relevant bit of the syntax: Analysis: Type = random; ALGORITHM=INTEGRATION; Model: pte by conflict family witness access child; adapt by safety bonds justice roles exist; stress by basic health dispa safe; ptexad  pte xwith adapt; whodas12 on pte (b1) adapt stress ptexad; stress on pte (a1) adapt ptexad (a3); Model constraint: new (ind wmodval); wmodval = 1; ind=(a1+a3*wmodval)*b1; Information Criteria Akaike (AIC) 9305.490 Bayesian (BIC) 9484.270 SampleSize Adjusted BIC 9319.462 (n* = (n + 2) / 24) 


Chisquare and related fit statistics are not available when means, variances, and covariances ore not sufficient statistics for model estimation. This is the case for numerical integration. 

Alvin posted on Friday, May 02, 2014  7:48 pm



Thanks very much Dr Muthen for the quick reply. I could not do it without numerical integration however. Is there a way to get fit statistics without using numerical integration. If not, how do I know if my model fits? In terms of interpreting the outcome, is it correct to say that the putative moderator did not moderate the mediating relationship between the IVs and DV, as the interaction product (ptexad) was not significant? 


When there are no absolute fit statistics, nested models can be tested using 2 times the loglikelihood difference which is distributed as chisquare. Nonnested models with the same set of dependent variables can be compared using BIC. If the interaction is not significant, there is no moderation. 

Alvin posted on Wednesday, May 07, 2014  1:27 am



Thanks. Another question is the output does not give standardized coefficients as this was not allowed under Type=random analysis .. Is there a way to obtain standardized estimates as I'm interested in the effect sizes 


Because the variance of y varies as a function of x with TYPE=RANDOM, we do not give standardized estimates. 

Alvin posted on Wednesday, May 07, 2014  5:44 pm



Thanks Dr Muthen  it probably doesn't make sense then to standardize the estimates of the effect size, does it? Also, I notice boostrap can not be used to construct CIs in this case with a randominterceptrandomslope model. Why is that? 

Alvin posted on Wednesday, May 07, 2014  6:06 pm



A further question Dr Muthen is, I notice in model 5 by Preacher et al, the value of w at which the conditional indirect effect of x is estimated is set to 1. Is this an accepted practice? The authors refer to the JohnsonNeyman (Jn) technique where a region of significance or a range of values of w is used in lieu of using arbitrary conditional values of w. Is this method used in analysis of moderated mediation models? 


The variance of y varies as a function of x for any random effect. In this case, standardization is not done. If you add ALGORITHM=INTEGRATION; to the ANALYSIS command, I think you can use BOOTSTRAP. 1 is probably one standard deviation below the mean. This is a common choice. See Example 3.18 where you can get a plot that shows a region of significance. 

Alvin posted on Thursday, May 15, 2014  11:41 pm



Thanks Dr Muthen. I wanted to look at the significance level of a particular set of indirect paths (beta1 x beta2) in the mediation part of the moderated mediation model, as this path (beta2) dropped out (not significant) after building the moderators into the model. Of interest is whether this could be due to power issues (as I have a small sample size). In randomeffect analysis however Mplus does not allow modelindirect command. Is there an alternative way to request estimates of indirect/direct effects in this case? 


See Slides 8085 of the Topic 7 course handout on the website. 


I have an environmental observed variable of maltreatment, one observed impulsivity mediator, and a latent antisocial variable as my outcome. I'm interested in using genotype as a moderator. The problem is my moderator (genotype) is categorical and my maltreatment variable is categorical (no maltreatment, emotional abuse, physical abuse). I understand that the common practice in SEM is to use multiple group comparisons. This is my problem and confusion. Recent recommendations by GxE experts call for all covariates to be included as interaction terms in your model. For example, I will have race and age as covariates in my SEM (full partial). However, it's now recommended that you should also add "race x environment" and "age x environment" as covariate terms in addition to having them be "main effect" terms. The Age x environment term is easy to add as a covariate because age is continuous. Race is not so easy, because it's categorical. Thus I'm not sure how to "control" for these other moderation effects that include categorical variables. Do I just do a massive multiple group comparison? I've considered dummy coding the categorical moderator variables, so that I can create interaction variables and add everything in one SEM rather than do many group comparisons. That way I can appropriately add covariates where I want (full partial). Is that bad practice? Any advice? 


Seems like (1) dummy coding categorical variables and creating interactions is a relatively simple way to go. (2) Multiplegroup modeling is also fine, but you would either have to combine that with interaction terms or do groups as maltreatment x genotype (so 6 groups). Approach (1) allows only different regression effects while approach (2) also allows different (residual) variances for DVs. You may want to ask this type of general modeling question on SEMNET. 

Alvin posted on Monday, July 28, 2014  4:54 pm



Dear Dr Muthen, following a mediated moderation model, I ended up with unstandardized estimates. I was wondering since standardization isn't available in randomeffect models, are there alternative ways for standardizing the estimated coefficients manually? I've previously obtained unstandardized estimates from a similar model but without interaction terms, and they look similar to the one with interaction effects. Does it make sense to obtain standardized effects in this case? this is a fair question that I anticipate reviewers may ask. Many thanks 


What are your Model command statements that give rise to a random effect model? 

Alvin posted on Monday, July 28, 2014  5:34 pm



Here's the relevant bit of the syntax. The model was estimated using algorithmintegration. Many thanks Model: pte by conflict family witness access child; adapt by safety bonds justice roles exist; stress by basic health dispa safe; ptexad  pte xwith adapt; stxad  stress xwith adapt; whodas on pte (b1) adapt stress (c1) ptexad stxad (b2); stress on pte (a1) adapt ptexad (a3) stxad with stress; whodas on dsmany; Model constraint: !plot(indirect); !loop(mod,1,2,0.1); new (ind wmodval); wmodval = 1; ind=(a1+a3*wmodval)*(b1+b2*wmodval); new(ac); ac = a1*c1; 


Hi! I have problems when computing moderated mediation with 2 moderators (no problems if I run the analysis separately for each moderator): MAXIMUM LOGLIKELIHOOD VALUE FOR THE UNRESTRICTED (H1) MODEL IS 10455.691 THE ESTIMATED COVARIANCE MATRIX IS NOT POSITIVE DEFINITE AS IT SHOULD BE. COMPUTATION COULD NOT BE COMPLETED. PROBLEM INVOLVING VARIABLE VBFS_1. THE CORRELATION BETWEEN VBFS_1 AND ZETA_2 IS 1.000 THE PROBLEM MAY BE RESOLVED BY SETTING ALGORITHM=EM AND MCONVERGENCE TO A LARGE VALUE. Syntax for the analysis with 2 moderators. analysis: type=random; model: wo_1 by … ; gro_1 by … ; vbf_1 by … ; int1  plum_1 XWITH vbf_1; plum_1 on la_1 ze_1 wo_1 (a1) gro_1 (a2) vbf_1 (a3); ze_2 on plum_1 (b1) la_1 ze_1 int1; int2  plda_1 XWITH vbf_1; plda_1 on la_1 ze_1 wo_1 (a4) gro_1 (a5) vbf_1 (a6); leng_2 on plda_1 (b2) la_1 ze_1 int2; MODEL CONSTRAINT: NEW (ind1 ind2 ind3 ind4 ind5 ind6); ind1 = a1*b1; ind2 = a2*b1; ind3 = a3*b1; ind4 = a4*b2; ind5 = a5*b2; ind6 = a6*b2; Can you help me? Thanks a lot. 


You should ask yourself why THE CORRELATION BETWEEN VBFS_1 AND ZETA_2 IS 1.000 Two variables that correlate one cannot both be used in an analysis. They are not statistically distinguishable. 


Alvin  you are using XWITH. For standardization with XWITH, see our FAQ: Latent variable interactions. 

Alvin posted on Tuesday, July 29, 2014  6:55 pm



Many thanks Dr Muthen. Can I just clarify, following the equations set out in your FAQ, in order to calculate the standardized coefficient of say beta1(direct effect)  beta1 by square root of V (n1) where V is the variance of latent factor 1 and n1 is ? 

Pieter Baay posted on Wednesday, July 30, 2014  12:10 am



Dear Linda, I'm performing two moderated mediation analyses (one with observed categorical moderator, one with latent continuous mod) and I wonder which moderator value(s) to specify in the MODEL CONSTRAINT. For the categorical moderator, I wrote: X BY x1x4; M BY M1M5; Y BY Y1Y8; XM  X XWITH MOD; Y ON M (a) X; M ON X (gamma1) mod XM (gamma2); MODEL CONSTRAINT: new(pinde pindeN test); pinde = a*(gamma1+gamma2*1); pindeN = a*(gamma1+gamma2*0); test = pinde  pindeN; Is this correct? And what would this look like for a continuous, latent moderator? In previous posts (e.g. by Hannah Lee and Alvin), a moderator value of 1 was specified. Could you please explain what the 1 represents (especially given their construction of latent variables)? Thanks so much! 

annared posted on Wednesday, July 30, 2014  5:18 am



Dear Linda, Thanks for your quick answer. If I use wo_1 instead of vbf_1 to build the interactions (int1 and int2) I get the same error message (i.e. that the correlation between wo_1 and ze_2 is 1.0). However, in both cases the correlation is not 1.0 when I run the analysis without int2. So I guess I have something wrong with my syntax? Thank you! 


Alvin  are you referring to the bottom of page 7? Two lines from the bottom has Sqrt{V(eta_1)}, where eta_1 refers to Figure 2. 


Pieter  that input looks correct. For a latent moderator you have to use the estimated factor variance and look at two values such as 1 SD below vs 1 SD above the factor mean of zero. 


Annared  send your two outputs to support. 

Zaijia posted on Friday, August 01, 2014  8:17 pm



Should the result of indirect effects from Mplus be the same as PROCESS? 


PROCESS(ORS) specified the hardware you the analysis uses and has nothing to do with estimated effects, only how long it will take to compute them. 

Zaijia posted on Saturday, August 02, 2014  7:31 pm



Hi, Dr. Muthen, thank you for your response. But I didn't mean the processor. I mean the Macro developed by Hayes for mediation analysis. Should the results from that macro be the same as Mplus? 


I am not familiar with Hayes' macro. If M and Y are continuous and you use ML I would assume you get the same results. 

Zaijia posted on Sunday, August 03, 2014  1:08 pm



Yes, I found that when Y is dichotomous the results are different. Why does that happen? Another question is how to add interaction term into Mplus?For example, I have 2 dichotomous IV, one mediator, one DV and I want to test the moderated mediation effect, what will the syntax be like? 


Question 1: Take a look at the paper on our website: Muthén, B. & Asparouhov T. (2014). Causal effects in mediation modeling: An introduction with applications to latent variables. Forthcoming in Structural Equation Modeling. Question 2: See the second bullet of our Mediation page http://www.statmodel.com/Mediation.shtml 

Zaijia posted on Sunday, August 03, 2014  2:13 pm



That's really helpful!Thank you so much! 

Zaijia posted on Sunday, August 03, 2014  2:19 pm



What does this following syntax in your mediation page mean? MODEL INDIRECT: y MOD m z (2 2 0.1) xz x; 


See the Version 7.2 Mplus Language Addendum on the website with the user's guide. 

Pieter Baay posted on Tuesday, August 05, 2014  12:14 am



Thank you for the suggestion to use + 1SD and 1SD above the factor mean of zero, based on the factor variance. I've got two followup questions: 1) I think I should use the factor variance of the latent interaction effect rather than the factor variance of the moderator. Is this correct and if so, how can I obtain its value? 2) Is the mean of factors (such as XM) automatically set to zero or should I add a statement to do so? Or, alternatively, should I use the mean /+ 1 SD as moderator values? Thanks again for your help! 


1) No. And, this value is not a parameter, so not available. 2) The mean of a latent variable interaction is not a parameter and should not be referred to. For moderator values, see the Latent Variable Interaction FAQ. 

Alvin posted on Wednesday, August 06, 2014  10:41 pm



Many thanks Dr Muthen. Can I ask  my model is a probit model (with a categorical outcome variable, the others are continous) would it be possible to specific a logit model to derive ORs? Thanks v much for your help! 


You can obtain a logistic model by using maximum likelihood estimation. WLSMV gives a probit model. 


I am working on a multilevel mediated moderation model. Technically that should be the same as a moderated mediation (like Model 2 in Preacher, Rucker & Hayes, 2007). The indpendent (Intr) and dependent variable (Irri) in the model have been measured every day over five days (Level 1). Both the moderator (Age) and the mediator (WM) are traits (Level 2). I know that a crosslevel interaction usually is modelled by regressing the moderator on the random slope. But I need to treat the crosslevelinteraction as a variable. Can I use the DEFINEcommand for a crosslevelinteraction, and what should I do with the random slope? Or maybe there is another solution? USEVARIABLES ARE Intr Age WM Irri iact; MISSING = All(99); CLUSTER IS id; BETWEEN ARE Age WM; DEFINE: iact = Intr *Age; ANALYSIS: TYPE IS TWOLEVEL RANDOM; MODEL: %WITHIN% s  Irri ON Intr; %BETWEEN% Intr Age WM Irri; Irri ON WM(b1) Intr Age iact; WM ON Intr(a1) Age iact(a3); MODEL CONSTRAINT: NEW (ind wmodval); wmodval=10; ind=(a1+a3*wmodval)*b1; OUTPUT: TECH1 TECH8 CINTERVAL; Your help is appreciated! 


If you have %within% s  y on x; %between% y s on w; s@0; Fixing the residual variance s@0 is the same as working with an observed variable xw = x*w. You see this is you write out the formulas (or look at slide 45 of our Topic 7 handout). In practice you have to fix at a small value such as 0.01. 


Thanks for your quick answer. I checked the handout, and the examples in the users guide, but still I am puzzled how to model the indirect effect between a crosslevelinteraction (IV = Level 1, Mod = Level 2, DV = Level 1), and a Level 2 Mediator? What I want to test is a mediated moderation. 

Shiny posted on Saturday, August 16, 2014  2:39 pm



I am testing a moderated Mediation model, with categorical DV. Moderator=mod. Mediators=m. I want to see how mod interacts with the IV (x) and influences the path a (similar to Preacher et al 2007 model 2) The input in mplus is as follow: USEVARIABLES ARE x1 x2 x3 mod m1 m2 m3 y1 y2 y3 y4 y5; CATEGORICAL =y4 y5; ANALYSIS: TYPE = RANDOM; MODEL: xw BY x1 x2 x3;!IV mw BY m1 m2 m3;! Mediator y1w BY y1 y2;!DV1 y4 ON y3 (E); DV3 on DV2 y5 ON y1w(D); y3 ON mw (C); y1w ON mw(B); mw ON xw (A); Here starts with the moderator: y3 y1w ON mod xwmod;! Regress dv1 2 on interaction and moderator mw ON mod;! Regress mediator on moderator xwmod  xw XWITH mod; mw ON xwmod (A2);! Regress mediator on interaction MODEL CONSTRAINT: NEW(AB BD ABD wmodval AC CE ACE); AB = (A+A2*wmodval)*B; BD = B*D; ABD = (A+A2*wmodval)*B*D; wmodval =1; AC = (A+A2*wmodval)*C; CE = C*E; ACE = (A+A2*wmodval)*C*E; OUTPUT: TECH1 CINTERVAL; This Syntax is based on Preachers script. Is it correct? do i need to Regress the distal DVs (y4 y5)on moderator and interaction? Since bootstrap is not possible with Random, can I rely on the CI without Boot?! Thx! 


This looks correct. You may also want to use LOOP plotting (see our Mediation topic in the left column of the home page). I would regress y4 and y5 on moderator and interaction. Bootstrap is available with Random in Version 7.2. 

Shiny posted on Monday, August 18, 2014  3:30 pm



Thank you Dr. Muthen. I looked at the Output. before moderator was added, all Regression and indirect effects were significant. Adding interaction and moderator, neither interaction nor moderator and indirect effect significant. Does it mean there is no moderated Mediation effect? The Mediation model: Xw (latent variables) mw( latent mediator)  y1w (latent)  y5 (categorical) Xw mw y3  y4 (binary) Interaction is xw * mod, named as xwmod Y4 ON Y3: estimate =0.594 p= 0.054 Y5 ON Y1w: 0.316 p=0.046 Y3 ON Mod(moderator):0.075 p= 0.310 y3 on Mw(mediator):3.260 p=0.000 y3 on Xwmod(interaction):0.027 p=0.503 Y1w ON mw (mediator) : 2.891 p=0.000 y1w on Xwmod(interaction) 0.022 p= 0.417 y1w on Mod(moderator): 0.105 p= 0.026 mw ON xw: 0.181 p= 0.004 mw on Xwmod: 0.006 p= 0.783 mw on mod:0.037 p= 0.110 New/Additional Parameters estimate p AB 0.506 0.032 BD 0.913 0.072 ABD 0.160 0.133 WMODVAL 1.000 1.000 AC 0.571 0.047 CE 1.937 0.088 ACE 0.339 0.167 Because I have categorical DV, by Default estimator is MLR, but bootstrap does not Support MLR. When I used WLSMV, then I cannot use Random. What can I do to get bootstrap function? Thx! 


It's a tricky situation. You have y4 binary and y5 categorical, which means that you need to carefully consider how indirect and direct effects are computed; see Muthén, B. & Asparouhov T. (2014). Causal effects in mediation modeling: An introduction with applications to latent variables. Forthcoming in Structural Equation Modeling. Your model is more complex because of the multiple indirect effects. You may get away with considering the latent response variables y4* and y5* as the relevant DVs which is ok with MLR. I would not worry about bootstrapping unless your sample size is low. If your mod variable can be categorized you can use multiplegroup modeling instead of XWITH and then do this using Bayes where no bootstrapping is ever needed. 

Shiny posted on Monday, August 25, 2014  2:08 pm



In your paper (page 8) it said: a*b effect is only valid for the underlying continuous latent response variable y*, not for the observed categorical outcome y itself. Does it mean I can not use MODEL CONSTRAINT and specify NEW (ab) and ab=axb, if I use original categorical y? Must binary y be converted into y*? 2. If so, how shall i modify in d original syntax? Shall I write something like: CATEGORICAL =y4 y5; DEFINE y4 = y4* y5=y5*??? Then change the original path y4 (binary) on y3 into y4* on y3? 3. Can I use ANYLSIS: ESTIMATOR IS WLSMV AND BOOTSTRAP instead of bayes in multiple groups? 4. I did a multiple Group Analysis to test if the mediation effect differs across two Groups(Group H, Group L). Input: MODEL CONSTRAINT: NEW(AHBHDH ALBLDL) AHBHDH=AH*BH*DH;! Indirect effect in group H ALBLDL = AL*BL*DL; !indirect effect in group L DIFF = AHBHDH  ALBLDL; Output (Bootstrap 5000) AHBHDH 0.531 0.425 0.376 0.166 0.030 0.006 0.042 ALBLDL 0.320 0.241 0.199 0.047 0.032 0.054 0.093 DIFF 11.874 6.308 4.536 0.884 0.311 0.520 1.160 I can see in group H, there is an indirect effect at 95% CI, yet this indirect effect does not exist in group L. However the difference test includes 0. does the indirect effect differs across groups? 


2. You can still use a*b when the continuous latent response variable is considered the distal outcome. 3. Yes. 4. No. Think of it this way. You have 2 estimates and you have zero that you can line up as: 0.166 0.047 0 The value 0.166 is significantly smaller than zero but not significantly smaller than 0.047 because 0.047 is closer to 0.166 than zero is. 

Shiny posted on Monday, August 25, 2014  3:03 pm



Thank you very much for your prompt and helpful answer, Dr. Muthen. I Need a bit more Explanation of the 1st Point from your side. To simplify, let me just use a simple Mediation model(xmy). If I use a categorical y, what can I do in mplus to test Mediation? Use IND function but not the a*b? If I want to use a*b, according to your answer, it shall be y*? Would you be so Kind to give me a clue how to create y* in mplus? Thank you indeed! 

Shiny posted on Wednesday, August 27, 2014  12:37 pm



Dear Dr. Muthen, could you pls tell me how to code y* (continuous latent Response variable) in mplus? I have an observable binary y (not latent). Shall i simply replace y with y*? I have not found related script. Thank you for your help! 


You don't have to create y*. If you use WLSMV then a*b refers to the effect on y*. So all you have to do is use WLSMV. 

Shiny posted on Wednesday, August 27, 2014  3:18 pm



That is great to know, since I did use WLSMV already. Is the coefficient a probit Regression weight or a normal Regression weight (if this is a y*)? In multiple Group Analysis, can I do the same wald test or chi difference test, working with constrained or free Parameters of y*, like treating it as a continous variable, once WLSMV is specified? Thank you very much for your helpful comment! 


Q1. a*b is a probit regression coefficient when you consider y to be the DV and it is a linear regression coefficient when you consider y* to be the DV; so the same coefficient plays two roles. Q2. Yes 

Shiny posted on Wednesday, August 27, 2014  4:43 pm



Thank you for your answers, I really appreciate them! 

Winnie Yang posted on Tuesday, November 11, 2014  4:59 am



Dear Drs Muthen, I am running a mediated moderation model. HP(X)>EP(M)>JS(Y). age as the moderator (W), HP, EP and JS are all latent variables, age is collected by asking participants to fill in their age ,so I believe that would be an observed variable.I have 4 questions below: 1. When creating a interaction variable, do I use XWITH command? I know that XWITH is suitable for latent variables only, while HP is a latent variable, Age is not. would XWITH still be right? 2. Assuming that I should use XWITH, I have the following syntax, do they look correct? ANALYSIS: estimator = ml; type = random; ALGORITHM=INTEGRATION; MODEL: HP BY HP101HP106; EP BY EP101 EP102 EP103 EP104R EP105 EP106R; JS BY JS101JS103; HCPxAGE  HCP XWITH AGE; JS ON EXP(B1) HCP AGE HCPxAGE; EXP ON HCP(A1) AGE HCPxAGE (A3); MODEL CONSTRAINT: new(IND W); W=1; IND=(A1+A3*W)*B1; 3. In terms of interpretation, if IND shows to be significant (p <.05), does that suggest then that W is a significant moderator? Or I would need to look at other areas for determination? 4. My model is actually more complicated than this. As a whole, I have 4 outcome variables and 2 independent variables and 2 mediators for each IV. Can I run it altogether then?Thanks! 


1. XWITH can be used for 2 latents or 1 latent and 1 observed. 2. Looks ok, but don't say AGE HCPxAGE (A3); because you can have only one parameter labeled per line. 3. Look at our website under Mediation (left margin of the home page)and you find the document Loop plot for ex 3.18 Make sure you understand this before going on with your analyses. If needed, read the Preacher, Rucker Hayes article we refer to in the UG. 4. Only after you got the simpler models under your belt. 

Back to top 