Message/Author 


Do you have a sample input file for Latent Moderated SEM? I have a moderated mediation model where the moderator (V) is an exogenous latent variable. The mediator (M) is also an exogenous latent variable. The DV (Y) is an observed continuous variable. I would like to model the moderation between M and Y or between X and M. One complication is that X is an unordered categorical variable (2 dummy variables representing three values) What can you suggest? 


You have input in the FAQ Latent variable interaction LOOP plot. Moderation modeling with latent variables and dummy Xs may be more easily done via multiplegroup modeling (3 groups in your case) where key parameters vary across the groups. But you can use XWITH also for interactions between latents and dummies. Modeling the moderation between M and Y requires extra care as shown in Model 1 of Preacher, Rucker, Hayes (2007) in MBR. 


Thank you for the prompt and helpful reply. From Preacher, Rucker, Hayes (2007), I want Model 2 and Model 3. Previously, I used "Define: MV = M * V with continuous observed variables. Now "Define" does not work before "Model" since M and V are latent variables created by "BY". I can only get XWITH to work for "Type = Random; Algorithm = Integration;", no bootstrapping or fit stats. Is there a better alternative? I appreciate your assistance. MODEL: Variety BY Variety1 Variety2 Variety3; !(M) Expertis BY Chooser1 Chooser2 Chooser3; !(W) SelfDet BY SelfDet1 SelfDet2 SelfDet3 SelfDet4; PrefID BY Manchk1 ManChk2 ManChk3; Inter Expertis XWITH Variety; !(M * W) Variety ON Cat_0 Cat_U (a1); !(a1 or M on X1 and X2) Satisf1 ON Cat_0 Cat_U !(c' or Y on X! and X2) Variety (b1) Expertis !(b2) Inter (b3) SelfDet PrefID; !Expertis WITH Variety; !Inter WITH Variety; MODEL CONSTRAINT: PLOT(Indirect); LOOP(Expert,2,2,0.1); Indirect=a1*(b1+b3*Expert); !(Y = a1(b1+b3W)) !MODEL INDIRECT: !Cat_0 IND Variety Satisf1; !Cat_U IND Variety Satisf1; 


XWITH is required for interactions between latent variables. 


Thanks Linda, I see that the User Guide explains that. I was hoping for an alternative. I have a working model, output and plots but I see that the model fit statistics are limited with MLR. The plot of indirect effect against values of the moderator shows confidence intervals, that always include 0 so I can interpret that as meaning that the the null H of "zero indirect effect regardless of the level of the moderator" cannot be rejected. Still I was wondering if you could direct me to a source that would explain how to interpret the output. Thanks David 


Yes, with XWITH fit statistics have not been developed in the literature. You can check significance of the interaction and compare models using BIC. You are interpreting the moderator plot correctly. Which part of the output are you uncertain about? Regarding XWITH the 2 latent variable interaction FAQs is all we have at this point. 


Thank you. I was hoping for a means to calculate p values of the conditional indirect effect over a range of values of the moderator and then apply the JohnsonNeyman technique. If not, I will rely on the confidence intervals. Best regards, David 


What is it you need beyond the confidence interval plot? That gives you the region of significance discussed in Figure 3 of Preacher, Rucker, Hayes (2007). If you express the indirect effects in Model Constraint, you get pvalues for them. 


Hi Bengt, When I use "Model Indirect:" in the constraints section I receive the following error message: "MODEL INDIRECT is not available for TYPE=RANDOM." The model is one of conditional indirect effects (models 2 or 3 in PRH 2007) where the moderator and mediator are both continuous latent variables with 3 indicators each. Your suggestions are appreciated. David 


You have to use Model Constraint, where you express the indirect effects using parameter labels given in the Model command. 


Hi Bengt, One of the interaction variables is latent so I use XWITH and Type=Random. I receive the error message "*** ERROR MODEL INDIRECT is not available for TYPE=RANDOM. MODEL: Variety BY Variety1 Variety2 Variety3; !(M) Expertis BY Chooser1 Chooser2 Chooser3; !(W) Inter NumCat_3 XWITH Expertis; !(X * W) Variety ON NumCat_3 (a1)!(M on X1) Expertis (a2) !(M on W) Inter (a3); !(M on XW) Satisf1 ON NumCat_3 (c) Variety (b1); !(Y on X, M) MODEL CONSTRAINT: PLOT(Indirect); LOOP(Expert,0,7,0.1); Indirect=(a1+a3*Expert)*b1;!(a1+a3W)b1 MODEL INDIRECT: NumCat_3 IND Satisf1 Do you have any suggestions? Thanks David 


You have to express the indirect effect in Model Constraint in this case. 


Dear Bengt, I'm afraid I don't understand what you mean. How would I modify my input? Please let me know, Thanks, David 


You would label the parameters involved in the indirect effect in the MODEL command and specify the indirect effect as a new parameter in MODEL CONSTRAINT. 


I believe I have done that it the input code provided earlier. What am I missing? 


