样本率可信区间clopper-pearson法SAS程序
In some case,如果样本率是100%,用传统的计算率的可信区间就会出现上限超过100%的情况,这不合逻辑。基于二项分布的小样本总体率可信区间估计方法Clopper-Pearson法,可以避免这种情况的发生。
data temp;
do i=1 to 349;treatment='a' ;response=0;output;end;
do i=1 to 5;treatment='a' ;response=1;output;end;
run;
proc freq;
by treatment;
tables response/binomial(all);
run;
程序运行结果如下:SAS 系统 FREQ 过程
treatment=a

样本大小 = 354
只要注意上面标红的结果就可以了,共354例,349例阳性,阳性率为98.59%,Clopper-Pearson法估计的 95%CI为(0.9673,0.9954)。
回到正题,若全为阳性,则SAS程序为:
data temp;
do i=1 to 349;treatment='a' ;response=0;output;end;
run;
proc freq;
by treatment;
tables response/binomial(all);
run;
程序运行结果如下:
SAS 系统 FREQ 过程 treatment=a

样本大小 = 349
同样,只要注意上面标红的结果就可以了,阳性率为100%,Clopper-Pearson法估计的 95%CI为(0.9895,1)。
Reference: http://blog.sina.com.cn/s/blog_538b0a9b0102x1xp.html
-
Equinox Flower 赞了这篇日记 2024-10-17 17:35:25
-
豆友161360106 赞了这篇日记 2022-06-15 09:51:30