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

oddsratio age/at (ftv=all);

units age=10;

 

Can you get this same type of result in genmod with an estimate statement?

I need it for an incidence ratio instead of an odds ratio.

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

For a continuous variable like Age, you would have to use the ESTIMATE statement. The trick with figuring out the coefficients to use in the ESTIMATE (or CONTRAST) statement is always to write what you want in terms of the model you have specified. Since you are using the AT option, I assume that your model has Age interacting with a categorical variable (FTV). So, assuming that your logistic model in GENMOD is 

 

class ftv;

model y=age ftv age*ftv    ... ;

 

and you want to estimate the change in odds for a 10 unit change in Age at each level of FTV, then let's start with the above model and doing the estimation at the first FTV level.  An odds ratio is a difference in log odds and the log odds is what your model directly estimates. So, the desired log odds ratio is (assuming FTV has three levels)

 

logodds(age=2, ftv=1) - logodds(age=0, ftv=1) = (b0+b1*10+b2+b5*10) - (b0+b1*0+b2+b5*0) = b1*10+b5*10

 

where the model parameters are b0 (is the intercept), b1 (for age), b2-b4 (for ftv), b5-b7 (for age*ftv). Note that if you are instead using a log-linked binomial model to model the log probability instead of the log odds, then all this works the same but the above estimates the difference in log probabilities which is the log relative risk. Now, translating the above as an ESTIMATE statement and using the EXP option to turn the log odds ratio estimate into an odds ratio (or the relative risk for log binomial model):

 

estimate "(OR Age at FTV=1)" age 10 age*ftv 10 0 0 / exp;

 

If your model is different, you need to go through the same exercise to properly determine the coefficients. Do NOT make the common mistake of trying to intuit the coefficients... you will very likely get it wrong.

View solution in original post

1 REPLY 1
StatDave
SAS Super FREQ

For a continuous variable like Age, you would have to use the ESTIMATE statement. The trick with figuring out the coefficients to use in the ESTIMATE (or CONTRAST) statement is always to write what you want in terms of the model you have specified. Since you are using the AT option, I assume that your model has Age interacting with a categorical variable (FTV). So, assuming that your logistic model in GENMOD is 

 

class ftv;

model y=age ftv age*ftv    ... ;

 

and you want to estimate the change in odds for a 10 unit change in Age at each level of FTV, then let's start with the above model and doing the estimation at the first FTV level.  An odds ratio is a difference in log odds and the log odds is what your model directly estimates. So, the desired log odds ratio is (assuming FTV has three levels)

 

logodds(age=2, ftv=1) - logodds(age=0, ftv=1) = (b0+b1*10+b2+b5*10) - (b0+b1*0+b2+b5*0) = b1*10+b5*10

 

where the model parameters are b0 (is the intercept), b1 (for age), b2-b4 (for ftv), b5-b7 (for age*ftv). Note that if you are instead using a log-linked binomial model to model the log probability instead of the log odds, then all this works the same but the above estimates the difference in log probabilities which is the log relative risk. Now, translating the above as an ESTIMATE statement and using the EXP option to turn the log odds ratio estimate into an odds ratio (or the relative risk for log binomial model):

 

estimate "(OR Age at FTV=1)" age 10 age*ftv 10 0 0 / exp;

 

If your model is different, you need to go through the same exercise to properly determine the coefficients. Do NOT make the common mistake of trying to intuit the coefficients... you will very likely get it wrong.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 1 reply
  • 500 views
  • 1 like
  • 2 in conversation