scipy.stats._result_classes.BinomTestResult.
proportion_ci#
- BinomTestResult.proportion_ci(confidence_level=0.95, method='exact')[source]#
Compute the confidence interval for
statistic
.- Parameters:
- confidence_levelfloat, optional
Confidence level for the computed confidence interval of the estimated proportion. Default is 0.95.
- method{‘exact’, ‘wilson’, ‘wilsoncc’}, optional
Selects the method used to compute the confidence interval for the estimate of the proportion:
- ‘exact’ :
Use the Clopper-Pearson exact method [1].
- ‘wilson’ :
- ‘wilsoncc’ :
Default is
'exact'
.
- Returns:
- ci
ConfidenceInterval
object The object has attributes
low
andhigh
that hold the lower and upper bounds of the confidence interval.
- ci
References
[1]C. J. Clopper and E. S. Pearson, The use of confidence or fiducial limits illustrated in the case of the binomial, Biometrika, Vol. 26, No. 4, pp 404-413 (Dec. 1934).
Examples
>>> from scipy.stats import binomtest >>> result = binomtest(k=7, n=50, p=0.1) >>> result.statistic 0.14 >>> result.proportion_ci() ConfidenceInterval(low=0.05819170033997342, high=0.26739600249700846)