Message/Author 


Dear Sir or Madam, I am very sorry to bother you with my stupidity: Despite consulting the user guide, handouts and older forum entries, I still do not understand how to specify a threeway interaction. I would be extremely grateful for help! I conducted a diary study and thus have variables measured on person level (L2) as well as variables measured day level (L1). Basically I am interested in testing crosslevel and threeway interactions: (a) A chronic stressor W (measured on L2) should moderate the relationship between a daily stressor X (measured on L1) and a strain variable Y (measured on L1). (b) The hypothesized moderation effect from the L2predictor W on the L1relationship of X and Y should be moderated by the daily sleep quality Q (measured on L1). I fear that my syntax is completely idiotic (again, I am so sorry!): variable: names = case_nr Y X W; cluster = case_nr; between = W; within = Y X Q; centering = grandmean (W); centering = groupmean (X Q); analysis: %within% Y on X; Beta1  Y on X; Beta2  Beta1 on W; Q on Beta 2; ! threeway interaction %between% Beta1 on W; ! crosslevel interaction Y with Beta1; ! interceptslope covariance on L2 


You should not have Beta2  Beta1 on W; on Within because W is a Between variable. You should use Define to create the XQ Within variable and say on Within: beta2  y On xq; Then on Between you regress beta2 on W. 


Dear Prof. Muthén, thank you very, very much for your great (and very fast) advice!! :) Then I could also add "Y with Beta2" to get the covariance between the slopes of the regression from beta2 on W and the intercept, correct? (Btw, I am very sorry for my stupid mistake: I meant of course "analysis: type = twolevel random" and then "model: %within%..." etc.). Many thanks and best regards, Kerstin Mertz P.s. I also beg your pardon for my poor English (alas, it is not my first language). 


Dear Prof. Muthén, please forgive me for bothering you again: I would be tremendously grateful if you would be so kind to answer a followup question! It seems to me that in my new syntax W would now be the moderator of the moderator effect from Q on the daily relationship between X and Y  instead of Q being the moderator of the interaction between W and X, like hypothesized. Of course I know that twoway interactions are symmetrical and therefore from a statistical standpoint it is equally appropriate to label either variable as the moderator in the relationship. But is this also the case for threeway interactions? Thank you very much for your advice! For completeness sake, my new syntax would be: variable: names = case_nr Y X Q W; usevar = case_nr Y X Q W XQ; cluster = case_nr; between = W; within = Y X Q XQ; centering = grandmean (W); centering = groupmean (X Q); analysis: type = twolevel random; model: %within% Y on X; Beta1  Y on X; Beta2  Y on XQ; %between% Beta1 on W; !crosslevel interaction Beta2 on W; !threeway interaction Y with Beta1; Y with Beta2; Define: XQ = Beta1 on Q; !twoway interaction between X and Q 


I think this is the way to go unless you want to try to interact the betweenlevel part of Q with W and let that interaction influence Beta1. Note that this is not an accepted DEFINE statement: Define: XQ = Beta1 on Q; I think you want Define: XQ = X*Q; 


Dear Prof. Muthén, thank you very much for your great advice! I didn´t know that one could specify an interaction in Define in such a simple and convenient way :) . Because I am interested in the daily variation of Q as a influence on the moderator effect of W, I think I will go with your first suggestion and regress Beta2 on W. Again, thank you so much! Have a nice day! Kerstin Mertz 


Dear Prof. Muthen, If I may ask a question in relation to a three way interaction but this time adding a mediator measured at level 1. So, in a nutshell, I have the predictor (x), the mediator (m), one of the moderators (v), and the criterion (y) measured at level 1. I also have a moderator (Q) measured at level 2 that based on theory should moderate the interaction between v and m in predicting y. (The level 1 moderator, v, moderates the b path between the mediator and the criterion). I am not sure how to model the full model. Is the partial setup below correct or am I missing something very obvious? Thank you so much in advance! Warm regards, Laura between=q; within=m v x mv; define mv=m*v; qm=q*m; qs=q*s; analysis: type= twolevel random; model: %within% y ON x(cp); m ON x (a); y ON m (b1w) v(b2w); s y ON mv; %between% y ON q(b3b) s(b4b) qm(b5b) qs(b6b); s ON q (b7b); Model constraint: NEW (ind); ind=a*(b1w+b4b(1)+b5b*(0.72)+b7b*(01)*(0.72)); 


Apart from your "ind" expression which I don't have time to check your input looks fine  although I don't see why you would say Y ON s... instead of simply y WITH s; 


