Message/Author 


I am running a path analysis with both continuous and categorical variables. My categorical variable (y1, with two categories) is a dependent variable. I have a continuous variable (x1) predicting y1. I did test the relationship by indicating the categorical variable as stated in the User's Guide. I have another variable x2, which is a continuous variable as a moderator in the relationship between x1 and y1 in my model. My hypothesis predicts that x2 interacts with x1 in predicting y1. I want to run this model as a multigroup analysis. I am using raw data in my analysis. Would there be anyone who can lead me stepbystep on how to test the moderating effect? Thank you very much. 


If I understand you correctly, you are interested in the interaction between x1 and x2 in predicting y1. If x1 and x2 are both continuous variables, then creating a variable that is the product of the two variables is the interaction term and can be used as a predictor of y1. Multiple group analysis can be used if the variable is categorical. 


Thank you Dr. Muthen for your responses. I got some more questions. Should I use the procedure mentioned above even if the moderating effect is toward the end of a long model: For example, x1>y1>y2>y3; and if I have a moderating variable, let's say x2, on the relationship between y2 and y3, should I create an interaction term for y2 and x2 and use it as a predictor or should I use a multigroup analysis? If I have to use multigroup analysis, how do I constrain the other paths (x1>y1 and y1>y2)so that I could see the differences of the two groups with respect to the effect on y2>y3 moderated by x2? Thank you for your unreserved and immediate responses. 


You can use either approach. If you use multiple group, you will need to categorize x2. The model statement would be as follows: MODEL: y3 ON y2; y2 ON y1 (1); y1 ON x1 (2); where the numbers in parentheses indicate that the parameters are to be held equal across groups. 


Professor Muthen, I did as you suggested, i.e., holding paths equal across groups. I would appreciate if you please help me with the following questions. 1. If I hold parameters equal, is there an LMTest that indicates a parameter that should be released? Or a chi square which I can compare? I see a note on the output not to trust the chi square indicated since I have a categorical dependent variable. Remember, the moderating effect I am testing is on the relationship between a continuous variable and a categorical variable. 2. How do I know whether or not the parameter I am interested in is different in the two groups? 3. When I run the model by holding the parameters equal, I got only the estimates (no S.E., std., StdX/Y and any indicator of the significance of the values. What should I do to know the significance of the paths? Can I send you the output so that you can see what is happening in there? I thank you very much for your responses. Respectfully yours, 


The note in the ouput warns that WLSM and WLSMV cannot be used for chisquare difference tests. This does not mean that they are not trustworthy for testing model fit. You can use WLS for chisquare difference testing. If you are not getting standard errors and the ratio of the parameter estimate to the standard error, then you must also be getting a message regarding thisfor example, your model must not be converging. If this is the case, you would also not get Std or StdYX. Note also that you must ask for Standardized in the OUTPUT command to obtain the standardized coefficients. Please send your output and data along with your license number to support@statmodel.com. 

finch posted on Wednesday, November 15, 2000  12:50 pm



I have two questions regarding SEM with MPlus. First, is it possible to test for the moderating effects of a latent variable in a lisrel type model? Secondly, is it possible to estimate nonrecursive models in MPlus? Thanks very much. 


The answer to both questions is yes. 

finch posted on Thursday, November 16, 2000  6:43 am



Linda, Thanks much for your response. I think that I asked questions that were too narrowly focused. My obvious next questions are, "How?" and "How?" I looked in the manual and couldn't find examples or discussion of either. I found the online discussion of moderation with observed variables, but am unsure how to apply that to the factors. Thanks for any help. 


I guess I could have elaborated a bit. If you want a latent variable to be a moderator variable, just use it on the right hand side of an ON statement. So, for example, f2 ON f1. For a nonrecursive model say, f1 ON f2; f2 ON f1; If you use the ON statements to describe the regressions among observed variables in your model and latent variables in your model that have been created using BY statements, Mplus automatically does any other manipulations that are needed. Let me know if this does not answer your question. 

Anonymous posted on Wednesday, December 13, 2000  7:28 am



Is there a way to do a latent variable interaction or nonlinear effects model such as those described in the Schumaker and Marcoulides book? 

bmuthen posted on Wednesday, December 13, 2000  8:22 am



There is a JoreskogYang chapter which describes how to do such modeling using nonlinear parameter constraints. This facility is not yet available in Mplus. 


In your response to a post (By Linda K. Muthen on Thursday, May 25, 2000  06:44 am) You replied: The note in the ouput warns that WLSM and WLSMV cannot be used for chisquare difference tests. This does not mean that they are not trustworthy for testing model fit. You can use WLS for chisquare difference testing. Do you mean by this that instead of the default estimator (WLSMV) for analyses with categorical indicators, that the WLS estimator can be selected in order to obtain a chisquare value that can be used for differnce testing? If not, how does one test for differences in multiple group analyses with categorical indicators? 


Yes, WLS can be selected in the ANALYSIS command using the ESTIMATOR= option. We recommend using WLS for difference testing and WLSMV to get a chisquare for the final model. 

Sandra Lyons posted on Saturday, February 09, 2002  7:55 am



I have a multigroup model with categorical indicators and want to test the equality of coefficients between the groups. But since the matrix is not positive definite, I can't do chisquare difference tests with WLS. I see that you have posted the steps to compute a chisquare difference test for the chisquare obtained with the MLM estimator. Is there something similar for the adjusted chisquare obtained with WLSMV. Alternatively, is there a way to hand calculate a significance test for the difference between two coefficients. 

bmuthen posted on Monday, February 11, 2002  7:05 am



The difference between two coefficients can be tested using the TECH3 output, giving the variances and covariance for the coefficients. The numbering of the parameters is shown in TECH1. The test is the approximately normal quantity diff/sd where diff is the coefficient difference and sd is the square root of v1 + v2  2 cov where v1, v2 and cov are the variance and covariance elements for the coefficients found in the TECH3 output. 


In testing the difference between two coefficients, should the chisquare difference test and diff/sd provide the same results (i.e. level of significance)? 


In large samples, they should be the same. 


In calculating t to test coefficient differences, I noticed that for WLS estimates t is significant, but t is not significant for WLSMV estimates because the difference is smaller and the s.e. is larger. Why is this? Since this is the case, how is it that WLS can be used for nested model testing for WLSMV estimated models? 


There can be differences between WLS and WLSMV particularly when the sample size is not large. The WLSMV results are more trustworthy. Because WLSMV cannot be used for difference testing, we recommend using WLS for this purpose only. We recommend WLSMV for the final model. 

Anonymous posted on Monday, March 17, 2003  8:34 pm



I am trying to test the moderating effect of a continuous latent variable on the relations between three other continuous latent variables in the model. I understand (via your post on 11/16/00) that by placing the moderator on the right side of the ON statement, you can test for moderating effects on the variables in question (ie. f2 f3 f4 ON f1 w/f1 as the moderator). However, where in the print out can I see whether this moderating effect influences the relations between the two predictors f2 f3 and the outcome variable f4? 


I am not sure that I understand your question, but I think that you are asking about indirect effects. If so, Mplus does not currently estimate indirect effects. You would have to do these by hand. If this is not what you mean, can you show your entire MODEL command and then tell me what you are not finding in the output? 

Anonymous posted on Tuesday, March 18, 2003  1:11 pm



I am sorry if I was unclear. I am attempting to determine whether my moderator, f1, influences the relations between f2 and f4 and f3 and f4. My model command is: Model: f1 BY y1y4; f2 BY y5y6; f3 BY y7y10; f4 BY y11y13; f2 f3 f4 ON f1; I have found the coefficients for the relations between the moderator and each factor and its significance. However, I am looking for any way to see if the inclusion of the moderator changes the relations between f2, f3, and f4. I appreciate your assistance. 


It sounds like you are interested in looking at the model estimated covariances among factors 2, 3, and 4 for two models  the model above without the ON statment and the model above as it is. In both cases, the model estimated covariances would be the same. Check TECH4 to see if that is the case. Also, the two models should have the same chisquare and degrees of freedom. This is because both models allow for all four factors to be freely interrelated. If this is still not what you are asking, please try again. 

Anonymous posted on Thursday, March 20, 2003  6:10 pm



I think I am still being unclear. I am trying to complete a standard moderation analysis with latent variables. I have read Jaccard & Wan (1995)'s article and have investigated that approach. From what I gather from your comments above, it is not possible to do this in MPlus because of the need for nonlinear constraints (12/13/00). I am trying to find an alternative to test if my moderator influences the direct relation between two other latent variables. I have been told that dichotomizing my moderator to create two data sets and using invariance testing on the models is not an appropriate approach. Therefore, I am looking for an alternative. I hope this clarifies my question. 

bmuthen posted on Thursday, March 20, 2003  6:29 pm



Let's see if this responds to your question. In your last message it sounds as if you are interested in the relationship between 2 latent variables, e.g. f3 on f2 where this relationship is moderated by a continuous variable, say x. To me, this is the same as x and f2 interacting in their influence on f3. If this represents what you want to do, we have the solution  see Mplus Web Note #6. If not, please try again. 

Paul Kim posted on Tuesday, April 29, 2003  4:44 pm



Hi Drs. Muthen, I've been trying to use a random slopes model but I'm running into a couple problems. 1). Is there any way I can conduct a random analysis with a categorical latent dependent variable? That is, I'd like to run a model that interacts a latent factor and an observed variable to see the effects on a categorical latent variable. 2). I'm using mplus version 2.13, but I'm getting an error that says that the Analysis=random command is not recognized. Is there an update or a patch or something I can get to allow the program to recognize this command? Thank you in advance. Paul 


1. This will be available in Version 3. 2. It is TYPE=RANDOM not ANALYSIS=RANDOM. 

Anonymous posted on Wednesday, December 17, 2003  11:03 pm



Is there a way to do a latent variable interaction or nonlinear effects model such as those described in the Schumaker and Marcoulides book? Or is It possible to do the model Including nonlinear constraints in MPLUS2.14? Thank you very much. 


Mplus Version 3 will have latent variable interactions using maximum likelihood estimation. I don't believe that what is described in the Schumaker and Marcoulides book is true maximum likelihood. Version 3 will also have nonlinear constraints. In Version 2.14 one can do an interaction between a continuous latent variable and a continuous observed variable by using a trick. 

Anonymous posted on Wednesday, March 10, 2004  8:26 am



I would like to test an interaction between a continuous latent variable and continuous observed variable. What is the trick one needs to use in version 2.14 to do this? Thank you! 


This is described in Web Note 6 which can be accessed from the homepage at www.statmodel.com. 

Anonymous posted on Wednesday, March 17, 2004  1:19 pm



I'm interested in knowing if its possible to do something like an Ftest using the Mplus output (specifically the THETA parameter array). I'd like to perform more "targeted" tests of model fit than I expect can be done with the RMSE and SRMR summary statistics Mplus provides. Specifically, I'm intersted in testing for level1 interaction effects in a multilevel SEM with mutiple dependent variables. Could the THETA parameter array for a set of constrained versus unstrained models be used in this way ? 

bmuthen posted on Wednesday, March 17, 2004  4:51 pm



Could you describe the types of interaction effects that you are interested in? 

Anonymous posted on Sunday, May 23, 2004  9:46 pm



I would like to test moderation effect of one continuous latent construct (f1) on another (f2), where the moderator is also a continuous latent construct (f3). I want to divide the sample into two equal percentile subsamples based on f3 (below and above f3 median), and look at the change in coefficients (f2 on f1) between these two groups. How do I implement it in MPlus (dividing sample into two subsamples)? Thanks! 

bmuthen posted on Monday, May 24, 2004  9:55 am



This would be modeled by defining the 3 factors using BY statements and then saying (assuming f2 is your dependent variable) f1xf3  f1 XWITH f3; f2 on f1 f3 f1xf3; I would not divide the sample but instead use the estimated model. From the estimated model you can deduce what the moderated f2 on f1 slope is for different values of f3. The f3 mean is zero and you get its estimated variance and can therefore try say +1SD and 1SD from the zero mean. How to deduce such moderated slopes is exemplified on page 59 in the Mplus Short Course handout New Features in Mplus Version 3. Essentially, this involves rewriting the expression on the RHS, b1*f1 + b2*f1*f3, as (b1 + b2*f3)*f1 showing that f3 moderates the influence of f1 on f2. 

Anonymous posted on Monday, May 24, 2004  10:04 am



Thank you. Is it a new feature in MPLUS 3? Can I still do it by dividing the sample in MPLUS 2.14  I have received a firm external recommendation to do this, instead of testing interaction with a continuous latent variable. thanks! 


