I am using proc logistic to create a model that has 2 dummy variable and I added the interaction term. When a model includes an interaction term, the odds ratios that are presented for the variables included in the interaction are conditional to the other variable involved. It is useful when the interaction is significant, but when the interaction is insignificant, it is unnecessary to look at the results conditionally. Is there a way to still get the main effects odds ratios (unconditional) by keeping the interaction term in the model ? Or the only way would be to rerun the model without the interaction term ?
The second example in the LOGISTIC Procedure documentation has something that may be what you want, using the ODDSRATIO and CONTRAST statements. Here is the online link: https://documentation.sas.com/doc/en/statug/15.2/statug_logistic_examples02.htm
SteveDenham
When a predictor is involved in interaction, PROC LOGISTIC does not provide an odds ratio estimate for it in the default table that it presents. I suspect that you are using the EXPB option which adds a column in the parameter estimates table containing exponentiated values of the estimates, but it is important to understand that these values are not always odds ratio estimates. Also, it makes little sense to talk about the overall odds ratio for a predictor involved in interaction just as one doesn't talk of the main effect of a predictor in an ordinary regression model when it is involved in interaction. When the model allows for interaction, the predictor has a different effect at each level of the interacting predictor(s). These separate estimates are provided by the ODDSRATIO statement and this statement computes those estimates appropriately regardless of the coding (parameterization) used for CLASS predictors. Rather than the EXPB option, the ODDSRATIO statement is the recommended way to obtain odds ratio estimates.
That said, a single odds ratio estimate can be provided for a predictor in interaction by using the LSMEANS statement, but note the coefficients used (as shown by the E option) for the two individual log odds. As they show, each log odds is essentially averaged over the levels of the interacting predictor which may not be very meaningful (and possibly misleading) particularly when the predictor of interest has very different effect in each level of the interacting predictor. Note also that the LSMEANS statement requires use of PARAM=GLM in the CLASS statement.
proc logistic;
class a b/param=glm;
model y(event="1")=a|b;
lsmeans a/diff e cl oddsratio;
run;
Thank you for your reply! This helps me, and I do understand that when the interaction is significant, it is important to look at the conditional odds ratio. I tried the LSMEANS statement for my predictor variables. The only thing I am confused about is how come does the odds ratios and the estimates of the coefficients that I obtain are slightly different than the ones I get when I run the model without the interaction. Is there a difference in the calculation method ? (ex: odds ratio for sex in model with interaction : 2.048, in the model without the interaction : 2.053)
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!
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.