Your input says: MODEL CONSTRAINT: PLOT(Indirect); LOOP(Expert,0,7,0.1); Indirect=(a1+a3*Expert)*b1;!(a1+a3W)b1 MODEL INDIRECT: NumCat_3 IND Satisf1 It should say: MODEL CONSTRAINT: PLOT(Indirect); LOOP(Expert,0,7,0.1); Indirect=(a1+a3*Expert)*b1;!(a1+a3W)b1 


Thank you for all of your help you have been very responsive and helpful. MPlus is awesome. I have the analysis I needed including the CI, plot and plot data. As well as being SEM rather than regression and modelling latent variables, with the LOOP, MPlus is superior to running Process regressions many times with transformed IV and Moderator values as suggested in Spiller et al. JMR 2013. As an enhancement I was hoping for pvalues over the range of values of the moderator in the loop plot. Also, it looks like there's no way to get bootstrap CI. Please confirm 1. With Latent moderators, I have to use XWITH 2. With XWITH, I must use Type=Random 3. With Type=Random, Bootstrap is currently unavailable. Thanks again for all of your help. 


Respected Prof. Muthen: The new 'model indirect' way of plotting causal effect is not providing any plot graphs. model indirect: p MOD np mc (.5 .5 .1) eomc eo; plot:type = plot2; p.s.: I have installed version 7.3. 


That should work  see slide 39 of my handout and video from the 2014 Psychometric Society short course. If this doesn't help, send input, output, data, and license number to support@statmodel.com. 


Dear Prof. Muthen. I have sent you an email. Thanks a lot ! 


Hello, When I run the input below I get the following error message: "A parameter label has been redeclared in MODEL CONSTRAINT. Problem with: IND". Do I need to provide another label for the plot command? Here is my input: MODEL: sse by smq12 smq21 smq24 smq28 smq29; pap by agq2 agq4 agq8; procp by passp1passp3; anx by smq4 smq6 smq13 smq14 smq18; procp on gpa gender; procp on anx (b); anx on sse pap (a); procp on pap; interact  sse xwith pap; anx on interact(c); sse pap anx; model constraint: new(ind wmodval); wmodval=.444;!+1SD sse ind=(a+c*wmodval)*b; plot(ind); loop(sse,.444,.444,0.01); Thank you, Eric 


Remove the IND parameter from the NEW statement and move the PLOT statement up before the assignment statement involving IND. model constraint: new(wmodval); wmodval=.444;!+1SD sse plot(ind); ind=(a+c*wmodval)*b; loop(sse,.444,.444,0.01); 

Nini Wu posted on Monday, August 20, 2018  12:35 am



Hi, Dr Muthen, I have the following questions regarding lms. Could you please give me some suggestions? I would like to test a latent moderated mediation modelW moderated the direct effect of X on Y and M to Y. And M is a latent variable, which is a mediator. I have the following questions, could you please give me some suggestions£¿ 1. Should all the variables including DV be standardized? 2. Below are the basic codes in mplus. I would like to see the indirect effects of M to Y at different levels of W (e.g., +1SD, 0, 1SD) and plot the region of significance. Are the codes right?(All the variables are assumed standardized) Define: int1=x*w; M by m1,m2,m3; M on X(a1); Y on M(b1); Y on X(d); Y on W; Y on int1; INT2  M xwith W; Y on int2(b2); Model constraint: New(modhigh modlow modmean indhigh indmean indlow); modhigh=+1; modmean=0; modlow=1; indhigh=a1*b1+a1*b2*high; indmean=a1*b1+a1*b2*mean; indlow=a1*b1+a1*b2*low; plot(indirect); loop(modval,3,3,0.2); indirect=a1*b1+a1*b2*modval; 3. How to write the mplus code about the effects of M to Y at different levels of W(e.g., +1SD, 0, 1SD) and the plot? Thank you very much and look forward to your reply. 


You are missing some terms. You want to include and label M ON int1; Y ON int1; The indirect and direct effects in this case are given in our RMA book, Section 4.5.3, starting on page 206. See also pages 9194. 

Nini Wu posted on Tuesday, August 21, 2018  7:59 pm



Thank you so much for the valuable feedback. I am sorry that I don't have your RMA book now. Would you mind letting me know if the ecopy of the book is available? If not, could you please give me an example of the mplus codes for the third questions in my previous post? Thanks a lot£¡ 


Q1: No Q2: I'm afraid the expression is too long for me to check and type in right now. You can find it also in Hayes' book and perhaps in Preacher's articles. 


Hi  I am modeling a 3way interaction using XWITH. This model includes 3 latent variables and 1 manifest variable. My manifest variable is made up of participant scores (due to the instrument being proprietary, I could not have access to individual items, and only have access to total scores). When modeling my manifest variable, I am modeling it like a latent factor with a single indicator, and am setting the error variance. 1. Is this the correct way to model the manifest variable? 2. If not, what is the correct way? 


To clarify, my IV is the manifest variable, and my moderators and DV are latent variables. 


Don't put a factor behind a single indicator unless you know its reliability. 


Hi, Please describe how to model a latent moderator variable which has two correlated factors? I am implementing the procedure of Sardeshmukh and Vandenberg 2017 ORM (model a: first stage moderation) for testing a moderated mediation model. Thanks. 