Yes, this is a new feature in Version 3. You can divide the sample in Version 2.14 or Version 3 by saving the factor scores and creating groups based on f3. However, if you believe there is an interaction and save factor scores using a model without an interaction, the factor scores will be biased and the model will be fraught with problems. 

Anonymous posted on Monday, May 24, 2004  12:51 pm



Is this feature included in Base, Mixture addon or Multilevel addon part of Version 3? 

bmuthen posted on Monday, May 24, 2004  1:04 pm



The new ML latent variable interaction feature (XWITH) is included in the Base part of Version 3. For background reading, see Klein and Moosbrugger (2000) in Psychometrika. 

Anonymous posted on Monday, May 24, 2004  1:23 pm



Is there any limit on the number of interactions to be tested in one model in Version 3? In other words, if f2 is dependent variable, f3 is a moderator, g1, g2, g3 etc are independent variables, can I test the model: f2 on g1 g2 g3 g4...f3 g1xf3 g2xf3 g3xf3 g4xf3..; for any number of g, or is there any technical/computational limit? All variables here are continuous latent constructs. Thanks! 


Latent variable interactions require numerical integration which is computationally demanding. So although there is no limit set by Mplus, there is a practical limit on how long you probably want to wait for the model to converge. If you look under numerical integration in the Version 3 Mplus User's Guide, you will find a discussion of numerical integration. 

Gen posted on Wednesday, July 07, 2004  11:41 am



Bonjour from Montreal! I'm trying to test a model where I have a latent categorial variable infuencing a dependent latent continuous variable and 3 observed continuous variables as moderators. Is mixture modeling an appropriate way to test the interaction between the latent categorial variable and the observed continuous variables? If so, do you know some readings that can help me with the procedure? Thank you! 

Anonymous posted on Wednesday, July 07, 2004  1:35 pm



Hi Linda, I have a methodological question for you and would appreciate if you could offer some insights. We are using structural equation modeling to determine whether the relationship between a predictor and an outcome is mediated by an intermediate variable. We are interested in determining whether these relationships are "independent", but believe that may be confounded by another variable. How would you test for confounding in this case? More generally, how do you test for confounding if a model includes an intermediate variable? Thanks 

Anonymous posted on Wednesday, July 07, 2004  1:37 pm



Hi Linda, I have a methodological question for you and would appreciate it if you could offer some insights. We are using structural equation modeling to determine whether the relationship between a predictor and an outcome is mediated by an intermediate variable. We are interested in determining whether these relationships are "independent", but believe they may be confounded by another variable. How would you test for confounding in this case? More generally, how do you test for confounding if a model includes an intermediate variable? Thanks 

bmuthen posted on Wednesday, July 07, 2004  6:42 pm



This is the answer to Montreal  Bonjour! Yes, in the mixture modeling you can allow the effects of the 3 observed continuous variables on the dependent latent continuous variable to vary across classes  so that captures the interaction, i.e. the moderation. 


This answer is from David MacKinnon: "One way that you could test the confounder effect is to consider the confounder as a oderator. If the confounder is a grouping variable, then a researcher could test the equality of the mediated effect across the levels of the grouping (confounder) variable(Multiple Group SEM). The equality of the relation of X to M and from M to Y across the groups can be tested. In this way, the researcher could test whether confounder effects the a (X to M) or b (M to Y), or the mediated ab (X to M to Y) effect. It would be especially compelling if the researchers' hypothesized which part of the mediation effect should be confounded.If the confounder is a continuous variable, the same type of tests could be used but would require constructing interactions between the confounder and M, and Y so that there would be interaction effects in the prediction of Y and M. Your work with Andreas Klein is helpful here (Klein & Moosbrugger, 2000 cited in the Mplus manual; Example 5.13). These interactions then provide tests of the equality of the a and b paths across levels of the confounder. 

aap034 posted on Tuesday, January 11, 2005  4:39 pm



I am trying to run an analysis where the x, y and z (z being a moderator) are all continuous. Most of the research I am seeing is telling me to catergorize z apriori. However, I am still unsure on how to analyze the data if all three variables are continuous. Can you help? 


To examine the interaction between the observed variables x and z use the DEFINE command to create an interaction term and then regress y on x, z, and xz where: DEFINE: xz = x*z; 


I used WLSMV. As far as I understood it is not possible to compare chisquare values of 2 models based on WLSMV. Now I have 2 nonnested models. The models have the same number of free parameters, the same WLSMVdegrees of freedom, they are based on the same data set. Is it perhaps possible to compare the chisquares of these models under these conditions? Thanks for help! 


It is possible to do chisquare difference testing of nested models using WLSMV in Version 3. See the DIFFTEST option in the Mplus User's Guide. With WLSMV, I would compare only pvalues. 


Thanks. However, I would like to use the chisquare in AIC or BIC for model comparison, since the models are nonnested. Would this be possible when WLSMVdf and data set are identical? 


I'm not sure about this. Perhaps someone else can comment. 

Anonymous posted on Thursday, September 22, 2005  2:32 pm



Hello  I am running a path analysis and am interested in testing for mediating influences (using the IND command) as well as moderation effects. When using MLR, can I still compare across nested models and compute chisquare differences to assess model fit? The output gives me a warning statement "The chisquare value for MLM, MLMV, MLR, WLSM and WLSMV cannot be used for chisquare difference tests." The manual does not cover MLR as one of the estimators for which the DIFFTEST command can be used. 


For the estimators mentioned in the message, it is not the DIFFTEST option that you should use but the scaling factor that is printed in the output. See the homepage where a discussion of this is found under ChiSquare Difference Testing for MLM. This applies to all estimators mentioned including MLR. 

joshua posted on Saturday, November 26, 2005  2:57 pm



Hi, I'm trying to determine whether 9 regression coefficients differ with respect to 2 groups in the context of multigroup analysis. Basically, I've 3 exos and 3 endos and a moderating variable (2 groups) which is categorical. Just to confirm...I would have to fix the path to be equal in both groups in one analysis and allow them to be freely estimated in another analysis. Am i right to assume that this is done one at a time for all 9 of the paths? Also, assuming that holding the first path to be equal did not significantly worsen the fit, we would still hold that path to be equal while moving on to constraining the next path to be equal across both groups, correct? Thanks in advance. 


If you are interested in 9 slopes beoing equal across groups, I would hold them equal and then not equal and get a joint test for all of them. If that test is rejected, I look at Modification indices in the run with them held equal to see which ones violate equality. 

joshua posted on Monday, November 28, 2005  3:37 am



Thanks Linda, 1. Btw, I'm assuming that you would use similar approach to test for measurement invariance for factor loadings in say across both groups? 2. When you mentioned you would look at the modification indices (MIs) to see which violates equality, did you mean that we should be looking for ones above 3.84 for 1 df? What if we have a path with significant MIs across both groups? One group could still have a path that would be significantly larger than another. Should we test this path separately again? 


1. Yes. 2. Yes. Yes, if you want to know if one is larger than the other. 

joshua posted on Friday, December 02, 2005  8:43 am



Thanks Linda, I've run the analysis as what you've suggested. I've found a significant difference between the model in which all 9 regression coefficients were held equal and the model where all 9 were freely estimated. Out of the 9 regression coefficients, I found 3 to be noninvariant across both groups (as suggested by mod. indices). Hence, I can interpret that my dichotomous variable moderated the 3 relationships. Here's where my problem lies.... I went on to free the 3 regression coefficients while allowing the other 6 to be freely estimated between both groups. Basically, I respecified the model as suggested by Mod Indices. I observed the regression coefficients..the ones that were previously found to be moderated by ethnicity (as suggested by Mod indices)... one of the 3 regression coefficients that registered a mod indices > 3.84, was not even statistically significant in their respective groups.For example, in one group the Est/S.E = 1.122 and in another 0.438. Am I right to state that the Mod Indices can only be used as a neceesary but not sufficient tool to test for the presence of a moderating effect? If yes, does this mean we still have to observe the individual paths estimate in both groups after respecifying the latent variable model as previously suggested by the Mod Indices? 


Once you free a parameter, you would need to rerun the model to see how other modification indices are affected. I would free the parameter with the largest modification index first and then see if the others still need to be freed. 

Carol posted on Thursday, January 26, 2006  12:11 pm



Dear Dr. Muthen, I am trying to model the moderating effects of one variable on the heritability of another variable. In other words, are the genetic influences on X stronger in individuals who are high on Y where X and Y are both continuous observed variables. I believe this is the same as asking of there is an interaction between the latent additive genetic factor (A) and the observed variable Y. Without the moderator variable I would specify something like A1 by X1 (11); A2 by X2; where 1 and 2 designate twins. Would I think use XWITH to define a second variable A1xY1  A1 XWITH Y1 and then also specify that X is indexing this interaction variable? A1xY1 by X1 Thank you for your help. Carol 


This sounds correct but say: x1 ON a1xy1; instead of using a BY statement. You cannot use a BY statement when a1xy1 has already been defined in the interaction statement. 

Carol posted on Monday, January 30, 2006  9:17 am



Hi Dr. Muthen, Thank you for your suggestion. Below is the script that I am using, recall that I want to know if heritability of X changes across Y (both continuous). With this script I get an error message saying that Y1 and Y2 are uncorrelated with any variables in the model, but I thought that any variables that weren't specified as being uncorrelated were automatically assumed to be correlated. Certainly X and Y are correlated on a phenotypic level. I'm not sure where the error is. Thank you, Carol VARIABLE: NAMES = suid zyg Y1 X1 Y2 X2; USEVARIABLES = Y1 X1 Y2 X2; GROUP= zyg(1=mz 0=dz); ANALYSIS: TYPE = random random; ESTIMATOR=MLR; MODEL: [X1 X2] (1); !means X1@0; X2@0; !fix residual variance to 0 [Y1 Y2] (2); ! ! Biometric loadings ! A1 BY X1*.10(11); A2 BY X2*.10 (11); !additive pathway C1 BY X1*.15 (12); C2 BY X2*.15 (12); !shared env E1 BY X1*.20 (13); E2 BY X2*.20 (13); !nonshared env !Define interactions Y1xA1 A1 XWITH Y1; Y2xA2  A2 XWITH Y2; Y1xC1 C1 XWITH Y1; Y2xC2 C2 XWITH Y2; Y1xE1 E1 XWITH Y1; Y2xE2 E2 XWITH Y2; X1 ON Y1xA1 (14); X2 ON Y2xA2 (14); X1 ON Y1xC1 (15); X2 ON Y2xC2 (15); X1 ON Y1xE1 (16); X2 ON Y2xE2 (16); [A1E2@0]; !fixes latent means means to 0 A1E2@1; !fixes latend variable variances ! Y1Y2 WITH A1E2@0; A1A2 WITH C1E2@0; C1C2 WITH E1E2@0; A1 WITH A2@1.0; C1 WITH C2@1.0; E1 WiTH E2@0; !Sets MZ as default model MODEL dz: A1 WITH A2@.5; 


Mplus has defaults that are described in the user's guide. All variables are not automatically correlated. If there are covariances missing from your model results that you want to see, you need to add them to the model using the WITH option. 


Dear Dr. Muthen, I would like to compare two models: one model in which latent variable A is considered a mediator between variables B (observed) and C (observed), and one model in which I have entered an interaction term between A and B (using XWITH and adding ALGORITHM = INTEGRATION to the ANALYSIS command). I have compared the loglikelihoods of both models using the SatorraBentler scaled chisquare difference test and find that the mediation model has significant better loglikelihood than the interaction model. However, I would also like to know whether the Rsquare of variable C differs between the models. The Mplus output for the interaction model, however, does not include this information. Is there any way to get Rsquares for the interaction model? Thank you. 


We do not provide that Rsquare. You would need to compute it yourself at this time. 


Hi there... I was wondering if you knew of a reference for properly displaying structural models with moderators when using the Xwith command. Specifically, I'm not sure, particularly given the algorithm used by mplus whether I should have indicators of the interaction construct. Thanks for the helpful resource! 


Mplus uses maximum likelihood not the ad hoc approach where the product of indicators are used. The following article describes the approach used with XWITH: Klein, A. & Moosbrugger, H. (2000). Maximum likelihood estimation of latent interaction effects with the LMS method. Psychometrika, 65, 457474. 


Right...thanks, Linda. So my question is really just about drawing an appropriate diagram. I have 2 latent exogenous variables and the third "moderator" latent variable. In my diagram, I'm assuming that my moderator variable would not have any indicators. Its a small question...just want to make sure my picture looks right. jc 


