Reputation: 145
What would be a better way to calculate Confidence Interval (CI) for a proportion when the sample size is small and even the sample size is 1?
I am currently calculating CI for a Proportion in One Sample w/:
However, my sample size is very small, sometimes it is even 1. I also tried
An approximate (1−α)100% confidence interval for a proportion p of a small population using:
Specifically, I'm trying to implement those two formulas to calculate the CI for proportion. As you see on the graph below, at 2018-Q1, the blue group has no CI around it because there is 1 out of 1 ppl choosing that item at 2018-Q1. If using the Finite Population Correction (FPC), it doesn't correct the CI if N is 1. So, my question is that what would be the best statistical way to solve this small sample size issue with 100% proportion.
Upvotes: 6
Views: 9842
Reputation: 855
Try statsmodels.stats.proportion.proportion_confint
http://www.statsmodels.org/devel/generated/statsmodels.stats.proportion.proportion_confint.html
According to their documentation, you use it like this:
ci_low, ci_upp = proportion_confint(count, nobs, alpha=0.05, method='normal')
Where the parameters are:
method (string in ['normal']) – method to use for confidence interval, currently available methods:
Upvotes: 6