statsmodels.stats.proportion.confint_proportions_2indep¶
-
statsmodels.stats.proportion.confint_proportions_2indep(count1, nobs1, count2, nobs2, method=
None
, compare='diff'
, alpha=0.05
, correction=True
)[source]¶ Confidence intervals for comparing two independent proportions.
This assumes that we have two independent binomial samples.
- Parameters:¶
- count1, nobs1
float
Count and sample size for first sample.
- count2, nobs2
float
Count and sample size for the second sample.
- method
str
Method for computing confidence interval. If method is None, then a default method is used. The default might change as more methods are added.
- diff:
‘wald’,
‘agresti-caffo’
‘newcomb’ (default)
‘score’
- ratio:
‘log’
‘log-adjusted’ (default)
‘score’
- odds-ratio:
‘logit’
‘logit-adjusted’ (default)
‘score’
- compare
str
in
[‘diff’, ‘ratio’ ‘odds-ratio’] If compare is diff, then the confidence interval is for diff = p1 - p2. If compare is ratio, then the confidence interval is for the risk ratio defined by ratio = p1 / p2. If compare is odds-ratio, then the confidence interval is for the odds-ratio defined by or = p1 / (1 - p1) / (p2 / (1 - p2).
- alpha
float
Significance level for the confidence interval, default is 0.05. The nominal coverage probability is 1 - alpha.
- count1, nobs1
- Returns:¶
low
,upp
Notes
- Status: experimental, API and defaults might still change.
more
methods
will be added.
References
[1]Fagerland, Morten W., Stian Lydersen, and Petter Laake. 2015. “Recommended Confidence Intervals for Two Independent Binomial Proportions.” Statistical Methods in Medical Research 24 (2): 224–54. https://doi.org/10.1177/0962280211415469.
[2]Koopman, P. A. R. 1984. “Confidence Intervals for the Ratio of Two Binomial Proportions.” Biometrics 40 (2): 513–17. https://doi.org/10.2307/2531405.
[3]Miettinen, Olli, and Markku Nurminen. “Comparative analysis of two rates.” Statistics in medicine 4, no. 2 (1985): 213-226.
[4]Newcombe, Robert G. 1998. “Interval Estimation for the Difference between Independent Proportions: Comparison of Eleven Methods.” Statistics in Medicine 17 (8): 873–90. https://doi.org/10.1002/(SICI)1097-0258(19980430)17:8<873::AID- SIM779>3.0.CO;2-I.
[5]Newcombe, Robert G., and Markku M. Nurminen. 2011. “In Defence of Score Intervals for Proportions and Their Differences.” Communications in Statistics - Theory and Methods 40 (7): 1271–82. https://doi.org/10.1080/03610920903576580.