The issues of graphically displaying the interaction between continuous variables are the same for observed or latent variables. This is difficult to do. I would think this is discussed in regression texts and also articles by Aitkin and West. 


Sorry...I've been unclear. My question was not about how to graphically display the interaction, but about how to represent the moderator variable in a path diagram. Its not that important and I don't need to take up more of your time on this. 


You can see how we displayed an interaction between two latent variables by looking at the path diagram for Example 5.13. I think this is what you want. 


Drs Muthen, I am trying to run a model (all observed and continuous variables) with two moderator variables interacting with four predictor variables to predict the outcome variable. I do not want to use multigroup analysis. Is this currently possible in MPlus? If so, are there issues with model convergence? Thank you in advance for your reply. kim 


If you want to create interactions between two observed variables, use the DEFINE option to do so and include those variables in your model as covariates. This has always been possible in Mplus and I know of no obvious convergence problems. 


I'm specifying a model that has somewhat skewed indicators and an interaction between two exogenous latent variables. Typically I would use the 'twostep approach', where the CFA model is specified first after which the SM is tested. I can still do the first step (i.e., CFA; possibly using mlm or mlmv to deal with the nonnormality). But having done that, do I then just start with the final CFA model as my foundation when I move to the SEM? Because there's no way to compre the CFA results to the SEM model with the latent interaction. Also, when using the interaction test (i.e., XWITH), do I need to worry about the nonnormality of my indicators? Hope my questions make sense.... 


One question is if the lv interaction variable influences the factor indicators or only some other variable. Both are possible in Mplus. Yes, just start with the final CFA as your foundation. Nonnormality of indicators is possible even with the normality of the factors that XWITH assumes. Due to nonnormal residuals, or due to the lv interaction influencing the indicators. Use MLR to take nonnormality of indicators into account. 


Thank you for the response. I didn't realize that I could specify MLR in a latent interaction model. However, now that I've tried it, I'm a bit confused, as the results are identical whether or not I include "Estimator = MLR;" in the analysis command. Here's what I have in ANALYSIS... Estimator = MLR; Type = RANDOM; Algorithm = INTEGRATION; 


This is because MLR is the default estimator for TYPE=RANDOM; 


Perfect, that's what I wanted to know. Thank you Linda and Bengt. 


Drs Muthen, I am trying to run a model that includes multiple interactions among continuous latent variables (created using XWITH). This apparently requires TYPE=MIXTURE and ALGORITHM=INTEGRATION. However, I keep recieving an error message that says there is not enough memory because " analysis requires 8 dimensions of integration resulting in a total of 0.39062E+06 integration points." I've been assured that I have all the memory I'm likely to get. Is there any other way around this problem? Thank you, Carol 


8 dimensions of integration is difficult to accomplish. You can try integration = montecarlo; which demands less memory. Or, you can try to simplify the model so that you have fewer dimensions of integration. To simplify the model, you can try to break it down into its parts. This might show that not all of your lv interactions play a significant role in the full model. 


Ok. I'll give the montecarlo option a try. Thanks. 


I have a quick question. I ran a latent interaction model with two latent variables comprised of 3 items each using the integration algorithm, and the tvalue associated with the interaction term is significant. My next step is to plot the interaction using a method similar to Aiken & West. However, this method is based on the assumption that the mean of each latent variable comprsing the interaction is zero due to centering. From my understanding, it is not necessary to center variables when using the Kline & Moosbrugger approach. How then do I find out what the latent means of my variables are? Are they automatically set to zero or is a there a specific command I need to give Mplus to retrieve these values in my output? 


In a regular model, the default Mplus setting is zero factor means. If no factor means are reported in the output, they are zero. Exceptions include multigroup models and growth models. 

Yu Kyoum Kim posted on Wednesday, October 10, 2007  8:40 am



Dear Dr. Muthen, I ran the SEM with continous factor incators and an interaction between two latent variabels. It only give loglikelihood value for evaluating model fit. Is loglikelihood value same as minimum fit function chisquare value? If not, could you give me the equations which calculate RMSEA, CFI, TLI from loglikelihood value? Thank you so much! 


When means, variances, and covariances are not sufficient statistics for model estimation chisquare and related fit statistics are not available. 


Hello, I am new to Mplus and currently have the demo version. I am trying to gain a better understanding of the program because I am interested in using it for my dissertation research. My hypothesized model posits mediatedmoderation, and there are 6 continuous variables involved (4 predictors (2 pairs of interacting variables) and two outcomes (one is a proposed mediator, the other the outcome). Which examples would be most proximal to this type of study? If none exist in the demo version, can you refer me to articles that may have done similar analyses so I can have a better idea of (a) how to explain my proposed data analytic strategies and (b)understand what I will need to do? Thanks! 


I think what you want is similar to Example 3.11 where you use the DEFINE command to create an interaction and use the interaction as a covariate. 


Dear Linda and Bengt, In my model two continuous latent predictors (a,b) and an interaction between these (a*b) predict a latent continuous variable d. As described in the Mplus user guide, I am using: ANALYSIS: TYPE = RANDOM; ALGORITHM = INTEGRATION; and XWITH. I have got following questions: 1) I would like to compare the interaction model with the model without interaction. Which is the correct Mplus syntax (concerning estimation method, model specification etc.) for the model without interaction term? Should I simply run the syntax for the model with interaction (see above) and delete the interaction part? Or use another estimation method, for example : TYPE = GENERAL; ESTIMATOR = MLR or ML? 2) When I am running the interaction model, I do n0t get a R**2 and intercept to calculate the regression between the latent variables. How do I get these? My solution was to save the fscores of the latent variables and then run a regression on these (get R**2 and intercept). However, I get different results for the parameter estimates. Regression (latent interaction model): d = no intercept + 0.620*a  0.208*b  0.884*inter Regression (fscores; ML,Meanstructure): d = 0.01 + 0.730 *a  0.150*b  0.852*inter Why? Giannis 


1. Run the model with the interaction and the model without the interaction. You will not need RANDOM and ALGORITHM=INTEGRATION without the interaction. Be sure you use the same estimator. 2. How Rsquare would be defined in this situation is unclear and is a research question. I would not use factor scores for this purpose. Means and intercepts of factors are fixed at zero in a single group analysis. 


Dear Linda, thanks for your quick response! So my conclusion out of your suggestion is: 1) I can use the same Syntax (RANDOM and ALGORITHM=INTEGRATION) but it is not needed. I also can run TYPE = GENERAL; but as ESTIMATOR I should use MLR, because MLR is used in conjunction with ALGORITHM=INTEGRATION as default. Could I also use another Estimator with ALGORITHM=INTEGRATION? 2) How do I free the intercept? I tried it with: TYPE=RANDOM, ALGORITHM=INTEGRATION and additional I included TYPE=MEANSTRUCTURE into the syntax, but I do not get it. Thanks, Giannis 


1. You must use the same estimator. You can use the same TYPE statement or not. 2. The intercept of a factor cannot be free in single group analysis. 


Ok! I would like to have the intercept of the dependent latent variable to be able to show the latent interaction graphically. Do you know another possibility how to do this, except of running a regression with the saved latent variable scores? 


sorry, silly question: the intercept is zero, as you mentioned above. Last question: If I use MLR, I have to calculate the differencetest between the two models using the formulas from your website http://www.statmodel.com/chidiff.shtml under "Difference Testing Using the Loglikelihood"? 


You cannot compute Rsquare. You will have to do without it. Yes, you would use the formulas on the website for difference testing with MLR. 


Greetings, Do you have a reference to suggest on the MLR estimator ? and, If I do, for instance, a SEM with non normal data and missing values, is there any problem in using MLR (would you suggest something else), instead of MLM or MLV which do not accomodate missing, even if the TYPE is not COMPLEX ? Thank you 


MLM and MLMV can be used with missing data if TYPE=COMPLEX is not used. MLR can be used with and without complex survey data. See Web Note 2 on the website regarding MLR. 


Actually, MLM and MLMV cannot be used with missing data. 


Dear Linda and Bengt I am trying to test the moderating effects of a continous latent variable (L) on the relationship between a binary IV (x) and a binary DV (Y). i followed the instructions of the userguide, using: ANALYSIS: TYPE=RANDOM; ALGORITHM=INTEGRATION; MODEL: y ON X L; X x L  x XWITH L; Y ON X x L; this generates an error message ERROR in Model command Only one interaction can be defined at a time.Definition for the following: X X L Perhaps this is because my IV (x) is a binary variable. Am i using the incorrect syntax to test the moderating effects of a latent continous variable on the relationship between 2 binary variables? If so, perhaps you could suggest the appropriate syntax for such a model? Many thanks Grainne 


You should have one variable name on the lefthand side of the , for example, XxL. A variable name cannot include blanks. 


Dear Linda I have conducted a mediational analysis using the syntax below, where x is a continuous latent variable, M is continuous observed and y is binary observed. Y on X; Y on M; M on X; MODEL INDIRECT: Y IND X; This model provided a good fit to the data and indicated partial mediation. However, I would like to determine whether the mediating effects of M are moderated by a confounder (C). C is a binary observed variable, so I understand I must conduct mulitple group analysis. Having read the manual and this site I am unclear as to how exactly I write the syntax to test these effects. What syntax must i add to the model above to determine whether C moderates the mediating effects of M. Many Thanks 


You would use c as a grouping variable. See Chapter 13 for a discussion of multiple group analysis. 


Hello Linda and Merry Christmas! I am running a multiple mediation analysis with a single dichotomous outcome. I am trying to test for moderation by gender. I have included gender as a grouping variable and generated output by gender. Now I'm not sure how to test whether the mediation is different by gender. So for example, if I wanted to test the equality of the mediated effect in each group, would I subtract the mediated effects (a11b11a12b12) for each mediator I'm testing and then divide it by the average of the standard errors for the two groups? Or is there some code I can include to get Mplus to test this for me? Thanks! Kiarri 


You can test this by using multiple group analysis where you define and test the equality of the two mediation effects using MODEL CONSTRAINT. 

Kihan Kim posted on Friday, January 23, 2009  6:00 pm



I am trying to test a moderating effect with multigroup path analysis. If the model is x1 > y1 > y2 > y3 and if I have a categorical (gender) moderating variable x2, and I expect that X2 will moderate the relationship between y2 and y3 only, then.. I think I should I perform a chisquare difference test between the following two multigroup path models: Model 1: multigroup path model with all paths constrained to be equal. Model 2: multigroup path model with only two two paths (X1 to Y1 & Y1 to Y2) to be constrained to be equal. If the chisquare difference test is significant, then that indicates that the path from Y2 to Y3 cannot be the same. And therefore, X2 did moderate the relationship between Y2 and Y3. Could you please confirm me whether this logic is correct? Thanks, KK 


Seems logical to me. 

Kihan Kim posted on Friday, January 23, 2009  6:38 pm



One followup questions is: For the sample path model, x1 > y1 > y2 > y3, and X2 moderating the relationship between Y2 and Y3 only, When I run a multigroup path model with NO constraint, I find that the path Y2 to Y3 is significant for one subgroup, but nonsignificant for another subgroup. Is this also an evidence of moderating effect? If so.. then which method is better: (a) the chisquare difference test between constrained and nonconstrained model OR (b) just one multigroup path model with NO constraint. 


In (a) you get a likelihoodratio chisquare. In (b) you can get a Wald chisquare by letting the y2>3 path be different in the 2 groups and then test for equality using Model Test. The 2 chisquare tests are asymptotically equivalent but may differ in any one sample. 


M&M, I have a simple path model which appears to fit my data well (RMSEA<0.001). However, when I introduce an interaction term between two (endogenous) variables the fit becomes dramatically worse (RMSEA=0.32). Is this a common problem with an obvious explanation? I notice that by removing variables from the path model so that the variables in the interaction term are no long endogenous I again get a good fit (RMSEA<0.001). I'm sure there's something very simple I'm overlooking! Any help gratefully received. Thank you in advance. Full path model without interaction (RMSEA<0.001): X2 ON X1; X3 ON X1; Y1 ON X1 X2 X3; Y2 ON X2 X3 Y1; Full path model with interaction (RMSEA=0.32): X2 ON X1; X3 ON X1; Y1 ON X1 X2 X3 X2X3; Y2 ON X2 X3 X2X3 Y1; Restricted path model with interaction (RMSEA<0.001): Y1 ON X2 X3 X2X3; Y2 ON X2 X3 X2X3 Y1; All variables are continuous and centred about their means. X2X3 denotes the product of X2 and X3. 