When you say that you have "a latent moderator variable which has two correlated factors"  do you mean that you have 2 moderator variables? 


It is a single construct (narcissism) with two correlated factors (admiration and rivalry); see Back, Kufner, Dufner et al. 2014, Journal of Personality and Social Psychology. 


So do you have 2 moderator variables (admiration and rivalry)? Or, is narcissism a secondorder factor with admiration and rivalry as firstorder indicators and you want to use the single variable narcissism to be the moderator? 


I have one moderator variable (narcissism). The relevant literature quoted earlier does not define narcissism as a secondorder factor, but as consisting of two correlated factors (of admiration and rivalry). Being new to SEM, I am not sure if I can create a secondorder variable, if it is not conceptually proposed. It appears I may have three options: a) artifically create a secondorder factor, b) collapse the two correlated factors into a single factor, or c) treat the single moderator variable as two variables. Please advise and, if possible, suggest relevant examples. 


I would recommend using both the admiration factor and the rivalry factor as moderators at the same time. For instance, if what you moderate is the influence of X on Y, you can write Model: y on x; admin by ...; rival by ...; xadmin  x xwith admin; xrival  x xwith rival; y on admin rival xadmin xrival; 

Ahmad posted on Friday, February 01, 2019  9:58 am



Hi, in implementing the LMS technique (TYPE = RANDOM; ALGORITHM = INTEGRATION) I am receiving warning: "THE LATENT VARIABLE COVARIANCE MATRIX (PSI) IS NOT POSITIVE DEFINITE....CHECK THE TECH4 OUTPUT FOR MORE INFORMATION." However, specifying TECH4 as OUTPUT generates fatal error message that TECH4 is not available with LMS. Please advise. 


It is available only for models that can be written as on the bottom of page 10 in http://statmodel2.com/download/LVinteractions.pdf In most cases just checking the correlations between the latent variables would be enough  but it will have to be done by hand or by presetting the scale so the factor variance is 1. 

Ahmad posted on Thursday, June 20, 2019  10:03 pm



Hi Prof. Muthen I am following Sardeshmukh & Vandenberg 2017 ORM procedure for a mediation model with two moderators. The problem is that the basic model runs fine with 1000 bootstraps with the initial model terminating at 76th iteration and bootsrapping draws taking lesser number of iterations but finishing properly. Howevever, when additional parameters are calculated through MODEL CONSTRAINT command, then the bootstrapping gets into infinite calculation loop/iterations, despite repeated attempts to run the model. For example, the initial model calucluated last time took 90 iterations to complete but in bootstrapping it got stuck and in one draw (most likely after 10th drawbut I could not determine its exact number as scrolling up was not possible above 7500th iteration. In earlier attempts it was typically 12th draw where I terminated calculations around 1000th iteration.) the iterations continued beyond 10,000 calculation without conclusion. Please advise how to address this issue. I am sending the model in next post. Thanks and regards. 

Ahmad posted on Thursday, June 20, 2019  10:11 pm



The model is: ANALYSIS: TYPE=RANDOM; ALGORITHM=INTEGRATION; MCONVERGENCE=0.01; MITERATIONS=100000; PROCESSORS=4; ESTIMATOR=ML; BOOTSTRAP=500; MODEL: ind by x1x8; mod1 by w1w4; mod2a by z1z3; mod2b by z4z6; mod2c by z7z9; mod2 by mod2a mod2b mod2c; medt0 by mcrd01mcrd05; medt1 by mcrd1mcrd5; dept0 by y01y05; dept1 by y1y5; inter1ind XWITH mod1; inter2ind XWITH mod2; medt1 ON medt0 ind mod1 mod2 inter1 inter2 (am ax az aw axw axz); dept1 ON dept0 ind medt1 (dx bx bm); [ind] (Xmean); ind (Xvar); [mod1] (Wmean); mod1 (Wvar); [mod2] (Zmean); mod2 (Zvar); MODEL CONSTRAINT: NEW (a0 Wsd Wlo Whi Zsd Zlo Zhi Xsd Xlo Xhi Wlo1st Whi1st WloInd WhiInd Zlo1st Zhi1st ZloInd ZhiInd); a0=1; Wsd=SQRT(Wvar); Wlo=WmeanWsd; Whi=Wmean+Wsd; Zsd=SQRT(Zvar); Zlo=ZmeanZsd; Zhi=Zmean+zsd; Xsd=SQRT(Xvar); Xlo=1; Xhi=7; !moderation of W on M Wlo1st=(ax+(axw*Wlo)); Whi1st=(ax+(axw*Whi)); !mediation of W on Y WloInd=Wlo1st*bm; WhiInd=Whi1st*bm; !moderation of Z on M Zlo1st=(ax+(axz*Zlo)); Zhi1st=(ax+(axz*Zhi)); !mediation of Z on Y ZloInd=Zlo1st*bm; ZhiInd=Zhi1st*bm; 


Please send your output and data to Support along with your license number. We ask that postings be limited to one window  otherwise send to Support. 

Back to top 