I wonder why the odds ratio estimated by proc logistic differs from the one obtained from proc freq and proc genmod in the example below (SAS 9.4 TS Level 1M5). The OR's become identical when the low frequency event=0/factor=1 is set to above 20. Using logistic regression in STATA on this data gives the same OR as the one from proc freq and proc genmod. I would like to know why proc logistic gives a slightly different OR (I know exact logistic regression should be used on sparse data).
data check;
do i=1 to 52; event=1; factor=1; output; end;
do i=1 to 287; event=1; factor=0; output; end;
do i=1 to 1; event=0; factor=1; output; end;
do i=1 to 385; event=0; factor=0; output; end;
run;
proc logistic data=check descending;
class factor/param=ref ref=first;
model event=factor;
run;
proc freq data=check;
tables event*factor/cmh;
run;
Thanks! One can specify TECH=Newton as option in proc logistic's model statement, but it gives the same output as Fisher scoring. So, you really need 'Newton with ridging' to come to identical estimates. Good to know when small frequencies are involved!
If you add the ITPRINT option, you will see that the gradients are small but not extremely close to zero which would indicate proper convergence. You could be a little suspicious of the convergence because of the slightly large parameter estimate. If you then use a different convergence criterion by specifying GCONV=0 XCONV=1e-8, then the gradients are extremely small and the odds ratio estimate is the same as from PROC FREQ. Of course, using a different procedure similarly changes the iterative algorithm and could also provide more complete convergence.
Thanks, very helpful solution as well.
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.