Example in my case:
Using a mixed model for getting the rates of "failure" in patients undergoing surgery. Need to use mixed model because patients can have one to two eyes undergoing either of two treatment (surgeries) types.
Example of how data is structured:
How I built my model so far:
proc glimmix data=mydata method=laplace; class PtID Treatment Eye; model failure = Treatment|Eye; random Eye / subject=PtID(Treatment) type=cs; lsmeans Treatment / cl oddsratio ilink; title 'Eye Surgery'; run;
I really want to find the 95% odds ratio of failure between the two treatments. Could you please let me know what code I'll need? Am I way off in terms of how I'm organizing my data or how I've built my model? Thanks in advance
I think you need the LINK= option and the ODDSRATIO option in the MODEL statement
model failure = Treatment|Eye/link=logit oddsratio;
Thanks! That's giving me Odds ratios but unfortunately don't seem to be correct... Adding that line changed the covariance estimates and lsmeans estimates by a few orders of magnitude. The ORs are also way higher than what I was expecting
Things change because by default, GLIMMIX assumes you have normally distributed errors. Adding the LINK= option assumes your response variable is binomial (1 or 0). So which fits your situation better?
This might not answer your question directly, but it looks to me that you omitted the dist=binary link=logit options in the MODEL statement. Also the RANDOM statement seems to be for the R-side random effect, which means you need to add the RESIDUAL option in the RANDOM statement. But because of the METHOD=LAPLACE option you specified, R-side random effect might not be possible. You either need to take out this METHOD=option when adding the RESIDUAL option in the RANDOM statement, or, if you keep the METHOD=LAPLACE option, you might try the following RANDOM statement for the G-side random effect --
random int / subject=PtID(Treatment);
Thanks,
Jill
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 16. 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.