As far as I know this is not a common problem with an obvious explanation. Of the 3 models you listed the content (the restriction that makes the model have degrees of freedom) of the first 2 seems to be that x1 does not influence y2 directly. For some reason, adding the interaction seems to make that restriction less well fitting. It is hard to say why this partial effect is needed with the interaction included and not without it. The third model looks like it has zero d.f.'s. 


Bengt, Many thanks for your prompt response. Is it perhaps because I need to include X2X3 ON X2 X3? I had not done so as there is no obvious analogy in standard multivariable regression (i.e. I would just regress Y1 on X2, X3 and X2X3) but thinking about it now this is actually constraining X2 > X2X3 and X3 > X2X3 to be zero, which is clearly ridiculous... Best wishes. 


You should not include that. 


I am testing the following model: y1 ON sex x1 x2 x3 x1_x2 x1_x3 x2_x3 x1_x2_x3; y1#1 ON sex x1 x2 x3 x1_x2 x1_x3 x2_x3 x1_x2_x3; Where y1 is a count variable on a zeroinflated Poisson distribution, sex and x1x3 are coded bivariate 0/1, and underscore terms are interactions between x variables. For graphing purposes, I would like to get [y1] for: * different combinations of x1x3 levels (e.g., [y1] where x1=0, x2=1, x3=1), with sex covaried out; as well as * [y1] where one of the x variables is treated as an additional covariate (e.g., [y1] for x2=1, x3=1, sex & x1 covaried out) Is there a way to request these covariateadjusted group means as part of the output? 


See if you can get what you want with the Adjusted Means Plot using the PLOT command. 


I am a PhD Student working on my dissertation proposal. I am familiar with SEM using LISREL but was directed towards Mplus becuase of its ability to handle dichotomous outcome variables. I would like to use SEM to test a model of three continuous latent factors with a moderated mediation effect on the dichotomous observed outcome variable. Am I correct in saying that Mplus can be used to test this model and will be able to provide a test of the indirect and interaction effect? 


Yes, this can be done in Mplus. 


Great! Thanks for your rapid response. 

brianne posted on Tuesday, April 07, 2009  1:45 pm



I am wondering if I can compare two alternate moderator models using model fit indices if the main variables are the same, but the interactions are different. In other words, are these considered the same variables, but different paths OR are they considered different variables? In model 1: a on y b on y a*b on y c on y (control) For model 2: b on y c on y b*c on y a on y (control) thanks! 

brianne posted on Tuesday, April 07, 2009  1:50 pm



oops... Sorry, my syntax in my examples is backwards. MODEL ONE y on a y on b y on a*b y on c (control) MODEL TWO y on b y on c y on b*c y on a (control) thanks 


The 2 models are regular regressions so they fit the data perfectly  there are no fit indices to compare. I would simply include the interactions that are significant. 


Dear Muthén How can I use the define command to reverse scoring of scales such that values 1 2 3 4 5 6 are reversed to 6 5 4 3 2 1. thanks 


DEFINE: y = 7  y; 

Rob Dvorak posted on Friday, May 08, 2009  10:47 am



Hi, I'm running an SEM with two centered observed variables and their interaction predicting a latent variable. In order to probe the interaction I need to get the latent variable intercept of my equation, but I'm not sure how to get this. Thanks in advance. 


It is zero. 

Rob Dvorak posted on Sunday, May 10, 2009  6:24 am



I wondered if that was the case. Thanks! 


Why doesn't Mplus calculate an Rsquare when utilizing algorithm = integration and type = random (interaction model)? Is there an article I can cite for this reason? I have reviewed several articles I have seen in the posts, am I right to say that Marsh Wen Hau 2004, when they talk about the nonnormality of the interaction term are answering this question? Thanks, Ashley 


Because residual variances vary as a function of x, there is not a single Rsquare with TYPE=RANDOM. This is not related to the Marsh Wen Hau paper. 

Gloria Li posted on Tuesday, May 19, 2009  7:36 pm



Dear Prof Muthen, I have a mediatedmoderation model involing 5 latent variables. My hypothesized model includes 3 antecedents, Y1  Y3, they interact with each other (two 2way and one 3way interaction) to predict Y4 which then predicts Y5. They are all continous variables. I have used "TYPE=RANDOM & ALGORITHM = INTERGRATIPN" in ANALYSIS, however, I was not able to get the fit indices. Is there anyway to calculate them? If not, how can i report the model fit for the model? Please advise. Many thanks, Gloria 


With TYPE=RANDOM chisquare and related fit statistics are not available. In this case, nested models are compared using 2 times the loglikelihood difference which is distributed as chisquare. 

Gloria Li posted on Thursday, May 21, 2009  8:54 am



So what type of language should i fill in under ANALYSIS if i wanna get those indices? many thz! 


They are not available. When means, variances, and covariances are not sufficient statistics for model estimation, chisquare and related statistics cannot be computed. 

Gloria Li posted on Saturday, May 23, 2009  9:20 am



In that case, do you have any advice on how we can report the model fit in ways that other researchers can get sense of the study results? 


What's typically done in situations like this is to work with "neighboring" models for which you compute 2 times the loglikelihood difference to get a chisquare test. You said you had 5 latent variables y1y5 where y1y3 (and their interactions) influence y4 which influences y5. So the model has 2 types of content which can be tested. First, are the measurement models (the factor models) wellfitting? You can test that by regular fit indices of each measurement part separately. Second, are there any direct effects from y1y3 to y5? This second question can be addressed by a "neighboring" model which allows such direct effects versus one that doesn't. 

Gloria Li posted on Monday, May 25, 2009  7:55 am



By measurement model, which vairables should I plug in? Becasue I do not hypothesize the main effect of y1y3, instead, I have 3 hypotheses respecting interaction effects: y1*y2, y1*y3 and y1*y2*y3 on y4 and then to y5. Regarding "neighboring" model, which section in the user's mannual i can refer to? Would you please give some more info? 


You have one measurement model for each latent variable  see your BY statements. The fact that you have interactions of the latent variables y1y3 in their influence on y4 does not change the fact that you have a regular factor analytic measurement model for each of y1y3, plus also for the 3 together. Neighboring models are not explicitly explained in the User's Guide but in our courses. I gave an example of a neighboring model that has direct effects, which seems relevant for what you do. Such a model is straightforward to specify using the UG. Also see our courses available on the web  particularly topic 1. 

Gloria Li posted on Monday, May 25, 2009  11:14 pm



Since I am new to Mplus, I am sorry for the overwhelming questions. For the measurement model, I have tested 4 models: (a) y1,y4 & y5; (b) y2,y4 & y5; (c) y3,y4 & y5; (d) y1y5. Only the first one obtains acceptable fit index. Is that still ok to run SEM of interactioneffect model? I have been searching more info of neighboring models and I have referred to this online handout: http://www.statmodel.com/download/Topic%201.pdf However, I still have not able to write commands for that. Would you please give more guidance? What does it mean by "using the UG"? Many thanks! 


Regarding your first question, no you have to have acceptable fit in your measurement models. Otherwise your latent variable modeling has little meaning  not a strong enough relationship to your data. Regarding your second question, look at UG ex 3.11. The content of this model is that x1 and x3 don't influence y3 directly. As a test of whether this is a good model you can apply the neighboring model idea and include those 2 direct effects: y3 on x1 x2; The 2 times loglikelihood difference is a chisquare test with 2 df of the initial model. You can use that same general approach for the relationships among your latent variables. I suggest that you study the web video of Topic 1 on our web site and read up on the SEM literature. 


Hello, Drs. Muthen I¡¯m wondering if it is possible to examine the moderating effect of a secondorder continuous factor(f9) between secondorder continuous factors (f5 & f13). Could you check my syntax? VARIABLES: NAMES ARE y1y30 ANALYSIS: TYPE = RANDOM; ALGORITHM = INTEGRATION; MODEL: f1 BY y1y3; f2 BY y4y6; f3 BY y7y9; f4 BY y10y12; f5 BY f1f4; f6 BY y13y15; f7 BY y16y18; f8 BY y19y21; f9 BY f6f8; f10 BY y22y24; f11 BY y25y27; f12 BY y28y30; f13 BY f10f12; f13 ON f5 f9; f5xf9  f5 XWITH f9; f13 ON f5xf9; OUTPUT: TECH1 TECH8; 


This seems correct. 

Eulalia Puig posted on Thursday, October 29, 2009  12:42 pm



Dear Linda or Bengt, I have a path model with several mediation variables. All dependent variables are continuous. I'd like to know whether the direct effect is smaller than the indirect effect(s) altogether  what test can I use and how do I enter it in Mplus? Thank you so much. Lali 


You can test if the direct effect is different from all the indirect effects using Model Constraint and parameter labels to express these effects and their difference. The difference then gets an estimate and a SE. This requires you to know how to express the effects in terms of the parameters. 


Thanks, Bengt. However, I don't know how to express the effects in terms of the parameters, so that I can do the Wald test. Would you be able to offer some input on that? Thank you again, Lali 


You should read David McKinnon's mediation book. Essentially, mediation concerns indirect effects quantified as a*b, where a and b are slopes. So your Mplus model should label a and label b (see UG) and use Model Constraint to compute a*b. It sounds like your model has several such indirect effects which you can then add up and compare to the direct effect. You can check that you do the effects right by comparing to the Model Indirect results. I'm afraid I can't help you more than that. If not sufficient, you have to consult a more experienced Mplus user. 


Thanks Bengt. I'm finding tons of things through this reference, so I think I know how to do it. Lali 

dan berry posted on Sunday, November 01, 2009  3:17 pm



