Metadata-Version: 2.5
Name: gaffke
Version: 0.1.2
Summary: The Gaffke confidence interval for the mean of a discrete bounded variable: exact, narrow and fast
Project-URL: Homepage, https://github.com/louisabraham/gaffke
Project-URL: Source, https://github.com/louisabraham/gaffke
Author-email: Louis Abraham <abraham.cie@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: Clopper-Pearson,Dirichlet,Gaffke,confidence interval,mean,multinomial,nonparametric
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Requires-Dist: numpy>=1.22
Requires-Dist: scipy>=1.9
Provides-Extra: test
Requires-Dist: mpmath; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Description-Content-Type: text/markdown

# gaffke (Python)

The Gaffke confidence interval for the mean of a discrete bounded variable:
**exact** (coverage at least 1 - alpha for every sample size and every
distribution), **narrow** (the shortest published interval with this
guarantee in our experiments) and **fast** (under a millisecond for any n).

```python
from gaffke import gaffke_ci

# 3 answers "1", 5 answers "2", 2 answers "3" on a 1-3 scale
gaffke_ci([3, 5, 2], [1, 2, 3], alpha=0.05)
# {'lower': 1.4276..., 'upper': 2.4186...}
```

For two values it is the Clopper-Pearson interval. The endpoints are
quantiles of a weighted sum of Dirichlet variables; `dirichlet_sum_cdf`,
`dirichlet_sum_sf`, `dirichlet_sum_pdf` and `dirichlet_sum_ppf` give this
law directly.

Method, references and experiments: see the implementation note at
https://github.com/louisabraham/gaffke.
