我正在尝试使用SAS比较基于精确计算的95%Wald CI和95%CI,并计算人口比例在任一CI中出现的次数,使用1000个10号样本,人口比例较少我从10个10号样本开始,人口比例为p = 0.05。我的下面的代码似乎给出了CI,但我无法计算CI中出现的比例。有帮助吗?我如何让SAS做1000个10号样本?
%let numsampled=10;
data bin_sample(keep=bin);
call streaminit(4321); *initialize the seed;
do id = 1 to &numsampled;
bin = rand('Binomial',0.05,10);
output;
end;
run;
proc print data=bin_sample;
run;
proc freq data=Bin_sample order=freq;
tables bin / binomial(wald exact) alpha=.05;
/* weight Count;*/
title 'Two Confidence Intervals for binomial trials';
run;