python 计算置信区间,计算置信区间(示例代码)

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

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

你可能感兴趣的:(python,计算置信区间)