hello all,
I have the following model
Yes, you could use the CONTRAST or LSMESTIMATE statement to make that particular comparison. The LSMESTIMATE statement is easier since you don't have to determine the correct contrast coefficients. But the interaction is really the "difference in difference" (DID) as discussed in this note. This code does both:
proc mixed;
class a b;
model y=a|b;
lsmeans a*b;
lsmestimate a*b 'avg1,2,3 v 4' 1 1 1 -3 /e;
lsmestimate a*b 'did' 1 -1 -1 1 /e;
run;
As for question 2, it might help to use GLM to see the sums of squares. The E options in the LSMESTIMATE statements above show the coefficients of the contrasts defined by the statements. You could use those coefficients in a CONTRAST statement. That is done below in GLM to show the sums of squares of the DID contrast, which is the same as the interaction, and of your contrast.
proc glm;
class a b;
model y=a|b;
lsmeans a*b;
contrast 'avg1,2,3 v 4' a 2 -2 b 2 -2 a*b 1 1 1 -3 /e;
contrast 'did' a*b 1 -1 -1 1 /e;
run;
Yes, you could use the CONTRAST or LSMESTIMATE statement to make that particular comparison. The LSMESTIMATE statement is easier since you don't have to determine the correct contrast coefficients. But the interaction is really the "difference in difference" (DID) as discussed in this note. This code does both:
proc mixed;
class a b;
model y=a|b;
lsmeans a*b;
lsmestimate a*b 'avg1,2,3 v 4' 1 1 1 -3 /e;
lsmestimate a*b 'did' 1 -1 -1 1 /e;
run;
As for question 2, it might help to use GLM to see the sums of squares. The E options in the LSMESTIMATE statements above show the coefficients of the contrasts defined by the statements. You could use those coefficients in a CONTRAST statement. That is done below in GLM to show the sums of squares of the DID contrast, which is the same as the interaction, and of your contrast.
proc glm;
class a b;
model y=a|b;
lsmeans a*b;
contrast 'avg1,2,3 v 4' a 2 -2 b 2 -2 a*b 1 1 1 -3 /e;
contrast 'did' a*b 1 -1 -1 1 /e;
run;
Thank you Dave!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.