Metadata-Version: 2.4
Name: exactsampler
Version: 0.1.0
Summary: Exact Fisher p-values for r-by-c contingency tables (free core)
Author: Groundplane Labs
License: MIT
Project-URL: Homepage, https://groundplane0.gumroad.com/l/priui
Keywords: fisher exact test,contingency table,exact test,statistics,biostatistics
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Dynamic: license-file

# 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**

```bash
pip install exactsampler
```

Needs Python 3.9 or newer and NumPy.

```python
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