Dear Prof. Muthen, Thank you so much for taking the time to look at my model. I seemed to have made a notation error in the model. Instead of S in the define command, it should have been V. Also, given that it is a three way interaction (m*v*q), I thought I do need to have Y ON S. And thus add Y WITH S perhaps? For the indirect part, I followed the indirect effect formula from Prof. Hayes' templates in SPSS PROCESS (model 18) and adapted it to my model. So, I think the correct syntax should then be this, if I am not mistaken. I am adding here for learning purposes. between=q; within=m v x mv; define mv=m*v; qm=q*m; qs=q*s; > this should have been qv=q*v; analysis: type= twolevel random; model: %within% y ON x(cp); m ON x (a); y ON m (b1w) v(b2w); > here it should be y ON v (b2w); s y ON mv; %between% y ON q(b3b); s(b4b); qm(b5b); > this should be: y ON qm (b5b) qs(b6b); > qs should be qv and it should be: y ON qv (b6b) s ON q (b7b); s WITH y; > I added this now. Model constraint: NEW (ind); ind=a*(b1w+b4b(1)+b5b*(0.72)+b7b*(01)*(0.72)); 


Please send your corrected output to Support along with your license number. 


Dear Prof Muthén, My research examines the influence of teaching practices (X1, X2, X3) on students’ autonomy (Y) in a twolevel analysis, and whether theses associations are moderated by two within moderators (M1, M2). Here is my syntax for 3 threeway crosslevel interactions, including control variables (C1, C2): CLUSTER = Number; WITHIN = C1 C2 M1 M2 int; BETWEEN = C1ag C2ag M1ag M2ag X1 X2 X3; DEFINE: int=M1* M2; ANALYSIS: Type = twolevel random; MODEL: %WITHIN% Y on C1 C2; s1  Y on M1; s2  Y on M2; s3  Y on int; %BETWEEN% Y on C1ag C2ag M1ag M2ag X1 X2 X3; s1 s2 s3 on X1 X2 X3; Y with s1 s2 s3; QUESTIONS: 1) I have added relationships in comparison with previous posts, are those useful? (e.g. s2  Y on M2;) 2) Following advices from Enders & Tofighi (2007), all within variables have been previously groupmean centered, and their aggregated means per group have been added on the between level (all ‘ag’ variables). Between variables have been grandmean centered. Is this method right and is it the right way to reintroduce the means? 3) Can crosslevel interactions be calculated instead by defining, for ex., int=X1*M1*M2, and introducing this term on the within level? Is there any mathematical difference between this method and the one in my syntax? Thank you very much! 


1) Often, random slopes are not significant but it is alright to explore that. 2) I leave that to others to comment on; perhaps ask on Multilevelnet. 3) interactions created by Define don't have the extra terms introduced by the residual in the s ON regression on Between so there is a difference in the modeling. 


Dear Prof Muthén, My data contains daily observations from 71 people over 15 days. My study aims to examine a crosslevel threeway interaction mediated model. The Independent variable(X), Mediator(M) and Dependent variable(Y) are all on level1 (daylevel). W1 (level1) moderates the relationship between X and M, meanwhile this moderation effect is further moderated by W2 (level2, personlevel). All variables except W2(gender) are continuous variables. After reviewing all the above conversations, I came out with the following syntax (attached at the end). However, after running the syntax, the output said, “*** FATAL ERROR. THIS MODEL CAN BE DONE ONLY WITH MONTECARLO INTEGRATION.” I also tried to add “INTEGRATION = MONTECARLO; ALGORITHM=INTEGRATION” in the “Analysis” command, the model runs but cannot estimates standard errors of the coefficients. Your instruction on how to figure out this issue will be highly appreciated! Thanks a lot! 


Syntax: WITHIN = X W1 XW1 Control_level1 ; BETWEEN = W2 Control_level2; DEFINE: XW1=X*W1 Center X W1 Control_level1 (Groupmean); Analysis: Type = TWOLEVEL RANDOM; MODEL: %WITHIN% s1  M on X; s2  M on XW1; M on W1 Control_level1; Y on M (b); Y on X W1 XW1 Control_level1; X W1 with XW1; X with W1; %BETWEEN% s1 ON W2 (a1); s2 ON W2 (a2); [s1](a10); [s2](a20); M ON W2 Control_level2; Y ON W2 Control_level2; M with s1 s2; Model constraint: New(sd_w ind1 ind_high1 ind_low1 diff1); sd_w=0.50034; ! W2’s standard error ind1=a10*b; ind_high1=a10*b+a1*sd_w; ind_low1=a10*b+a1*sd_w; diff1=ind_high1ind_low1; New(ind2 ind_high2 ind_low2 diff2); ind2=a20*b; ind_high2=a20*b+a2*sd_w; ind_low2=a20*b+a2*sd_w; diff2=ind_high2ind_low2; Output: sampstat; Looking forward to your kind reply! Many thanks. 


Please send your full output to Support along with your license number. We request keeping posting to one window so for these longer messages, sending to Support is better. 

Back to top 