Hi, I have a related question to the above discussion. I am running a twolevel random model with random intercepts and slopes. I wish to plot the cross over interaction but I get an error message: ' Error in parsing line:"LOOP (MOD,-1,1,0.1)"'
Here is the full syntax: Missing are all (-99); BETWEEN = gmx; WITHIN = gmw; CLUSTER = Id; ANALYSIS: TYPE = TWOLEVEL RANDOM; MODEL: %WITHIN% s | sqy ON gmw; %BETWEEN% sqy ON gmx; [s] (a); s ON gmx (b); sqy WITH s; MODEL CONSTRAINT PLOT(crosslv1); LOOP (mod, -1,1,0.1); crosslv1 = a+b*mod; PLOT: TYPE = PLOT2; OUTPUT: TECH8 TECH4 SAMPSTAT;
I cannot figure out what am I doing wrong. Thanks a lot in advance!
Professor Muthen, thank you so much for the quick response! It was a very sloppy mistake on my side.
Stefan Kamin posted on Wednesday, October 25, 2017 - 9:02 am
I would like to plot an interaction between X and M within the level 1 equation. The model has one covariate at level 1 (cov1) and another one at level 2 (cov2). In addition, I am interested in the simple slopes at different values of M (0/1). I adapted the example from UG ex 3.18 and would like to know whether my syntax is accurate:
%WITHIN% s_x | y on x; s_m | y on m; s_xm | y on xm; s_cov1 | y on cov1;
%BETWEEN% [y] (b0); [s_x] (b1); [s_m] (b2); [s_xm] (b3); y on cov2; y with s_x s_m s_xm;
You can just play with the regression equations for your model:
y = a_j + b1*x + b2*w + b3_j*w + error
a_j = a + g1*z + error
b3_j = b + g2*z + error
Here a_j is your random intercept which appears as Y on Between and b3_j is your random slope s in the regression of y on the xw interaction. Plugging the last 2 equations into the first, you have
y = a + g1*z + b1*x + b2*w + (b + g2*z)*xw + error terms,
where the terms involving x can be summarized as
[b1 + (b + g2*z)*w]*x.
That would be the simple slope that can be evaluated as a function of x for different combinations of values of z and w - but you better check that I did the algebra right. This can be done like the plot of ex 9.2b where you just have a different simple slope formula as given above and you have not only 2 expressions you want to plot but perhaps 4 (low/high z combined with low/high w).
that is exactly what I was looking for, thank you very much!
Silvia posted on Tuesday, October 30, 2018 - 6:12 am
Dear Prof. Muthen,
as in the previous post, I need to estimate the simple slopes for a three way interaction between x, w (both level 1) and z (level 2). I would like to know whether my syntax is accurate in labeling the terms for the simple slope formula you suggested ([b1 + (b + g2*z)*w]*x).