Metadata-Version: 2.4
Name: hamstest
Version: 0.1.0
Summary: Estimate very small p-values in permutation tests using multilevel splitting
Author: Nikita Golikov, Vladimir Sukhov, Gennady Korotkevich
Author-email: Alexey Sergushichev <alsergbox@gmail.com>
Maintainer-email: Alexey Sergushichev <alsergbox@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/golikov-nik/hamstest
Project-URL: Repository, https://github.com/golikov-nik/hamstest
Project-URL: Issues, https://github.com/golikov-nik/hamstest/issues
Keywords: permutation-test,p-value,statistics,multilevel-splitting,scientific-computing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: C++
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.0
Requires-Dist: scipy>=1.13
Provides-Extra: plotting
Requires-Dist: joblib>=1.3; extra == "plotting"
Requires-Dist: matplotlib>=3.9; extra == "plotting"
Requires-Dist: pandas>=2.0; extra == "plotting"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: ruff>=0.8.0; extra == "dev"
Dynamic: license-file

# hamstest

`hamstest` estimates arbitrarily small p-values in two-sample permutation tests using hash-augmented adaptive multilevel splitting Monte Carlo.

## Installation

```bash
pip install hamstest
```

Plotting helpers used by notebooks are optional:

```bash
pip install "hamstest[plotting]"
```

## Quick start

```python
from hamstest import Estimator
from hamstest.permutation_tests.kstest import KSTest

test = KSTest(100, 900)
target_score = int(0.333 * 100 * 900)
estimator = Estimator(test, sample_size=101, seed=0)
log_pvalue, log_pvalue_stderr = estimator.estimate(target_score)
```

`test` should implement the permutation-test interfaces exported by
`hamstest`: `AbstractPermutationTest` and `AbstractPermutationTestSubset`.
The package also ships reference implementations in `hamstest.permutation_tests`.

## Adapter packages

The package includes the C++ dispatcher and a helper command for starting custom
native adapters:

```bash
hamstest-adapter-init my_hamstest_adapter --kind my_test
```

Example adapters for KS and Mann-Whitney U tests are developed in the same
GitHub repository and are published separately.

## Project

Source code and issue tracking are available at
https://github.com/golikov-nik/hamstest.
