Hi everyone,
I am conducting a county-level analysis. Counties are clustered within states so I am using PROC GLIMMIX to account for clustering of counties within states (and thus correlation between counties within the same state).
I want to visualize the interaction term between 2 continuous variables (depression*unemployment). The outcome is binary (1 or 0), not continuous, and the measure of association is Odds Ratio (OR). I have seen a few SAS sources for these but none show how to a) conduct this for clustered data (I'm using PROC GLIMMIX), b) adjust for confounding variables while studying the interaction.
Can anyone please share code for visualizing interaction in this scenario? Many thanks for your time and help!
This is my PROC GLIMMIX code:
/* GLIMMIX for full cohort*/
proc glimmix data=output.cohort_all_vars2 ;
class state urbanity (ref="0") gini_high (ref="0") ;
model highrisk= COPD poverty popabove65 gini_high uninsured lessHS unemployment percwhite percentmale heart_disease depression Opioid_Rx_Rate urbanity depression*unemployment / dist=bin cl oddsratio;
random int /subject=state /*type=cs*/;
estimate 'gini_high' gini_high 1 / exp;
estimate 'uninsured' uninsured 1 / exp;
estimate 'lessHS' lessHS 1 / exp;
estimate 'poverty' poverty 1 / exp;
estimate 'unemployment' unemployment 1 / exp;
estimate 'COPD' COPD 1 / exp;
estimate 'popabove65' popabove65 1 / exp;
estimate 'percwhite' percwhite 1 / exp;
estimate 'percentmale' percentmale 1 / exp;
estimate 'heart_disease' heart_disease 1 / exp;
estimate 'depression' depression 1 / exp;
estimate 'Opioid_Rx_Rate' Opioid_Rx_Rate 1 / exp;
estimate 'urbanity' urbanity 1 / exp;
estimate 'depression*unemployment' depression*unemployment 1 / exp;
run;
I think the EFFECTPLOT command, with the CONTOUR option, allows you to see plots of an interaction between two continuous variables.
Thanks for your response. It would help to have code that accounts for clustering and adjusts for other covariates.
The EFFECTPLOT uses (of course) the estimated regression coefficients. These already account for (in some sense) the clustering and other covariates. So, it's not clear what is missing that EFFECTPLOT is not providing for you. (Re-reading your original problem statement, I don't see clustering or even the usage of counties in the model)
Thank you for responding. Using this example: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/statug/statug_introcom_sect032.htm
I see that they used logistic regression and integrated the effectplot statement in their logistic reg code. Are you saying that I can use effectplot in PROC GLIMMIX too?
Actually, EFFECTPLOT does not work in GLIMMIX.
Use the STORE statement in PROC GLIMMIX to save the fitted model. Then use PROC PLM to read the saved model (using the RESTORE= option) and include the EFFECTPLOT statement.
For an example and discussion, see "Visualize interaction effects in regression models."
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.