Hi,
I am calculating 95% CI for single proportion using stata and wrote a sample command based on formula for doing this:
.
I am wondering if I am correct with my answers or if there are other reliable and more efficient way of doing this in stata.
The result I got is as follows:
Please kindly respond if there are other methods simple and/or complex for calculation confidence intervals for single proportion.
Regards.
I am calculating 95% CI for single proportion using stata and wrote a sample command based on formula for doing this:
Code:
phat = +- z*(sqrt(phat*(1-phat))/n
I am wondering if I am correct with my answers or if there are other reliable and more efficient way of doing this in stata.
Code:
clear input str6 race long m long x BLK 67 8 BLK 68 11 BLK 60 56 CAU 49 43 CAU 48 3 CAU 67 2 ASI 134 5 ASI 64 1 ASI 48 5 end gen phat=(x/m) gen prop = phat*100 gen lb = (phat - 1.96*(sqrt(phat*(1-phat))/m))*100 gen ub = (phat + 1.96*(sqrt(phat*(1-phat))/m))*100
Code:
race m x phat prop lb ub BLK 67 8 .119403 11.9403 10.99171 12.88889 BLK 68 11 .1617647 16.17647 15.11509 17.23785 BLK 60 56 .9333333 93.33334 92.51849 94.14819 CAU 49 43 .877551 87.7551 86.44389 89.06631 CAU 48 3 .0625 6.25 5.261582 7.238418 CAU 67 2 .0298507 2.985075 2.487248 3.482901 ASI 134 5 .0373134 3.731343 3.454122 4.008564 ASI 64 1 .015625 1.5625 1.18269 1.94231 ASI 48 5 .1041667 10.41667 9.169304 11.66403
Regards.
Comment