BookmarkSubscribeRSS Feed
varatt90
Obsidian | Level 7

Hi all, 

 

If I have a PROC GENMOD procedure with a nominal predictor variable, can I specify that I want to compare one group with multiple reference groups?

 

For example: Let's say I have the predictor variable gender: boy, girl, other. 

 

Right now, I have girl as my reference group. So, in the model, I'll get an LogOR comparing boy vs. girl and other vs. girl. 

 

In the same model, am I able to have "boy" as a reference group as well? So I would like to see:

- other vs. girl

- boy vs. girl 

- other vs. boy

 

PROC GENMOD DATA = Dataset;
CLASS SchoolID Gender (REF = "girl") ;
MODEL Outcome = Age gender / DIST=Binomial LINK=Logit ALPHA=0.05 TYPE3 ;
REPEATED SUBJECT = SCHOOLID / TYPE = EXCH;
RUN;

Thank you!

3 REPLIES 3
sbxkoenk
SAS Super FREQ

Check if this is giving you what you want :

data drug;
   input drug$ x r n @@;
   datalines;
A  .1   1  10   A  .23  2  12   A  .67  1   9
B  .2   3  13   B  .3   4  15   B  .45  5  16   B  .78  5  13
C  .04  0  10   C  .15  0  11   C  .56  1  12   C  .7   2  12
D  .34  5  10   D  .6   5   9   D  .7   8  10
E  .2  12  20   E  .34 15  20   E  .56 13  15   E  .8  17  20
;
run;

proc genmod data=drug;
   class drug;
   model r/n = x drug / dist = bin
                        link = logit
                        lrci;
 lsmeans drug / DIFF MEANS ADJUST=BON 
                oddsratio CL EXP ;
run;
/* end of program */

Koen

varatt90
Obsidian | Level 7

Hi Koen, 

 

Yes, this is what I'm looking for! 

 

Also, additional questions:

1) Is the "Differences of drug least squares means" table showing the odds of using drug A vs. Drug B?

2) Using your previous example, I added another categorical variable with response options as Yes or No and an interaction term.

 

data drug;
   input drug$ x r n catvar$ @@;
   datalines;
A  .1   1  10 Yes  A  .23  2  12 No  A  .67  1   9 Yes
B  .2   3  13 Yes  B  .3   4  15 Yes B  .45  5  16 No  B  .78  5  13 Yes
C  .04  0  10 Yes  C  .15  0  11 No  C  .56  1  12 Yes C  .7   2  12 No
D  .34  5  10 Yes  D  .6   5   9 Yes D  .7   8  10 No
E  .2  12  20 Yes  E  .34 15  20 No  E  .56 13  15 No  E  .8  17  20 No
;
run;

proc genmod data=drug;
   class drug catvar;
   model r/n = x drug catvar drug*catvar/ dist = bin link = logit lrci;
 lsmeans drug*catvar / DIFF MEANS ADJUST=BON 
                oddsratio CL EXP ;
run;
/* end of program */

For this output: I see the interaction effects of using Drug A (vs. Drug E) * Yes (vs. No). Is that correct?

Screen Shot 2022-07-06 at 4.31.04 PM.pngScreen Shot 2022-07-06 at 4.25.06 PM.png

 

As you can see, the estimates highlighted in purple box do not match. I was wondering why that is. When I compared the values in your previous example (without interaction) the values match. Please see output below.  

Screen Shot 2022-07-06 at 4.35.24 PM.pngScreen Shot 2022-07-06 at 4.35.30 PM.png

 Thanks!

 

sbxkoenk
SAS Super FREQ

Hello,

 

Will answer that tomorrow.

 

Start with having a look here (see also the links to other material in this topic) :

 

Interpretation of interaction between categorical factors in logistic regression 1
Posted 11-05-2017 09:30 PM (3540 views)
https://communities.sas.com/t5/Statistical-Procedures/Interpretation-of-interaction-between-categori...

 

Koen