会开花的小花花

导航

计算置信区间

proc freq data=datain;
    by group;
    tables var / missprint nowarn binomial(level='1' cl=exact ) alpha=0.05;
    weight n/zero;(对发生的做置信区间,考虑发生数量为0的情况)
    ods output binomialcls=cl;
run;
ods output close;

datain的格式如下:
 
group(分组) Var(每组相对立的事件分类,eg:发生/没发生) N(每种情况下的数量)
1                       0                                                                              5
1                       1                                                                              6
2                       0                                                                              2
2                       1                                                                              4
3                       0                                                                              5
3                       1                                                                              3

将会得到每个组中发生的置信区间。

posted on 2020-01-07 00:08  会开花的小花花  阅读(492)  评论(0编辑  收藏  举报