Dear Mplus folks, I’m looking to fit a threeway moderation model in which the growth factor (i.e., LGM) effect on a distal outcome varies as a function of observed X1, which should, in turn, vary as a function of observed X2 (i.e., X1*Slope*X2 I’m unclear if there’s a way to do a 3way interaction using the “xwith” function. Is it possible (or sensible) to use the 2way interaction variable created in one “xwith” command and then use that created twoway interaction term in second “xwith “ command where it is used as one of the variables to be interacted (i.e., does this create a 3way). Are 3way interactions possible, when one variable of the 3 is latent? For example: Analysis: algorithm =integration; type= random; Model: int slope  X3@0 X4@1 X5@2; X1bySLOPE  X1 xwith slope; X2bySLOPE  x2 xwith slope; THREEWAY  X1bySLOPE xwith X2; !Regression: Y1 on X1 X2 int slope X1X2Crosproduct ! from define statement X1bySLOPE X2bySLOPE THREEWAY ; In my case, X2 is binary. Might there be a way to tweak a KNOWNCLASS statement to let the 2way interaction vary across X2 classes? Thanks for any thoughts. 


You can do a threeway interaction as shown above. Or you can use the KNOWNCLASS option for the binary variable. 

Anonymous posted on Tuesday, December 01, 2009  6:20 pm



Hi Linda: I am testing an interaction between two continuous latent variables. When I run the model I get an error message saying "RECIPROCAL INTERACTION". What does this mean? It seems this error comes up if the variables are categorical but my variables are continuous. Any suggestion will be helpful. 


Please send the full output and your license number to support@statmodel.com. I need more information to answer this question. 

min soo kim posted on Friday, February 05, 2010  1:45 pm



I'm trying to examine the interaction effect between two secondorder factors on a secondorder factor. I used OUTPUT: TECH1 TECH8; I'm wondeing if the estimates are standardized or not. Path coefficients were 1.008 for x1, 0.124 for x2, and .319 for the interaction term. Are those standardized? Also, chisquare statistics, CFI, NFI, RMSEA, and SRMR were not reported, right? How can I assess the overall model fit? 


The estimates in the results section of the output are not standardized. With TYPE=RANDOM, chisquare and related test statistics are not developed. In this case, nested models are compared using 2 times the loglikelihood difference which is distributed as chisquare. 

Ewan Carr posted on Thursday, May 13, 2010  3:57 am



Hi, Quick question: if a moderating variable has a significant effect, but worsens the overall model fit considerably, what should I do? The model fit without the moderator is > 0.968. When the moderator is included it drops to 0.800. The modification indices suggest I should allow for relationships between the moderator and other predictors in the model, but I'm not sure if that makes sense. Thanks in advance. 


It is not clear what you are doing. Please send the full output and your license number to support@statmodel.com. 

Syd posted on Friday, July 30, 2010  1:56 am



Hi, I’m testing a model similar to that outlined in Example 5.13 in the Mplus user guide (with direct and interaction effects of two continuous latent variables f1 and f2 on a mediating variable f3, which has a direct effect on a DV f4). My question is, how can we test mediation in this case? If I may ask some subquestions: 1. Is it possible to test moderated mediation without creating dummy variables for the different levels of the moderating variable? For example, is it possible to test for mediation in the case of a continuous LV interaction just like I would for mediation for any other latent variable? I.e., may a method such as causal steps method (Judd & Kenny, 1981; Baron & Kenny, 1986) be used by treating the interaction term like any other LV, and look at the direct and indirect effects? 2. If the answer to question 1 is yes, then, how do I compare the size of the loadings in the case of interactions, since standardized loadings are not available for TYPE=RANDOM, ALGORITHM=INTEGRATION? 3. If the answer to question 1 is no, then to test mediation at 2 levels of the moderator (mean + 1SD), is it possible to obtain the mean and standard deviation of the moderating variable and create a dummy variable in Mplus that codes the mean+1SD values of the moderator as 0 and 1? Thank you, 


1. Yes. 2. Use the raw coefficients. 

Syd posted on Friday, July 30, 2010  1:38 pm



Thank you for the quick response Linda. Is it possible for you to point me towards any references that would support the use this approach for testing moderated mediation? That is, any references suggesting that we can indeed treat the interaction term as any other LV. 


I think that judging the significance of indirect and direct effects from latent variable interactions is alright from basic statistical principles. I am not familiar with the "causal steps method (Judd & Kenny, 1981; Baron & Kenny, 1986)" that you mention. To me, mediation means that the indirect effect is significant, be it from a main effect or an interaction effect. I have not seen writings on this particular issue. 

Syd posted on Saturday, July 31, 2010  10:39 pm



Hi Bengt, Thank you for the explanation. Please ignore my comment about the causal steps method; it was just a potential solution I was considering to test whether a significant indirect effect exists. As you note, I'm basically trying to establish the significance of the indirect effect of an interaction (f1xf2) on a dependent variable (f4) through a mediating variable (f3). As the MODEL INDIRECT command is not available when using TYPE=RANDOM, ALGORITHM=INTEGRATION, I was not sure about how to test the significance of the indirect effect, even though the size effect can be calculated. So, I will greatly appreciate any guidance you may provide regarding how I can test the significance of the indirect effect of f1xf2 on f4 via f3. I apologize if this is an elementary question, but having looked at the literature in my field, I couldn't see references to any articles that would suggest a method. Thank you 


You can use MODEL CONSTRAINT to define a NEW parameter that is the product of the regression coefficients for f3 on the interaction and f4 on f3. See Slide 170 of the Topic 3 course handout for a suggestion of how to interpret an interaction. 

Syd posted on Monday, August 02, 2010  1:29 am



Thank you very much for the information Linda. It worked perfectly. 


Hi! I was wondering if you could help me figure out this puzzle. I am testing a structural relationship between one latent predictor at time 1 and two latent outcomes at time 2, controlling for the time 1 values of the outcomes. These data come from an intervention study, but because I am only interested on the developmental patterns, I am controlling for intervention effects. The problem is when I add the intervention variable as a predictor of the time 2 outcomes, the model also estimates a series of correlations between all time 1 predictors and the intervention variable. This does not make sense in my model because the time 1 predictors were assessed prior to random assignment to the intervention, so whatever correlation there is between intervention and the time 1 predictors is just spurious. However, when I try to set these correlations to be 0, the model does not converge. Interestingly when I fit a similar model, but using the main effect of the intervention and the interaction of the latent predictor and the observed intervention variable, it no longer presents those strange correlations I did not ask for and do not need. Can you please help me figure out how to make sense or get rid off these spurious correlations? Ultimately they make my models not nested and require me to account for missing degrees of freedom that make no sense. Thanks, Clara 


There are certain defaults in Mplus. If you do not want a default covariance/correlation, fix it to zero, for example, y1 WITH y2@0; 


Dear Linda, Thanks for your suggestion. As I explained in the previous posting, I had tried setting those spurious correlations to zero with this code: EF1 with interv1@0; EM1 with interv1@0; EL1 with interv1@0; However, when I do that I get the following message: THE MODEL ESTIMATION TERMINATED NORMALLY THE STANDARD ERRORS OF THE MODEL PARAMETER ESTIMATES MAY NOT BE TRUSTWORTHY FOR SOME PARAMETERS DUE TO A NONPOSITIVE DEFINITE FIRSTORDER DERIVATIVE PRODUCT MATRIX. THIS MAY BE DUE TO THE STARTING VALUES BUT MAY ALSO BE AN INDICATION OF MODEL NONIDENTIFICATION. THE CONDITION NUMBER IS 0.197D16. PROBLEM INVOLVING PARAMETER 54. Should I still trust the results of this model and compare the fit with other nested models? Also should i interpret from your words that there are different defaults for main effects models versus models with an interaction? Because when I fit a similar model, but using the main effect of the intervention and the interaction of the latent predictor and the observed intervention variable, it no longer presents those strange correlations. Clara 


Defaults vary and change when the model changes. Please send your output and license number to support@statmodel.com. 


Hi, I am trying to run an SEM with an interaction while testing a separate indirect effect. So I initially tried to use the two "pieces" using type=random and estimator=ml (which, of course, doesn't work) MODEL: Rel_15 ON Rel_6 Peer_Rel; Rel_6 ON C_REL_B ; relxpeer  rel_6 xwith peer_rel; Rel_15 ON relxpeer; MODEL INDIRECT: Rel_15 VIA Rel_6 C_REL_B; Do you have any suggestion re: the possibility of running this model and the syntax that is needed? Thank you. Christine 


You can't use MODEL INDIRECT with TYPE=RANDOM but you can use MODEL CONSTRAINT to define the indirect effect. See the user's guide. 


Thank you for your time and instruction. Since Monday, I have consulted the user's guide, but unfortunately, I am such a newbie, I'm not sure about the syntax. And unfortunately, others in my department are not familiar with what I want to do. Can I clarify what I think I am suppose to do? In order to constrain the "indirect effect" (Rel_15 VIA Rel_6 C_REL_B), do I need to create a new variable, the use that new variable in the model constraint syntax? If so, what is the syntax for both pieces, i.e. creating the "new" indirect effect variable and then constraining said indirect effect variable? Sincerely, Christine 


You need to label the two parameters that make up the indirect effect in the MODEL command. Then create a NEW parameter in MODEL CONSTRAINT and is the product of the two components of the indirect effect. MODEL: y2 ON y1 (p1); y1 ON x (p2); MODEL CONSTRAINT: NEW (ind); ind = p1*p2; 


Dear dr. Muthen, We tested an ordinal logistic structural equation model (outcome variable with 3 categories) and found two interaction effects (between dummy variable and continuous variable). I was wondering if it is possible to probe / plot these interactions in Mplus? If not, do you have any other suggestions for post hoc analyses of these interactions(MODPROBE is unfortunately not possible, only for OLS or dichotomous outcome measures). Hope you can help me. Karen 


Why not plot the probability as a function of the continuous variable at the different dummy variable values? So with a binary dummy variable you get 2 plots in one graph. 


Dear dr. Muthen, Thank you for your reply. The reason why we want to plot the continuous variable is because we wanted to test theoretically whether this variable modifies the dummy variable (and not the other way around). Is it possible to plot interactions in Mplus? 


There is no interaction plot feature in Mplus. I don't think you can tell if the continuous variable modifies the dummy variable or the other way around. But you can certainly see/plot how the DV probabilities at the 2 different dummy values change over the values of the continuous variable. Imagine 2 bars (one for each dummy value; height being the probability) situated at several values for the continuous variable. 

Marie Taylor posted on Wednesday, February 23, 2011  4:51 pm



I am sorry if I am not posting my question in the correct spot. I am trying to model the relationship between beliefs (at Time 1) and interracial contact (at Time 1, 2, & 3). Currently, I have: T1RaceContact ON belief; T2RaceContact ON belief; T3RaceContact ON belief; Am I right that this only shows tests of linear relations between T1 beliefs and T1, 2, and 3 race contact, but doesn't depict the relation between T1 belief and the change in race contact from T1 to T2? Or is that in the model, given that T1 is in the model? If it is not, how would I include it? Thank you so much! 


No, this model does not show how belief influences the change in racecontact. You would have to specify a change model for racecontact and let belief influence that change. For instance, using a growth model you could let belief influence the slope growth factor. 

sunnyshi posted on Wednesday, April 13, 2011  3:54 pm



Dear Dr. Muthen, I am running an SEM using survey data. My questions are: 1. I try to test the effect of moderator M on the relationship of A and B. A,B, M are latent constructs. The model command: AxM A XITH M; B ON A M AxM; Just from the model command, how can Mplus know which one is the moderator? A or M? Could I use just the following command: AxM A XITH M; B ON A AxM; 2. To get the fit of the model, I run a model without the interaction term of AxM and do the chi square difference test. Both the models using MLR estimator. However, I could not obtain the scaling correction factor for the model with the latent interaction term. How should I conduct the test under this situation. 3. To conduct the chi square difference test, I have to assure both models (the models with and without the interaction term) to use the same information matrix. Am I right? Thanks! Best, Sunny 


1. An interaction model like this is symmetric in A and M. That is, you can't say that one and not the other is the moderator  your substantive reasoning suggests which way you want to present it, but statistically there is no difference. 23. A simpler approach is to just look at the significance of the interaction term. See also Mooijaart & Satorra (2009). On insensitivity of the chisquare model test to nonlinear misspecification in structural equation models. Psychometrika, 74, 443455. This also shows an example on page 445 of how the Rsquare contribution for the latent variable interaction is computed. For general covariance algebra with latent variable interactions, see the appendix of Mooijaart & Bentler (2010). An alternative approach for nonlinear latent variable models. Structural Equation Modeling, 17, 35733. 


Dear Dr. Muthen, If I use two enxogenous variables and one endogenous variable to examine the interaction effect with LMS method in Mplus, for example: f1 BY y1y3; f2 BY y4y6; f3 BY y7y9; f1xf2  f1 XWITH f2; f3 ON f1 f2 f1xf2; The degree of freedom of structural part is 1 (even if the degree of freedom of overall model is positive), namely, underidentified. Do you think such an interaction model is problematic? 


No, because you don't use information from only the covariance matrix (2ndorder moments), but higherorder information  namely the raw data. Chisquare testing in the usual way is not available with latent variable interactions. 


Thanks for your response much! Best regard 


Since the use of multiplicative scores can be problematic to measure an interaction between ordinallevel and polytomous variables, is there a preferred approach in creating this term in Mplus? I'm interested in the moderating effect of a 7 category ordinal variable on a 5 category polytomous variable. 


I can't think of a preferred approach. Unless you have strong floor or ceiling effects, perhaps you can simply treat them as continuous and use the product. Otherwise, perhaps you can use substantive reasoning to create a binary dummy variable from the 7cat vble and let that moderate (or a couple of such dummies). 


Hi, I'm interested in testing a moderatedmediated model in which an x  me  y relationship is moderated by MO. I want to test two theories, one in which MO affects the entire relationship, and one in which MO affects only part of the relationship, say between xme. I've read the previous posts on how to create interaction terms in Mplus. However, I wondered (and please forgive what may be a silly question) if the interaction terms can be created outside of Mplus and imported in as separate LVs? I'm just wondering if this would avoid any computational problems with the integration algorithm (I have all continuous measures) and if this would give 'typical' model fit statistics (RMSEA, CFI); although I appreciate that there are other ways to test the fit of a model. Thanks, Stacey 


Is MO a latent variable or an observed variable. 


It's a latent variable. However, in a second set of analyses I hope to do, my moderator will be an observed variable. Thanks. 


I would use the XWITH command to create the interaction unless the latent variable has several very good indicators. Factor scores are not welldetermined when there are few indicators. 


Thanks Linda. I wondered if I might ask two further questions (or rather, confirm that my understanding from reading your responses to related topics is correct)? 1. The analysis I described will produce unstandardized estimates (e.g, y on x), but not standardized estimates. Because the analysis is done as a single group, it is not possible to estimate the mean and sd for individual 'factors' in the model (e.g., x, me), and therefore, not possible to compute standardized estimates (from the unstandardized values)? 2. Simple slopes is not possible in Mplus (this one I'm less sure on)? However, it is possible to estimate most necessary statistics (covariance matrix, SE, etc.) to conduct this analysis outside of Mplus (e.g., through Kris Preacher's calculator for 2way interactions). However, it wasn't clear to me if Mplus computes a constant at the model level, rather than the individual parameter level? Sorry to ask further questions. Mplus is new to me and I want to make sure that my understanding is correct. 


Linda, I now have a clearer understanding on the two issues that I posted on yesterday so please don't feel the need to reply. From what I've read it seems that the interaction effect can be explored by using the MODEL CONSTRAINT command. I understand how this is achieved, however, I'm unsure how to extract the SD values to enter into this command (if I wanted to see the slopes at +/ 1SD of the mean of the moderator)? 


See the FAQ on the website with the title # The variance of a dependent variable as a function of latent variables that have an interaction is discussed in Mooijaart and Satorra. 


Dear Linda, at the moment I am confused with my model. Would be great if you could help me out. First of all I am using MLM, have 300 raw data (with 3 items each) and use for all my analysis the output “standardized tech4” In addition to my “normal model” which looks like as the following: Model: x by(x1x3) y by(y1y3) c by(c1c3) d by(d1d3) e by(e1e3) c on x C on y d on c e on d Now I wanna do the following: 1) "f" (is ordinal 1 or 2 :does a multi group analysis make sense when I would like to examine the impact on "e" and "d" (by f)? (I am not interested in the impact on x,y,c) (and also see the data which would be then such 150 each)Would it be better to analyze an indirect effect (ind) f1 f2 ind d f1 f2 ind e? 2)to examine the moderate effect g (g1g3)with influence between e and d. Would a mod.regression analysis be correct when I write under “e on d”: g with e g with d? Thank you so much for your support 


1) I would simply use f as a covariate influencing the DVs you want. 2) If g is a factor that moderates e on d, you would create an interaction: inter  G XWITH d; and regress e on both d and inter. 


