Dear SAS Communities,
I have a problem writing the estimate for my interaction term for Poisson model. Here's a simple summary of my data:
Outcome: Number of CT scans per person year
Predictors: 1) Exposure categories: A, B, C
2) Time (re-centered): 1, 2, 3, .... 60
When I test for interactions between exposure and time, they are significant (p < 0.001)
proc genmod data=mydata;
class exposure (ref='C') / param=ref;
model countCT = exposure time exposure*time / dist=poisson link=log offset=logpersonyear;
run;
My problem is writing the estimates because I need to report RR in my tables. With the time interaction term, I need to report my RR at different time 1, 2, ...60. I read from other posts, I need to have all 3 predictors in my estimate statement....
proc genmod data=mydata;
class exposure (ref='C') / param=ref;
model countCT = exposure time exposure*time / dist=poisson link=log offset=logpersonyear;
estimate 'A vs C at time 1' exposure 1 0 time [?] exposure*time [?]
estimate 'B vs C at time 1' exposure 0 1 time [?] exposure*time [?]
[all other time in between....]
estimate 'A vs C at time 60' exposure 1 0 time [?] exposure*time [?]
estimate 'B vs C at time 60' exposure 0 1 time [?] exposure*time [?]
run;
I'm not sure how to fill up the [?] in the estimate statement. How do we calculate [exposure*time]?
Your help if very much appreciated. Thank you.
It is always best to avoid using ESTIMATE or CONTRAST statements to make simple comparisons when possible. Instead, use the LSMEANS or SLICE statements which do not require you to determine the proper linear combination of model parameters - a very error-prone task. In this model with interaction, the SLICE statement is what you need to make EXPOSURE comparisons at each time. There are several examples in this note which shows using both the SLICE and CONTRAST or ESTIMATE statements but strongly encourages the use of SLICE or LSMEANS. You will also want to use the EXP option in SLICE so that the differences are exponentiated to be rate ratios.
See also this note on estimating rates and rate ratios.
So, found a solution with some help from another post..
proc genmod data=mydata;
class exposure (ref='C') / param=ref;
model countCT = exposure time exposure*time / dist=poisson link=log offset=logpersonyear;
estimate 'A at time 1' int 1 exposure 1 0 time 1 exposure*time 1 0
estimate 'C at time 1' int 1 exposure 0 0 time 1 exposure*time 0 0
/* Substract one from the other to get change in Y for A vs C */
estimate 'A vs C at time 1' exposure 1 0 time 0 exposure*time 1 0
/* Same for B vs C */
estimate 'B vs C at time 1' exposure 0 1 time 0 exposure*time 1 0
/* At time 60 */
estimate 'A vs C at time 60' exposure 1 0 time 0 exposure*time 60 0
estimate 'B vs C at time 60' exposure 0 1 time 0 exposure*time 0 60
run;
This is it!
It is always best to avoid using ESTIMATE or CONTRAST statements to make simple comparisons when possible. Instead, use the LSMEANS or SLICE statements which do not require you to determine the proper linear combination of model parameters - a very error-prone task. In this model with interaction, the SLICE statement is what you need to make EXPOSURE comparisons at each time. There are several examples in this note which shows using both the SLICE and CONTRAST or ESTIMATE statements but strongly encourages the use of SLICE or LSMEANS. You will also want to use the EXP option in SLICE so that the differences are exponentiated to be rate ratios.
See also this note on estimating rates and rate ratios.
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!
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.