2 min read

Confidence Intervals for Difference Between Independent Binomial Proportions: A SAS 9.4/STAT 12.3 Update

For the computing of confidence intervals for difference between two independent binomial proportions in SAS 9.4/STAT 12.3, it’s hard to figure out exactly how many methods are available because there is no “CL=ALL” trigger in RISKDIFF option (but you can get one in BIONOMIAL option to compute the confidence intervals for binomial proportion). As far as I hacked, I got 11 intervals (last year I tried SAS 9.3 and got 8; codes available below):

CI_diff_94

1. There 3 new methods I just got from SAS 9.4/STAT 12.3 are  Miettinen-Nurminen-Mee, Miettinen-Nurminen and Agresti-Caffo.

2.  The methods with number marks are align with Prof. Newcombe ’s paper, Interval estimation for the difference between independent proportions: comparison of eleven methods (a fraction of outputs attached in my post).

3. I’m still trying to figure out why the exact method produces different numbers compared to what’s in Prof. Newcombe’s report.

4. The codes produced the outputs:

data ci;
    input grp res count;
datalines;
1 0 56
1 1 14
2 0 48
2 1 32
;

/*
non-exactmethods:
Agresti-Caffo
Farrington-Manning
Hauck-Anderson
Miettinen-Nurminen
Newcombe Score
Wald
*/

ods select  PdiffCLs;
ods output PdiffCLs=ci1;
proc freq data=ci order=data;
    tables grp*res /riskdiff (CL=(AC FM HA MN WILSON WALD));
    weight count;
run;

/*
exact methods:
Exact
Exact (FM Score)
*/
ods select  PdiffCLs;
ods output PdiffCLs=ci2;
proc freq data=ci order=data;
    tables grp*res /riskdiff (CL=(EXACT));
    weight count;
    exact riskdiff;
run;

ods select  PdiffCLs;
ods output PdiffCLs=ci3;
proc freq data=ci order=data;
    tables grp*res /riskdiff (CL=(EXACT));
    weight count;
    exact riskdiff(fmscore);
run;

/*
methods (CC):
Mee
Newcombe Score (Corrected)
Wald (Corrected)
*/
ods select  PdiffCLs;
ods output PdiffCLs=ci4;
proc freq data=ci order=data;
    tables grp*res /riskdiff (CORRECT CL=(MN(CORRECT=NO) WILSON WALD));
    weight count;
run;

data CI_all;
    set ci4 ci3 ci2 ci1;
    CI=‘(‘||compress(put(LowerCL,8.4))||’, ‘||compress(put(UpperCL,8.4))||’)’;
run;

proc sql;
    select
    case Type
        when “Wald” then “a”
        when “Wald (Corrected)” then “b”
        when “Miettinen-Nurminen-Mee” then “b1”
        when “Miettinen-Nurminen” then “b2”        
        when “Agresti-Caffo” then “b3”
        when “Exact” then “c”
        when “Exact (FM Score)” then “d”
        when “Newcombe Score” then “e”
        when “Newcombe Score (Corrected)” then “f”
        when “Farrington-Manning” then “g”
        when “Hauck-Anderson” then “h”
        else “i”
    end as order length=2,
        Type “method”,
        CI “95% Confidence Limits”
    from CI_all
    order by order
        ;
quit;