Dear Bengt, wow! thank you so much for your fast reply! I tried your advice. to 1)"f" is a bivar. variable (0 and 1) all other variables are multivar.: > when I do "d on f" I get a significant negative value  did the programme take automatically 0 (yes)? So I know that if the answer was "yes" it has an neg. impact? (so I do not have to give any other comment under "names are")? to 2) unfortunately it did not work. I also read the Example 5.13 in your book. But I guess it is s.th else. So I did the following in addition to my normal model (because my moderate variable is G and I wanna have the moderate effect between d and e): INTER G XWITH D; E ON D E ON INTER; But it did not work. So I included under ANALYsis = RANDOM; ALGORITHM = INTEGRATION; (Do I need this comments really?)but still did not work. AND I would like to have the ESTIMATOR = MLM and it still did not work?? Maybe you have an advice for me? Sorry, I feel just stupid at the moment. Thank you again so much. 


Well it does work when I do it as I described (Analysis=Random; Algorithm = Integration; Estimator = MLM;) The programmes calcuates s.th., but it looks very wrong (very slow, black backround (C://windows/system32/cmd.exe)... 

WenHsu Lin posted on Monday, October 31, 2011  1:19 am



After reading some of the posts, I am still confused as what to use to evaluate model fit? Is declaring the significance of the multiplicative term (xwith) enough? Thank you. 


Yes, the significance of the interaction is enough. Chisquare is not valid with a latent variable interaction because means, variances, and covariances are not sufficient statistics for model estimation. See the FAQ on the website: The variance of a dependent variable as a function of latent variables that have an interaction is discussed in Mooijaart and Satorra 

WenHsu Lin posted on Friday, November 11, 2011  10:44 pm



Hi, Linda: The xwith command was executed with type = random, does that mean the coefficient of the interaction term is like the random effect in the multilevel modeling? The explanation of the coefficient is still like the one we will use for the regular interaction term in the OLS? Thank you. 


The latent variable interaction is a fixed effect. The interpretation is the same as a regular interaction. 

WenHsu Lin posted on Saturday, November 12, 2011  7:38 pm



Thank you Linda, one follow up, can I use type = imputation while I am running inter A xwith B crime on inter? I did run it but the results wont give me significant test like when I ran with one of the five datasets. 


I just ran a similar example and got a significance test. Please send your output and license number to support@statmodel.com so I can see why you did not. 


Dear Dr. Muthen, I am running a model with 3 factors (all continuous indicators), where factor 1 and 2, as well as the interaction of factor 1 x 2 predict factor 3. f3 ON f1 f2 f1xf2; I am using XWITH to create the interaction term, with TYPE=RANDOM and ALGORITHM=INTEGRATION. The model indicates that factor 2 is a significant moderator in the relationship between factor 1 and 3. Because of TYPE=RANDOM the output does not provide the usual model fit indices. You suggested earlier that in order to assess model fit, one should compare nested models using 2 times the loglikelihood difference. I ran the model without the interaction term, only including the regression paths f3 ON f1 f2. All model fit indices for this model are good (ChiSquare Test of Model Fit, p = 0.1209, RMSEA = 0.031, CFI = 0.977). Loglikelihood increases from 1405.365 in the model without interaction to 1401.301 in the model with the interaction. However, the 2 times loglikelihood difference indicates that the models are not significantly different. 1. Does that mean the nested models have equally good model fit? Can i report the model fit from the model without the interaction, and state my model including the interaction has equally good model fit? 2. That means including the interaction does not improve my model significantly? Is this an argument against my moderator hypothesis? 


Two times the difference between your two loglikelihoods is about 8 which is significant for one degree of freedom. This should agree with the ztest for the interaction in the model where the interaction was included. 


Thanks for your quick reply, that was helpful. Does that mean my moderation model is significantly better than the model without the interaction term? Is it appropriate to report model fit for the model without the interaction term and then state that the model including the interaction has a good model fit too (or according to loglikelihood a significantly better model fit)? 


This means that the interaction is significant. Reporting the fit of the model without the interaction is probably the most you can do. See the following FAQ on the website for further information: The variance of a dependent variable as a function of latent variables that have an interaction is discussed in Mooijaart and Satorra 

Chris Bruell posted on Wednesday, February 08, 2012  8:28 pm



Good evening, I'm attempting to look at the interaction effect of two latent constructs on a third latent construct: analysis: type=random; model: f1 by y1y5; f2 by y6y17; f3 by y18y35; f1 on f3; f2xf3  f2 xwith f3; f1 on f2xf3; I'm wondering if it's ok if I first save the factor scores (running a CFA) and then use the define function to run the regressions that way. Thanks! 


Using estimated factor scores in regressions is usually not as good as estimating the model you specified. 

Martina Gere posted on Thursday, February 09, 2012  4:53 am



A followup question on my moderator model (see february 5th). How do I calculate the slopes of f3 ON f1 for different values of my moderator f2? Q1: Can I use the regression coefficients and variances of the latent variables in the output of my interaction model in order to calculate the slopes for mean, sd, +sd of the moderator by hand? (e.g. for slope when moderator +1sd: unstandardized regression coefficient of f1 + unstandardized regression coefficient of f1xf2 * sd of f2) Q2: Can i test whether slopes are significantly different in this case? How? Q3: Or can I run the model in MPlus while setting different means for f2 (0, +1sd, 1sd) and observe the resulting regression coefficients for f1? If yes, how do I set a mean of a latent variable? 


See our Topic 3 short course handout, slides 164171. 


Thank you. I looked at the example in your handout, and there you are calculating different slopes for the mean, +1SD, 1SD of the moderator using an equation with standardized regression coefficients. However, running the interaction model with TYPE=RANDOM, the standardized option in the output is not available. Can I use unstandardized regression coefficients and calculate the standard deviation of my moderator variable based on the variance in the output? 


You would use the unstandardized as shown in the course slides and then standardize as also shown using the variance from TECH4. 

Martina Gere posted on Saturday, February 11, 2012  3:02 am



When I run my moderator model with TYPE=RANDOM the output tells me that TECH4 is not available for TYPE=RANDOM. Do I use the variances from the simple model before adding the interaction? If yes, I think I understand how to calculate standardized regression coefficients for both independent variables. But how do I calculate the standardized regression coefficient for the interaction of my latent variables? Could you point me to the page in the handout where this is described? I'm sorry for all the questions. I'm new to Mplus. 


See slide 170 of Topic 3, which shows that the interaction is broken up into its components  see the "Unstandardized" formula for i and mthcrs7. To standardize the expression (0.0450.047*i)*mthcrs7 you multiple both numbers by the SD of each of i and mthcrs7. You find the variances corresponding to those SDs in the output. 


I have followup questions about slide 170171 of topic 3 (text is pasted here, 3 questions follow). Unstandardized s = 0.417 + 0.087*i + (0.045 – 0.047*i)*mthcrs7 Standardized with respect to i and mthcrs7 s = 0.42 + 0.08 * i + (0.040.04*i)*mthcrs7 1. Is the intercept term "a" simply rounded (and unstandardized)? 2. Is "a" unstandardized because you are attempting to calculate an unstandardized "s"? 3. If I wanted to "s" to also be standardized, would I use the StdYX equation to standardize all coefficients with respect to i, s, and mthcrs7, yet only involve i, s, or mthcrs7 in the StdYX formula if they are relevant to the coefficient being standardized? Thank you, Joe 


1. Yes. 2. Yes. 3. This would be difficult to do. You would need to divide all coefficients by the standard deviation of s. TECH4 is normally where you would find this but it is not available with TYPE=RANDOM. 


Dear Linda, Thank you for your response. I have another question. To standardize the coefficients within the moderator function, which are 0.045 and –0.047 above, do you just multiply them by the standard deviation of the moderated variable (mthcrs7)? 


Dear Linda please disregard that last question. Having the web note 6 dataset available to replicate the analyses of Topic 3 slides 165171 was key to help me understand how to graph an interaction from XWITH. Also, web note 6 described that these calculations are easier if the moderating latent variable is standardized to have a mean of 0  that was very helpful too. Thanks for these. Minor suggestion the excellent "Latent variable interactions" FAQ would be more reachable to beginners like me if it included code/output and concrete examples, such as those mentioned above. Thanks as always! 


Hello, I would like to use "gender" as a predictor in a path model that includes many other observed variables. I am also interested to know if path coefficients among the variables differ across gender. I thought about two strategies: (1) To run a multiple group analysis using "gender" as a grouping variable to test the original model from which gender would be excluded. (2) To create interaction variables (varXgender) for all of the paths that are hypothesized to differ across genders. I would prefer the first strategy, but because the model would not be exactly identical to the original model (i.e., gender would be excluded), I am not sure I can do that. Thanks for your help. 


Interactions can be assessed using multiple group analysis or creating an interaction term. In multiple group analysis, an interaction exists if, for example, a regression coefficient is different for the two groups. This can be assessed by chisquare difference testing or using MODEL TEST. 


I am working on a path analysis where I have 2 latent factors (made up of categorical variables) as my DV's and 3 continuous variables as my IV's. I am interested in doing a multiple group analysis based on gender  and I know how to write that into Mplus. But I also want to look at a continuous puberty score as a moderator from each IV to each DV. Here is the syntax I have so far... f1 by x1 x2 x3 x4 x5 x6; f2 by x7 x8 x9 x10 x11 x12 x13; f1 on teach1 teach2 teach3; f2 on teach1 teach2 teach3; How do I write in the moderator information, using P1 as the variable name? Thanks! 


You use DEFINE to create interaction variables such as p1*teach1 and then include those new variables in the ON statements. 

NI YAN posted on Monday, October 01, 2012  5:14 pm



Dear Dr.Muthen, I was trying to use path analysis to demonstrate a significant indirect path (A>B>C). I have two questions about choosing from estimators of MLR and MLMV. First, I was wondering what is the exact difference between MLR and MLMV estimators. Because I know my endogenous variable C is skewed, I chose MLMV as the estimator type. The indirect path was significant. However, when I used MLR, the indirect path could not be detected any more. I did not understand what made the results different. Second, in above responses, you mentioned that "MLMV cannot be used with missing data". I compared the number of observations from both models using MLMV and MLR, and they are completely the same. Does this suggest MLMV could take care of missing data? Looking forward to hearing back from you. Thanks! 


I would use MLM or MLR for continuous variables. Both are robust to nonnormality. If there is a difference in significance using MLM and MLR, I would be cautious in interpreting the results. 


Dear Dr Muthen, I'm wanting to run an analysis with the following variables: IV's: X1 (betweensubjects, categorical 2 levels), X2/Y1 (attractiveness high/low, withinsubjects variable with 2 levels, also a 2 continuous depended variables) X3/Y2 (status high low, withinsubjects variables with 2 levels, also two continuous dependent variables) Mediator: Y3, Y4, Y5, Y6 (all continuous) DV: X2/Y1 (dependent variable, also a withinsubjects variable) X3/Y2 (dependent variable, also a withinsubjects variable) participants had to rate 4 photos on their desire to date the person (highattractiveness and high status, highattractiveness and low status, lowattractiveness and high status, lowattractiveness and low status) which made up the withinsubjects/dependent variables I want to set up a pathway analysis that tests whether X1, X2, X3 moderate the participants desire to date the photos. Additionally I would like to see if Y3, Y4, Y5, Y6 mediate the effect of X1 on the within/dependent variables. Is it possible to set up this pathway? If so would you please be able to help me set it up? I've looked through the manual and found the within and between commands but I'm still unsure how to use them. Thank you for your time. Georgia 


The WITHIN and BETWEEN options are for nested data. Do you have nested data, for example, students nested in classrooms? 


Thanks for getting back to me so fast Dr Muthen. I really appreciate it. I don't think I have nested data. It's a basic experimental design that you could run a mixed ANOVA on if it wasn't for the mediator I want to include. Can you suggest an appropriate analysis for this kind of data? I was thinking of just treating the within subject variables a their own separate DV's and testing for mediation effects on each of them. Thank you again 


Within subject variables are repeated measures of the same variable. You could do the mediation model for each time point separately. 


Thanks again Dr Muthen. You've been so helpful. I really appreciate it. Georgia 


I am getting the following error when running a moderation (see below). Can you please advise where I have made my error? Thank you very much for your expert advise. HE ESTIMATED COVARIANCE MATRIX COULD NOT BE INVERTED. COMPUTATION COULD NOT BE COMPLETED IN ITERATION 1. CHANGE YOUR MODEL AND/OR STARTING VALUES. THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY DUE TO AN ERROR IN THE COMPUTATION. CHANGE YOUR MODEL AND/OR STARTING VALUES. Model: DMHRSc BY dmhrs3; DMHRSw BY dmhrs4; WFCT BY wfct1 wfct2 wfct3; WFCS BY wfcs1 wfcs2 wfcs3; FWCT BY fwct1 fwct2 fwct3; FWCS BY fwcs1 fwcs2 fwcs3; GRT BY grt1 grt2 grt3 get4 grt5 grt6 grt7 grt8 grt9; dmhrs3@0; dmhrs4@0; WFCT ON DMHRSw; WFCS ON DMHRSw; FWCT ON DMHRSc; FWCS ON DMHRSc; HWxGRT  DMHRSw XWITH GRT; HCxGRT  DMHRSc XWITH GRT; WFCT ON HWxGRT; WFCS ON HWxGRT; FWCT ON HCxGRT; FWCS ON HCxGRT; Analysis: TYPE IS RANDOM; ALGORITHM IS INTEGRATION; ESTIMATOR IS MLR; ITERATIONS = 1000; CONVERGENCE = 0.00005; Output: SAMPSTAT; 


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


Hello, considering an interaction model: model: sow on bankloy (b1); sow on umsat; basa_si  umsat xwith bankloy ; sow on basa_si (b2); I calculate the margianl effect of the focal variable bankloy at the moderator (=umsat) value "1" in the model constraint: ibs_1= (b1+b2*1); output: IBS_1 0.462 0.418 1.104 0.270 1) Does the output s.e. error 0.418 multiplied with +/ 1,96 result in the corresponding confidence intervall? 2) is the pvalue (0.27) for the marginal value calculated via delta method? thanks in advance alex 


