BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mthorne
Obsidian | Level 7

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?  

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
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.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
mthorne
Obsidian | Level 7

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.

PaigeMiller
Diamond | Level 26
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.

--
Paige Miller
mthorne
Obsidian | Level 7

Great, thanks Paige!

 

Mark

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

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.

Discussion stats
  • 4 replies
  • 710 views
  • 0 likes
  • 2 in conversation