BookmarkSubscribeRSS Feed
amcr729
Fluorite | Level 6

Hello, 

I am looking at associations between several explanatory variables and a binary outcome (called "vs"). In order to obtain prevalence ratio estimates, I am using robust poisson regression (PROC GENMOD). I want to test interactions between some explanatory variables but I cannot figure out how to do so beyond examining the significance of interaction terms included in the model (e.g. X1*X2). If X1*X2 is significant, I do not know how to go on to probe the interaction, e.g. examine the relationship between X1 and Y at different levels of X2 (i.e. the direction and strength of the relationship between X1 and Y at different levels of X2). I think I know how to do this in other types of models, such as logistic, where one uses the ODDSRATIO command to produce ORs reflecting the relationship between X1 and Y at different levels of X2, but can't figure it out in proc genmod. If someone has an idea about code for this it would be greatly appreciated! Below is my code for the main effects model. I want to probe the interaction term "homeless*pills" in a subsequent model with interaction effects.


proc genmod data=siya2 descending;
class pid support (ref="1") bl_partner (ref="3") /param=ref;
model vs = pills /*continuous*/
educ /*categorical*/
bl_partner /*categorical*/
homeless /* categorical (1/0) */
support /*categorical*/
 /Dist=poisson Link=log;
Repeated subject = pid / type=Ind;
title 'VS on Pills - robust POISSON';
run;

7 REPLIES 7
StatDave
SAS Super FREQ

You can use the SLICE statement in GENMOD (and most other modeling procedures) to do comparisons of levels of one variable in an interaction at specific levels of the interacting variable. See this note for an example.

amcr729
Fluorite | Level 6

Many thanks. However, SLICE and the other commands provided at that link appear to only work for categorical explanatory variables, although I may be missing something. When I run the below code, I get an error message for the SLICE statement saying "Only CLASS variables allowed in this effect"-- presumably referring to the "pills" variable, although "pills" is not categorical. Thanks for any further guidance!

 

proc genmod data=siya2 descending;

class pid support (ref="1") bl_partner (ref="3") phq9_cat (ref="0")

bl_alcohol_freq (ref="0") bl_whoqol12 (ref="1") bl_whoqol16 (ref="1") educ (ref="0") /param=ref;

model vs=

pills /*continuous*/

educ

agyw

bl_partner

homeless /*dichotomous*/

venue

bl_pimp

anyviol

bl_whoqol12

bl_whoqol16

bl_alcohol_freq

druguse_mj

support

phq9_cat

pills*homeless/Dist=poisson Link=log;

Repeatedsubject = pid / type=Ind;

slice pills*homeless / sliceby(pills='homeless') diff oddsratio;

title 'VS on pills shared (last 30 days) robust poisson';

  run;

 

StatDave
SAS Super FREQ

See the discussion in this note regarding estimating the effect of a continuous variable involved in interaction, particularly the "Continuous-categorical interaction in a log-linked model" section.

Rick_SAS
SAS Super FREQ

I have a question: Why do you call this a "robust" Poisson regression?

amcr729
Fluorite | Level 6

Because I am using a robust error variance, which avoids an overly conservative CI, by using the repeated statement and the subject identifier. See here.

Rick_SAS
SAS Super FREQ

Interesting. Thanks.

 

I noticed you did not list EDUC and HOMELESS on the CLASS statement. Was that intentional?

amcr729
Fluorite | Level 6

Thanks for catching that educ and homeless were not included in class statement -- this was intentional for homeless (which is binary 1=event vs 0, so no need to put in class statement for proper comparisons to be made, in my understanding?) but not intentional for educ, which has >2 categories.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 7 replies
  • 707 views
  • 1 like
  • 3 in conversation