Yes and yes. 

Jackson posted on Tuesday, March 12, 2013  4:30 pm



If I want to look at the moderation effect of variable M on relations between X and Z and Y and Z. Should I create two interaction terms (X*M and Y*M) and then regress Z on X, Y, XM, and YM? Is there anything particular that I should be doing other than this if so? 


Is one of your variables, for example, z a mediator. Or is your model without the interactions: z ON x y; 


Hello, Is it possible to test an interaction between a continuous latent and a continous observed variable on a dichotomous outcome? Thank you 


Yes, you would use the CATEGORICAL option, maximum likelihood estimation, and the XWITH option. 


So if I am interested in testing a interaction effect of x48 between f3 and u1 is this the correct input? Variables: names are X1 X7 X8 X9 X11 X47 X14 x22 x24 x25 x33 x34 x35 x36 x37 x48 u1; categorical is u1; analysis: type=random; model: f1 by x47 x1 x7 x8 x9 x11 x14 x22 x24 x25; f3 by x33 x34 x35 x36 x37; f3xx48  f3 Xwith x48; f3 on f1; u1 on f3xx48; u1 on f3; 


That looks correct. You may also want to include u1 on x48 so you have both main effects and the interaction. 

Cecily Na posted on Friday, May 31, 2013  9:46 am



Dear professor, I came up with a model in which a causes b, and b subsequently causes c. (a>b>c). I hypothesized that the fourth variable d moderates the link a>b, as well as the link b>c. Thus, d serves as a moderator twice in this model. Is this a reasonable model and testable in Mplus? If d serves as mediator twice (mediates between a>b, and b>c), would it be testable in Mplus as well? Thank you again for your generous help! 


Yes, this is reasonable and doable. The easiest case is when d is categorical so you can do a multiplegroup run. 


