Help using Base SAS procedures

Proc Glimmix: Type III test and LSMeans do not agree

New Contributor
Posts: 2

Proc Glimmix: Type III test and LSMeans do not agree

I ran Proc Glimmix for a categorical fixed effect (4 levels of BMI categories).  My type III test for BMI is significant.  I also added LSMeans statement and computed CIs for odds ratios for comparing levels of BMI.  One of the CI's do not include 1 indicating statistical significance.

I was wondering what may be causing this discrepancy!

Any ideas?

My sas code:

proc glimmix data=combo_final noclprint;

class bmi_catn (ref="2") site_id_fan admit_id;

model defib_out (event="1") = bmi_catn energy bmi_catn*energy/es oddsratio cl dist=binary link=logit chisq;

random _residual_/subject=site_id_fan type=cs ;

lsmeans bmi_catn/e oddsratio cl  diff=control("2");

where bmi_catn ne . and prec_a ne .;


my SAS output is attached in a pdf file.

Respected Advisor
Posts: 3,018

Re: Proc Glimmix: Type III test and LSMeans do not agree

First, let me make a suggestion or two that would help the people who are trying to help you (in other words, making my life easier). If your question is about type III test for variable bmi_catn, then please refer to the variable in question as "bmi_catn" and not "BMI". Next, if your question is about type III test versus LSMeans and odds ratios, then limit the output to type III tests and LSMeans and odds ratios so we don't have to scroll through page after page of output unrelated to your question. Thanks!

Your type III test compares the different levels of bmi_catn to each other and decides that globally, there is a statistically significant difference with alpha = 0.05. Your least squares means and odds ratios are only comparing level 2 to the other levels, and not all levels to each other. Even if that were not the case, there can be a comparison where the odds ratio is not significant, but yet the Type III test is still significant, there is nothing contradictory about this.

Paige Miller
New Contributor
Posts: 2

Re: Proc Glimmix: Type III test and LSMeans do not agree

Posted in reply to PaigeMiller

Thank you for your reply and suggestions.

I understand that the type III test is comparing "globaly" the levels of BMI_catn with each other and a significant result there means that there is at least one pair of levels of bmi_catn are not equal.  I also understand that when I'm comparing the odds for levels of bmi_catn to level 2, that's not all the comparisons and one or more of these (in this case 3) comparisons can be non-significant.  But I have done pairwise comparisons for all 6 different levels and in this case none were significant.  And that's a contradiction.

I believe the difference is being caused by how SAS is parameterizing the model for type III test and for LS Means.  I think in the case of type III global test, SAS is comparing the levels of bmi_catn at energy = 0.  But for LS Means, sas is evaluating the levels of bmi_catn at the mean of energy.

by centering the variable energy, I got the two tests to agree: that is there are at least two levels of bmi_catn that have different odds for the outcome variable.

Posts: 58

Re: Proc Glimmix: Type III test and LSMeans do not agree

There is a good book by Westfall et. al. about multiple tests and comparisons that talks about this issue about global tests and post hoc comparisons Multiple Comparisons and Multiple Tests Using the SAS System: Peter Westfall, Yosef Hochberg, Dror R...

This apparent contradiction is often noted for higher order interaction tests. How you interpret this depends on your specific research question. If your primary hypothesis is to test for differences across levels of BMI categories then you may use the lsmeans results.

Valued Guide
Valued Guide
Posts: 684

Re: Proc Glimmix: Type III test and LSMeans do not agree

Posted in reply to pronabesh

Your apparent paradox is NOT related to the parameterization (the "other" factor is at its expected value, not 0, but this is not the point anyway). The global test is not just concerned with pairwise contrasts, but all possible contrasts. With 4 levels to a factor, there are all kinds of factors, such as 1 vs. the mean of 2, 3,4; 1&2 vs 3&4, etc., etc. You will not necessarily find the reason for the global significance by looking a sample of the possible contrasts.

Also note, all test results can be wrong. You can get  false positive or a false negative on any test.

Ask a Question
Discussion stats
  • 4 replies
  • 1 like
  • 4 in conversation