Hi,
I am using proc glimmix to analyze count data. I notice that the pvalues for a contrast between two simple effects are the same as the pvalues for lsmeans diff for the same simple effect. If I use the contrast comparison, do I report the actual means or the lsmeans?
contrast '0 vs 1' herb 1 -1 0;
contrast '0 vs 2' herb 1 0 -1;
contrast '1 vs 2' herb 0 1 -1;
There's no need to type all this out, the LSMEANS statement with the DIFF produces the same results.
Depending on how you did the contrast, it can indeed be the same as the LSMEANs difference. Not just the p-values should match, but the actual difference should match.
Again, depending on what you did, I would report the LSMEANs and their differences as a general rule, since I have seen only very rare situations where the contrast is actually needed. I would report Means instead of LSMEANS only if you have a completely balanced and orthogonal experiment, or you have the equivalent of a one-way ANOVA.
Thanks for the reply!
This is my model.
ods graphics on;
proc glimmix data=counts method=laplace nobound plot=studentpanel; by loc time;
class loc time herb rep;
tc2=log(c2+1);
model tc2 = herb / dist=normal link=identity;
random intercept / subject=rep;
lsmeans herb / ilink diff;
contrast '0 vs 1' herb 1 -1 0;
contrast '0 vs 2' herb 1 0 -1;
contrast '1 vs 2' herb 0 1 -1;
*output out=allresid pred=p resid=student;
run; quit;
ods graphics off;
The design is a balanced factorial with no missing data. Three locations, four application times, three herbicide treatments, and four replicate blocks at each location. Glimmix couldn't handle all zeros from some treatments, so I had to transform and compare to a normal distribution.
contrast '0 vs 1' herb 1 -1 0;
contrast '0 vs 2' herb 1 0 -1;
contrast '1 vs 2' herb 0 1 -1;
There's no need to type all this out, the LSMEANS statement with the DIFF produces the same results.
Great, thanks Paige!
Mark
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.