Hello, recently I calculated latent moderation analysis using the LMS approach. I am looking for a way to test the simple slopes  yet I do not know how to get/caculate the covariance between the latent predictor and the latent interaction term (which is needed for the slopestools, e.g. http://quantpsy.org/interact/mlr2.htm). Is there a way doing this in MPLUS? (since TECH 4 doesn't work with TYPE=RANDOM) Thank you in advance already! 


See the FAQ "Latent variable interactions" at http://www.statmodel.com/download/LV%20Interaction.pdf 


I am testing for group differences in a twoway interaction by using a multigroup model (boys vs. girls) comparing the constrained model where the twoway interaction (using the define command) was constrained to the model where all parameters were freed. The difference in the degrees of freedom for the two models, however, was 7 (not 1 as I expected). Why? What other parameters have been constrained by fixing the interaction? Do I need to constrain the main effects of the interacted variables as well? 


Hi, I was wondering if you could give any advice on adapting the formulas in "Latent variable interactions" for cases where there are two exogenous latent factors (and their interaction) predicting an observed outcome (either continuous or categorical)? I am most likely misunderstanding the document in various ways, but it seems like it should be a lot easier to get standardized coefficients and rsquared in such an example (that is, given that the mean and variance are fixed at 0 and 1, respectively, for the exogenous factors and that the mean and variance of the observed outcomes are directly obtainable). Thanks! 


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


Jim: Your example has the structure of (1) for which the eta3 variance is in (16) combined with (17). The quantities involved are directly obtained from the estimated model. With those in hand you go through the standardization described in Section 1.4. 


Thank you Bengt. How about if the outcome (variable 3) is categorical (and denoted as such in mplus)? 


The only thing affected is the residual variance of the DV, which is no longer a free parameter to be estimated. And it refers to an underlying continuous latent response variable behind your categorical outcome. Because you have latent variable interactions you are using ML and you can use either logit or probit link. With logit the residual variance is pisquared/3 and with probit it is 1. 


Is there a way to test with a variable predicts correlated changes (e.g., duration predicts the correlated change in partner 1's satisfaction and partner 2's satisfaction (s1 and s2). 


There is not a direct way to do this. You can approximately define the covariance as: f BY f1@1 f2@1; and regress it on f ON duration; 


Dear Professor, searching for the Big Fish little Pond Effect, i´m running a doubly latent SEM with a model constraint command in the end. I'd like to analyze a moderating effect of a manifest metric Variable (akzclass) on the BFLPE. Is it possible to use the xwith command on a variable computed by model constraint? My input concerning the Model Constraint looks like this: Model Constraint: new(bflpe); bflpe=b_betwn  b_within; bflpe_mod  bflpe xwith akzclass; Thank you very much! 


No, this is not possible. MODEL CONSTRAINT estimates parameters. It does not create variables. 

H Ito posted on Monday, October 28, 2013  9:29 am



I'm interested in whether a variable z moderates an effect of x on y. All of them are observed continuous variables. To my knowledge, there are two methods to address this issue. (1) Creating an interaction term using DEFINE command (xz = x*z; y ON x z xz;) (2) Random coefficient regression using TYPE=RANDOM option (s  y ON x; s y ON z;) I'm considering that the former provides an indirect test of moderation because it does not assume the causal direction of moderation (i.e., whether z moderates the effect of x on y or x moderates the effect of z on y) while the latter provides a direct test of moderation. In my data, the results of the two analysis were very similar, but information criteria (AIC, BIC, aBIC) indicated that the latter model is superior to the former model and to the random coefficient model where x and z were interchanged (s  y ON z; s y ON x;). From these results, can I assert that hypothesized direction of moderation (i.e., z moderates an effect of x on y) is supported? 


I see these two approaches as the same when the residual variance of s in the regression on z is zero. 

H Ito posted on Tuesday, October 29, 2013  8:39 pm



Thank you professor. Indeed, I confirmed that these models produce the same results when the residual variance of s is zero. Does this mean that the difference in information criteria between the original models (where the residual variance of s is estimated) can not be interpret? 


I think the model with a free residual variance for s is an interesting generalization of an interaction. It says that some of the moderation is unobserved. If it has a better BIC, one could choose to settle on this model. 


Hi, I am planning to use SEM to examine the relationship between x and y where y is a latent variable. I will also be running models to test three different moderator variables in this relationship. Is there a way to take into consideration confounders while testing moderation? I've seen posts regarding confounding for mediation and also dealing with them as moderators but I'm wondering if there is another way to handle it when the goal of my model is to test moderation? It is confusing if I have to treat my possible confounders also like my moderator. Thank you! 


Sometimes confounders are simply extra covariates, whereas moderators create interaction terms. The difference is that the former influence intercepts and the latter slopes. 


Right so in the model would I just include those variables without specifying a relationship between them and any other variable? I'm just not sure what that syntax would look like. Thank you. 


The confounders? Say you have a confounder Z, a mediator M, and a distal outcome Y. You say M ON Z (and the other predictors, including moderator terms); Y ON M Z (and the other predictors, including moderator terms); 


Perfect, thank you! Melissa 


Dear M&M, I am running a SEM with continuous and dichotomous categorical variables. My categorical observed variable X1 (an easy text version versus a difficult text version) is an independent variable. I have a continuous observed variables X2 (decoding ability) and latent variable X3 (knowledge) predicting a latent construct Y (text comprehension). My hypothesis predicts that both continuous variables X2 and X3 interact with the categorical variable X1 and moderate the relationship between X1 and Y in my model. Furthermore I want to include a mediating latent variable. Could you tell me which procedure is necessary? Thank you very much. Anke 


Combine UG ex 3.18 and 5.13. Note that only dependent variables should be declared categorical. 


Thanks for your reply. Can you help me once more what to to with my independent categorical variable? When I'm not allowed to include the variable into the model, where to put it? It is my manipulated factor which I cannot exclude from my study. Regards, Anke. 


Why can't you include the categorical independent variable in the model? 


Linda, I have to admit I don't know. I'm quite new to Mplus and SEM. Bengt wrote this (see note from 010614 above). Can I include the binary observed ndependent variable to create interaction terms with latent continuous variables? Regards, Anke. 


Bengt said not to put the independent variable on the categorical list. He did not say to not include it in the model. Yes, you can include it and use XWITH to create an interaction with a latent variable. Please look at the suggested examples. 


I am running a moderated mediation model (#3 following the Preacher, Rucker, Hayes paper). If I use the syntax you have provided on the website (thank you by the way). Can variable W be dichotomous? If yes should I make sure the two values are 1 and 2 rather than 0 and 1? I expect I would need to identify the variable as categorical? Thanks 


If W is a moderator it can be dichotomous and gives easy interpretation when scored 0, 1. It should not be declared categorical since it is an IV. 


Can someone point me to a good paper or handout that illustrates how to interpret the output from a Moderated Mediation analyses using the model three from Preacher, Rucker, and Hayes (2007). Is the interaction term the effect of the moderated mediation and the new parameter the indirect effects of the model at the specified value of the moderator? 


Andy Hayes lists some citations for examples of applied research articles that use each model in the 2007 paper, including Model 3, here. The 2007 paper is mainly about estimating and testing conditional indirect effects, or indirect effects at specific values of a moderator. If you want to determine whether there is evidence for moderated mediation (that is, whether the indirect effect varies across values of a moderator), there is a way to test that. In Hayes' book, he proposes that (for Model 3) the product of the 'a' path (X > M) and the 'b3' path (the interaction of M and V predicting Y) quantifies this effect, and that a bootstrap confidence interval for a*b3 is a good way to test H0: a*b3 = 0. http://www.afhayes.com/introductiontomediationmoderationandconditionalprocessanalysis.html Hayes notes on that page that you can contact him for the working paper "An index and simple test of moderated mediation," which goes into more detail. Wang and Preacher (in press) also discuss such tests: http://quantpsy.org/pubs/wang_preacher_(in.press).pdf Both papers provide Mplus code. 


I should add that Example 3.18 in the Mplus User's Guide can be used as a starting point for the code. 3.18 is closer to Model 2 from our 2007 paper, but can be modified to render Model 3: MODEL: y ON m(b1) x w mw(b3); m ON x(a); w mw WITH m; You can also add a new parameter to the MODEL CONSTRAINT section that corresponds to a*b3 mentioned above: MODEL CONSTRAINT: NEW(ind mm); PLOT(ind); LOOP(mod,2,2,0.1); ind=a*(b1+b3*mod); mm=a*b3; 


Thanks very much Kris. I really appreciate the detailed response. Regards Nathan 

EM posted on Wednesday, February 05, 2014  6:02 am



Dear Prof. Muthen, in the document on latent variable interactions a formula is given on Rsquare (p.6). I was wondering if I can find all of the information needed to calculate Rsquare in the MPlus output. For example: I'm not sure where to find V(eta3)? Thanks in advance! 


Equation (21) on page 6 shows that eta3 is a DV and as such the variance parameter that is estimated is the residual variance for eta3 (the variance of zhi3). You have to compute the total variance of eta3 using the instructions in this document. 


Hi! I am MD student, writing a dissertation. I want to use SEM to test a model with moderated mediation in which an x  me  y relationship is moderated by MO. I assumed that both xme and mey would be moderated by MO. I wonder I can analyze this model at once. If not, each path should be analyzed? (For example, whether xme is moderated by MO. And then mey is moderated by MO). MO is a continuous latent variable. I will look forward to hearing from you soon. Thank you 


I would first investigate whether the moderation of the mediation> y relationship is significant. It most often isn't. And if it isn't you can go on and do the type of analysis shown in UG ex 3.18. 


Thank you for your answer. I have a further question. I wonder below is reasonable and doable for testing moderated mediation(x1 and x2>me>y and mo moderates simultaneously moderates both the link x>me and the link me>y). x1>me me>y mo>me x1*mo>me x2>me x2*mo>me x1*me*mo>y x2*me*mo>y I will look forward to hearing from you soon. Thank you! 


This looks okay. 


Hi Linda I have an error when I try to estimate my model. But the model is bigger than the limited question space. Can I email it to you to see where is the error? Thanks Ala 


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


Hi! I am doing a multiple group analysis with a latent construct A(with 4 continuous indicators) predicting a latent construct B(with 1 continuous indicator). I want to now test whether A>B relation is moderated by a latent construct C (1 binary indicator), and whether the moderation differ across groups. My initial thought was to further divide the groups I have  so from group 1, I will create group1A and group 1B (because the moderator I have is binary), and run the A>B model for these new groups. Is my thinking here correct? However, this strategy will further make my sample size small, so I don't think this is possible for my data. I've been reading on the forum and it seems that I can make an interaction term with xWITH between categorical latent variable and continuous latent variable. Is this true? If so, can I apply this to a multiple group analysis as well (that is, create an interaction term, then test the model across groups)? Thank you for your assistance! 


Answers to your 3 questions: Q1. Yes. Q2. You can make an interaction between your latent variable A and your binary moderator. Q3. You can extend that to a multiplegroup setting by using Type=Mixture using Knownclass to represent the groups. 


Hello Dr. Muthen, I have Z moderating Y1 and Y2, where Y1 and Y2 are both endogenous variables. What should my syntax be to calculate the moderating effect of Z on the Y1 Y2 path? Will the output give me all the necessary data or should I calculate beta, SE and also Z score? Thanks 


See the left margin of our home page, labelled Mediation. There you will find examples of moderation, both in terms of input and in terms of plots. 


Dear Professor Muthen Can you please explain to me if moderation effects are the same than study the influence of the interaction between two variables on an outcome? I want to analyse the influence of the interaction between intelligence and prior academic achievement on subsequent academic achievement. I used the XWITH command to estimate the interaction effect. Is it correct? What should I do to get the model fit and the standardized results? Can you please help me. Thank you so much. Best, Diana Soares 


Moderation is an interaction. See the Latent Variable Interaction FAQ on the webiste. 

Nara Jang posted on Thursday, June 05, 2014  7:22 pm



Dear Dr. Muthen, I tried to test the interaction term between one continuous latent variable and an observed variable. I wrote the variable of A*b in the left side of  without any blank, but there is warning sign that only one interaction can be defined at a time. Would you tell me how to fix this? Thank you! 


Don't use a*b as the name of the interaction. The * has a particular meaning in Mplus. Use a name like ab  a XWITH b; 

Nara Jang posted on Sunday, June 08, 2014  10:10 am



Dear Dr. Muthen, Thank you so much! 

Nara Jang posted on Sunday, June 08, 2014  11:11 am



Dear Dr. Muthen, I have two latent variables (X1 and Y) and several observed categorical variables (x2). I am conducting moderating effects using the categorical variables. That is, one latent variable (X1) is an exogenous variable, the each categorical variable is a moderator (x2), and the endogenous variable (Y). Y=X1+x2 + X1*x2. Would you explain to me how to test the moderating effect? Thank you very much for your great help. 


Use the XWITH option for interactions between latent variables and latent and observed variables. See Example 5.13. 

Nara Jang posted on Sunday, June 08, 2014  12:37 pm



Dear Dr. Muthen, Thank you very much for your great help! Best regards, Nara Jang 


Hello Dr. Muthen, I am trying to run a test of moderation using the technique of creating orthogonolized latent variables described by Little, Bovaird, & Widaman, (2006). The measurement model with only the latent predictor and outcome variables terminated normally and with a good fit. But I have not been able to get the model to run with the interaction term estimated. The error message I receive is: "NO CONVERGENCE. NUMBER OF ITERATIONS EXCEEDED." I'm not sure what the problem is and would really appreciate any guidance you could provide. I wasn't able to copy the syntax due to the size limits of posting here. I would be happy to send you any more information that you might need to conceptualize this problem. Thank you for your time, Lucas Morgan 


I would need to see your full output. Send to support@statmodel.com along with your license number. 

George Y posted on Tuesday, July 29, 2014  4:33 am



Hi, I am examining an interaction effect in a probit model in Mplus. Typically I would use Tech3 to get the info I need for the standard errors of each level of the moderator (as per K.Preacher's webpage http://www.quantpsy.org/interact/interactions.htm) and then use a ttest for significance at each level. But are the results from Tech3 appropriate to use to calculate the SE when using a probit model? Thanks for your time 


Yes, TECH3 can be used for a probit model. You may find using Example 3.18 easier to do. 

Nara Jang posted on Monday, August 04, 2014  11:15 pm



Hello Dr. Muthen, I got the result of latent interaction model. In the output, it states that 1 perturbed starting values in the initial stage and 7 perturbed starting values were not converged, but the model estimates terminated normally. Followed by previous messages, all the results were computed. In this case, would you tell me if the estimates can be trusted? Thank you so much! 


You must replicate the best loglikelihood several times for the results to be interpretable. 

Nara Jang posted on Tuesday, August 05, 2014  11:44 am



Dear Dr. Muthen, Thank you so much for your great help! Best regards, Nara Jang 


Dear All Still unable to grasp this concept. I have a mediation model with x m y. Trying to add z as a moderator. With z being a grouping variable, it was suggested that I should use a 2group analysis. Have since attempted to follow similar posts from this discussion forum, but couldn’t work out my problems. Would appreciate your guidance again on the following: (1)Where and how should specify grouping variable in the input section? (2)also have followed the counterfactuallydefined indirect effect approach described in Muthén and Asparouhov, 2014, and have come up with the input below. The model runs, but not sure whether my specification is correct and meaningful. (3)Are the (low, high, increment) in the Model Indirect section fixed values in all situations and what do they entail? (4)Are all the outputs requested in your paper necessary or which specific output should I focus on to just figure out results of the moderated mediation? Usevariables Are ORNIR AAQ GSE LOTR SHS breach gender int; CATEGORICAL = breach; Define: int =gender*ORNIR; ANALYSIS: ESTIMATOR = ML; LINK = PROBIT; MODEL: PPS BY AAQ GSE LOTR SHS; breach ON PPS gender int ORNIR; PPS ON gender int ORNIR; MODEL INDIRECT: breach MOD PPS gender (1,1,0.1) int ORNIR; OUTPUT: TECH1 TECH8 SAMPSTAT; PLOT: TYPE = PLOT3; 


1) See the Grouping option in the UG index. 2)The specification is described in the Version 7.2 Mplus Language Addendum on our website. Your setup looks correct  you are using y MOD m z (*) xz z; with z = gender and x = ornir. 3) See the Addendum description. Scoring gender = a/b you should have Model Indirect (low, high, increment) use (a, b, ba) so with a=0, b=1, you have (0,1,1). Look in the output for the heading: TOTAL, INDIRECT, AND DIRECT EFFECTS BASED ON COUNTERFACTUALS (CAUSALLYDEFINED EFFECTS) See also the handout on our website from the July Madison version 7.2 workshop, slide 37. 


Thank you so much for your prompt response Bengt. Still having difficulty as a novice. I have referred to the guideline on how to specify a grouping variable and the addendum for moderated mediation. When I include the grouping variable to the model, the following error appears: "ERROR in ANALYSIS command ALGORITHM=INTEGRATION is not available for multiple group analysis. Try using the KNOWNCLASS option for TYPE=MIXTURE." Would the output be interpretable if I simply run the input below and leaving the grouping specification out? Also referred to the handout on your website from the July Mplus 7.2 workshop, slide 37 for the output relating “TOTAL, INDIRECT, AND DIRECT EFFECTS BASED ON COUNTERFACTUALS (CAUSALLYDEFINED EFFECTS)”. Is that relates to the output at the beginning? I am a bit confused as my output has several of those in the list and each with different estimates and significance values. Thanking you for your patience and support. Usevariables Are ORNIR AAQ GSE LOTR SHS breach gender int; CATEGORICAL = breach; Grouping Is gender (1 = male 2 = female); Define: int =gender*ORNIR; ANALYSIS: ESTIMATOR = ML; LINK = PROBIT; MODEL: PPS BY AAQ GSE LOTR SHS; breach ON PPS gender int ORNIR; PPS ON gender int ORNIR; MODEL INDIRECT: breach MOD PPS gender (1,1,0.1) int ORNIR; OUTPUT: TECH1 TECH8 SAMPSTAT; PLOT: TYPE = PLOT3; 


If you take the 2group approach you have to use Mixture Knownclass to do it because you have a binary outcome (breach). But you don't have to take the 2group approach but instead proceed as you are doing here using MOD with gender. Note that your input doe Model Indirect is still wrong. You should say MODEL INDIRECT: breach MOD PPS gender (1,2,1) int ORNIR; This is because you score gender as 1 and 2. There is only one heading with the word "counterfactual". You have subheadings corresponding to your different gender values. 


Thank you Bengt. Looks like I got it. Regards, Yilma. 


Good morning, I have read this conversation but I've already a problem. Concretely I try to compute this moderation script without success. Please, can you help me to find the error? VARIABLE: NAMES ARE A1 A2 A3 B1 B2 B3 C1 C2 C3; USEVARIABLES ARE A1 A2 A3 B1 B2 B3 C1 C2 C3; DEFINE: AB = A1*B1 A1*B2 A1*B3 A2*B1 A2*B2 A2*B3 A3*B1 A3*B2 A3*B3; MODEL: C on A; C on B; C on AB; Thank you so much! 


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


Good morning Linda Muthen, thanks for your cordial answer but unfortunately I have no output since there is this problem: *** ERROR An internal error has occurred. This may be caused by an error in the DEFINE command or in the USEOBSERVATIONS option of the VARIABLE command. Check these statements in your input. How I can manage it? What is the error in the previous script? Thanks again for your support 


I expect the following statement is the problem: AB = A1*B1 A1*B2 A1*B3 A2*B1 A2*B2 A2*B3 A3*B1 A3*B2 A3*B3; What does it mean? 


Good morning Linda Muthen and thanks again for your answer, what I want say is that if I have two variables (for example variable A composed by the items the A1, A2 and A3, and variable B composed by the items B1, B2 and B3) impacting on a third variable, I’m not able to create the right script to compute the moderation (i.e. the interaction between the variables A and B). Please, can you help me? 


If you want to create an interaction between two observed variables, a and b say DEFINE: int = a*b; and put int at the end of the USEVARIABLES list. If a and b are factors, use the XWITH option. See Example 5.13. 


Thank you so much, the suggested solution works well! 

Back to top 