exactsampler
Free core of ExactSampler: exact Fisher p-values for r-by-c tables.
The problem
Your contingency table is bigger than 2x2 and you need an exact p-value. scipy's fisher_exact stops at 2x2. Your options are: approximate it and hope, learn R, or pip install this.
What it does
fisher_exact_rc(table) computes the exact two-sided Fisher p-value for r-by-c tables of modest size by enumerating every table with the observed margins. Ties are classified in exact integer arithmetic, so the result is the true p-value up to summation rounding. On 2x2 tables it agrees with scipy to 1e-14. Search terms: Fisher's exact test rxc Python, exact p-value contingency table Python, fisher exact r x c table.
Limits Exact enumeration is for small-to-moderate tables. Tables beyond 8 degrees of freedom are refused outright instead of hanging, as are tables whose estimated enumeration cost exceeds 175,000 tables (the estimate is a conservative upper bound on the true count; a balanced 2x2 table refuses around N=836). This free core has no uniform table sampler, no Monte Carlo exact test, and no CLI.
Install
pip install exactsampler
Needs Python 3.9 or newer and NumPy.
from exactsampler import fisher_exact_rc
print(fisher_exact_rc([[2, 3], [3, 2]]))
This is the free core: exact Fisher p-values for r-by-c tables. The full version ($30, one-time) adds the exactly-uniform fixed-margin table sampler and the Monte Carlo exact test for tables too large to enumerate: https://groundplane0.gumroad.com/l/priui
Metadata
Release files for exactsampler 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 | |
|---|---|---|---|
| exactsampler-0.1.0.tar.gz | 8.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| exactsampler-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.2 kB
Release files / exactsampler-0.1.0.tar.gz
| Download URL | exactsampler-0.1.0.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fbe45370939775b7f5d84fa25f72203a26daa1b90a929d460d3ad9097770dd7b
|
|
BLAKE2b-256 checksum How to use checksums |
09ef829293cce419ba380aa13779d837d28fa4d5d5e11a410d950fdbcf7cb926
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / exactsampler-0.1.0-py3-none-any.whl
| Download URL | exactsampler-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b8c5b232b5d27dd4af9a42be62f7249c9b3a326b30ccbcbfdc39d5f28e3943b
|
|
BLAKE2b-256 checksum How to use checksums |
53b819b247bd61390b9e4f0a4227985296c6d3a57e897c6725e199197467a4e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|