I would like to estimate a confidence interval for a proportion when there are zero counts. I find that -ci prop- will give a CI estimate, while the -proportion- estimate command never does, and I wondered why. Perhaps I missed it but the manual suggests that both commands estimate the SE/confidence intervals in similar ways.
Code:
set obs 100
gen x= _n>50
gen y= _n >75
tab x y
proportion y, over(x) citype(wilson)
/*
Proportion estimation Number of obs = 100
--------------------------------------------------------------
| Wilson
| Proportion Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
y@x |
0 0 | 1 0 . .
0 1 | .5 .0707107 .3664451 .6335549
1 0 | 0 (no observations)
1 1 | .5 .0707107 .3664451 .6335549
--------------------------------------------------------------
*/
ci prop y if x==0, wilson
/*
------ Wilson ------
Variable | Obs Proportion Std. Err. [95% Conf. Interval]
-------------+---------------------------------------------------------------
y | 50 0 0 6.94e-18 .0713476
*/
ci prop x if y==1, wilson
/*
------ Wilson ------
Variable | Obs Proportion Std. Err. [95% Conf. Interval]
-------------+---------------------------------------------------------------
x | 25 1 0 .8668077 1
*/Thanks,
Scott
0 Response to ci prop and proportions with zero counts
Post a Comment