Zahi B posted on Monday, December 10, 2012 - 8:47 am
I am attempting to test a mediation model: tl (level 2)-> ap (level 1)-> ca ma (level 1)-> cr (level 2)
the model also include tc (level 1) which moderates the relationship between tl & ap.
I scanned the threads, and attempted various suggestions in order to incorporate the moderation effect (I use the commands XWITH and DEFINE but nothing seems to work).
I would love to hear any suggestions.
TITLE: moderated mediation model DATA: FILE IS c:/mydata6.csv; VARIABLE: NAMES ARE group tl tc ap ca ma cr; MISSING ARE ALL (-999); USEVARIABLES ARE group tl tc ap ca ma cr; BETWEEN ARE tl cr; CLUSTER IS group; CENTERING = GRANDMEAN (tc ap ca ma); ANALYSIS: TYPE IS TWOLEVEL RANDOM; MODEL: %WITHIN% ca ON ap(s1); ma ON ap(s2); %BETWEEN% tl cr; ca ON tl(b1); ma ON tl(b2); ap ON tl(b3); cr ON ca (b4); cr ON ma (b5); cr ON ap (b6); cr ON tl (b7); MODEL CONSTRAINT: NEW(abw1 abw2 abw3 abw4); abw1 = b3*s1; abw2 = b3*s2; abw3 = s1*b4; abw4 = s2*b5; OUTPUT: TECH1 TECH8 CINTERVAL;
You say that you want tc (level 1) to moderate the relationship
tl (level 2)-> ap (level 1)
The meaning of that relationship must be that tl influences the level-2 part of ap (which in turn influences the observed ap score). Therefore moderation must be a level-2 matter and if tc moderates this, it must be the level-2 part of tc that does the moderation. I don't know if this is in line with your thinking. If it is, read on.
So on level 2 (between) you have an observed tl predictor of a latent (between-part of) ap DV where you have an interaction (due to moderation) between tl and the latent (between-part of) tc. So a latent tc interacting with an observed tl. This calls for XWITH, but I am not sure if you can directly use the latent tc or have to first represent it as a factor.
Zahi B posted on Tuesday, December 11, 2012 - 11:33 pm
Thank you for kind replay. What you described is exactly what I had in mind.
I adopted your suggestion to apply the XWITH command in the %BETWEEN% section (interaction | tl XWITH tc) but the program produced an error message. So instead I used the DEFINE command, the code is attached below.
USEVARIABLES ARE group tl tc ap interact; BETWEEN ARE tl; CLUSTER IS group; CENTERING = GRANDMEAN (tc ap); DEFINE: interact = tl*tc; ANALYSIS: TYPE IS TWOLEVEL RANDOM;
I am having difficulty creating an interaction term for a moderation. I have a two level indirect model and would like to test for a moderating variable at the within level. This is my syntax:
USEVARIABLES ARE ID PVs PPs Zvig Cs Vgs Te Os Ss;
WITHIN ARE Cs Zvig Ss; Between are Vgs Te Os;
CLUSTER IS ID;
DEFINE: CENTER Cs Zvig (GROUPMEAN); !group-mean center predictor variables CsxSs | Cs XWITH Ss; !interaction term
ANALYSIS: TYPE IS TWOLEVEL; MODEL: %WITHIN% PVs on Zvig; PPs on Zvig; PVs; PPs; !add controls %BETWEEN% PVs on Vgs; PPs on Vgs; PVs on Te; PPs on Te; PVs on Os; PPs on Os; PVs PPs; Vgs Te Os;
MODEL INDIRECT: PVs IND Zvig Cs; PPs IND Zvig Cs;
ANALYSIS: TYPE=RANDOM; ALGORITHM=INTEGRATION;
MODEL: !add moderator Zvig on Cs Ss CsxSs;
I got an error message saying that I needed to add ALGORITHM=INTEGRATION, so I did. I was getting back an error stating that to declare interaction, TYPE=RANDOM must be specified. So I did that, and now the error message is about how the interaction term is defined, but no suggestions for fixing.
XWITH is not used in the DEFINE command. It is used in the MODEL command. It appears that cs and ss are observed variables so XWITH should not be used. It is for latent variable interactions. You can create the interaction as follows:
They can't be latent variables if they are on the USEVARIABLES list. Latent variables are created using the BY option in the MODEL command. If you mean they are factor scores, these are treated as observed variables.
Although X is level 2, W is level 1 so if you create their product you get a variable that varies not only across clusters but also within clusters, so you can't declare it as Between. Instead, use a cross-level approach with a random slope for X->M:
MODEL: %WITHIN% s | M on W1; Y on M W1;
%BETWEEN% s ON Xclus; M ON Xclus W2; Y ON Xclus W2;
where w1 is defined (in Define) as a group-centered version of w and w2 is the cluster-mean version of w. This implies that the random slope s brings in a product of Xclus and W1 in the influence of W on M.
Nathan posted on Tuesday, March 07, 2017 - 9:10 pm
Fantastic. Thank you so much for your help - really appreciate it.