scipy.stats._result_classes.BinomTestResult.

proportion_ci#

BinomTestResult.proportion_ci(confidence_level=0.95, method='exact')[源代码]#

计算 statistic 的置信区间。

参数:
confidence_levelfloat, 可选

计算出的估计比例的置信区间的置信水平。默认为 0.95。

method{‘exact’, ‘wilson’, ‘wilsoncc’}, 可选

选择用于计算比例估计的置信区间的方法

‘exact’

使用 Clopper-Pearson 精确方法 [1]

‘wilson’

Wilson 方法,没有连续性校正 ([2], [3])。

‘wilsoncc’

Wilson 方法,具有连续性校正 ([2], [3])。

默认为 'exact'

返回:
ciConfidenceInterval 对象

该对象具有属性 lowhigh,它们保存置信区间的下限和上限。

参考文献

[1]

C. J. Clopper 和 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).

[2] (1,2)

E. B. Wilson, Probable inference, the law of succession, and statistical inference, J. Amer. Stat. Assoc., 22, pp 209-212 (1927).

[3] (1,2)

Robert G. Newcombe, Two-sided confidence intervals for the single proportion: comparison of seven methods, Statistics in Medicine, 17, pp 857-872 (1998).

示例

>>> 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)