exactci
Free core of ExactCI2x2: exact confidence intervals for odds ratios and relative risk in 2x2 tables.
The problem Your 2x2 table shows an effect and you need a confidence interval for the odds ratio or the relative risk. scipy has no interval for either. Your options are: quote a Wald interval and hope the coverage holds, learn R, or pip install this.
What it does
ci_odds_ratio(table) gives the Cornfield exact conditional interval (the one R's fisher.test and SAS report), and method="mid_p" gives the shorter mid-p version. ci_relative_risk(table) gives Koopman's score interval. On 2x2 tables the Cornfield limits match R's fisher.test to 1e-4. Search terms: odds ratio confidence interval Python, relative risk confidence interval Python, Cornfield exact CI, Koopman interval.
Limits One 2x2 table per call. Cornfield and mid-p condition on the table margins; Koopman is a score interval, not an exact one. The exact unconditional intervals (Baptista-Pike, Chan-Zhang) and the Agresti-Min score interval are not in this free core. No batch mode, no CLI.
Install
pip install exactci
Needs Python 3.9 or newer, NumPy, and SciPy.
from exactci import ci_odds_ratio, ci_relative_risk
print(ci_odds_ratio([[11, 4], [2, 6]]))
print(ci_relative_risk([[11, 4], [2, 6]]))
This is the free core: exact conditional and score confidence intervals for odds ratios and relative risk in 2x2 tables. The full version ($30, one-time) adds the Baptista-Pike and Chan-Zhang exact unconditional intervals, the Agresti-Min unconditional score interval, batch mode, and CLI: https://groundplane0.gumroad.com/l/verudy
Metadata
Release files for exactci 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| exactci-0.1.0.tar.gz | 10.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| exactci-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.4 kB
Release files / exactci-0.1.0.tar.gz
| Download URL | exactci-0.1.0.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74220fb589280de83d37ba6b4ef17dca72654f847d499685512476b823a97926
|
|
BLAKE2b-256 checksum How to use checksums |
7ad45b3c87d2577363cc1f3fc0d6998b9938ac92d8f54b9195ac6f9ecac637e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / exactci-0.1.0-py3-none-any.whl
| Download URL | exactci-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6efd82cd975ac927e9101ae6d090e46584040ae72712b65bec086f746118298
|
|
BLAKE2b-256 checksum How to use checksums |
01cabcd0861757047f5040c5ee16dc4b2e67354f966d06b8c9bac94c946748e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|