statsmodels.stats.proportion.samplesize_confint_proportion¶
- statsmodels.stats.proportion.samplesize_confint_proportion(proportion, half_length, alpha=0.05, method='normal')[source]¶
find sample size to get desired confidence interval length
- Parameters:
- proportion
float
in
(0, 1) proportion or quantile
- half_length
float
in
(0, 1) desired half length of the confidence interval
- alpha
float
in
(0, 1) significance level, default 0.05, coverage of the two-sided interval is (approximately)
1 - alpha
- method
str
in
[‘normal’] method to use for confidence interval, currently only normal approximation
- proportion
- Returns:
- n
float
sample size to get the desired half length of the confidence interval
- n
Notes
this is mainly to store the formula. possible application: number of replications in bootstrap samples