Skip to main content

Accurate and efficient binomial, Hardy-Weinberg equilibrium, and Fisher's exact tests.

Project description

exact_tests

This package provides binomial, Hardy-Weinberg equilibrium, and Fisher's exact test (2x2 and 2x3 so far) functions, along with {p,d,q}binom() and {p,d,q}hyper() distribution functions. The functions are accurate and efficient:

  • High-precision and interval arithmetic are used to ensure likelihood near-ties are correctly resolved. Log-(mid)p-values are available when you don't want to just round tiny p-values down to zero.

  • It's relatively expensive to compute a contingency table's likelihood from scratch, but it's cheap when the likelihood of an adjacent contingency table is known. And it's even cheaper to skip a likelihood calculation when the value must be too small to matter. These functions take advantage of the latter possibilities.

Build instructions

PyPI:

pip install 'pip>=20.3'
pip install exact_tests

GitHub:

pip install 'pip>=20.3'
pip install -e 'git+https://github.com/chrchang/stats.git#egg=exact_tests&subdirectory=Python'

Or install from a cloned copy:

# clone repo
git clone https://github.com/chrchang/stats
# go to python folder
cd stats/Python
# install the package
pip install -e .

You can test the package with pytest.

Example usage:
import exact_tests

exact_tests.binom(3, n=15, p=0.1, alternative="greater")
exact_tests.binom(2, 29, 0.1)
exact_tests.binom(2, 29, "0.1")
exact_tests.binom(2, 29, "0.1", midp=True)
exact_tests.binom(100, 10000, "0.000001", logp=True)
exact_tests.fisher([[4, 0], [0, 4]], alternative="greater", midp=True)
exact_tests.fisher([[10000, 20000], [30000, 40000], [50000, 60000]], logp=True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

exact_tests-0.4.1.tar.gz (236.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

exact_tests-0.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

exact_tests-0.4.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (996.8 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

exact_tests-0.4.1-cp314-cp314-macosx_10_15_universal2.whl (511.1 kB view details)

Uploaded CPython 3.14macOS 10.15+ universal2 (ARM64, x86-64)

exact_tests-0.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

exact_tests-0.4.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (996.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

exact_tests-0.4.1-cp313-cp313-macosx_10_13_universal2.whl (507.7 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

exact_tests-0.4.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

exact_tests-0.4.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

exact_tests-0.4.1-cp312-cp312-macosx_10_13_universal2.whl (508.2 kB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

exact_tests-0.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

exact_tests-0.4.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (984.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

exact_tests-0.4.1-cp311-cp311-macosx_10_9_universal2.whl (506.0 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

exact_tests-0.4.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

exact_tests-0.4.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (969.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

exact_tests-0.4.1-cp310-cp310-macosx_10_9_universal2.whl (506.3 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file exact_tests-0.4.1.tar.gz.

File metadata

  • Download URL: exact_tests-0.4.1.tar.gz
  • Upload date:
  • Size: 236.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for exact_tests-0.4.1.tar.gz
Algorithm Hash digest
SHA256 8e34ff64260c29f2e29a0e186cbff197a100c2fad7ec3a338ad5ff46a1e0dc86
MD5 dac0ab547ab18614912e9a83ff79074e
BLAKE2b-256 7946f1ea0c633f6cd76861b805fe557231b7f6816f47f13d452c145dffaa8fb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1.tar.gz:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4060ca208839a525fe2dbc78e7fa6c4433975b5eab10779cf913b0b98c1b9b52
MD5 a48abbcda264abc390886113bd40cd8e
BLAKE2b-256 ff8c2f25bb1077c6675560c40d2335e221cf69f05948f08c7dd375c8156ada66

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b9f4eb7a8b1e1f40b666a698c6401fef72b7c4d62a99a67bdfc231859c529888
MD5 b08dfd177e3e0dad794970a0e9b190d1
BLAKE2b-256 fd13a968e01ae641c7f8e416f1264acc349a825ed12fa88792002d7f006f46c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp314-cp314-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 d62fd6e0f9701e54e273db00897f72fa47246843494fa58dd2733f334e31b396
MD5 3c8bbaa097e0f628b088e2b744f25a77
BLAKE2b-256 9bf22acdedaea083cf1f4bd3173cc616dd5cb351eecf8e753d683d79a02a19ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp314-cp314-macosx_10_15_universal2.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fc5b8af79abd6ce44d9923d32e1acddd87e6a25bc96c4d76da0c4b7f2d4a99cd
MD5 d55d2837d6de5ad0b008b8ee3ffefa91
BLAKE2b-256 f41c5fc34b738ff73f8efd4c71a99ebacf21c6f2fe58724349a3a7ff008f3eb8

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e27163f92e5ae2bb11e0a562ccf57ead48a41419153a7be73c651b3af6314c3a
MD5 4e59ef79d25eb57d14d370812cc37b31
BLAKE2b-256 f2465d11c1123683fbe518c69cd070ed356afc941aa534ff0c5b731f498c77c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 3a4c8d2367289eee320055be7c563c0ec0a72c138b3c00d9e6689202d5a252cb
MD5 8532e2837ceb3a9ccf45232460d29ff7
BLAKE2b-256 c85ba5334882c2b7e8a7036fd86e4c5734a516d91d441ba7f6f157068481ea76

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp313-cp313-macosx_10_13_universal2.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4abe14ef8a9d5531a401ae2715d06ffb83ec5705273238d6ea8c3bd29b343ecb
MD5 759966081922707439341e969581b0d2
BLAKE2b-256 e2d38f1bdb0f0c6f71aa15e3230466a8164eba4d96cbf798d724ecdd0c57a5a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f3e8a4fc20c840a5f9ea97761e0e537a90ae952ab7dca03e7fe824b7cbe9e5aa
MD5 1efa5cce906d3033ad3980555689f179
BLAKE2b-256 92f895f06b585cbf870be0ec4eca3c86ce73dcd48c29791da3d4dcd1a0caf166

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 95b9d14bcbdef309398d632bfe8ce2022570addbabda0fccb8f0882ed3cf6533
MD5 ea6394c703167e7b4ef53bca4cc36eba
BLAKE2b-256 c300cc58cf7f7ade68a949a94cb62fbfd9427f13275a0f9e8787c9930b60b9a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp312-cp312-macosx_10_13_universal2.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 89e4de8bfb6fdc0c2b7e2e2cad75bc565c6c59f455b2df6995ae94a9da5de99a
MD5 78f0bebb0ca5122e6d087dfc6516b22f
BLAKE2b-256 13814f735284cc5a5315f19d85ddeb3b12dc05f53fedde170843c01167b848a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a569979043e6e19f835cc1750b5dd2a3213cea7da43d376d93756c3bcd986156
MD5 bf03dbab754addcd441dc62ac13ebecc
BLAKE2b-256 ff6d8e76c1caf3f769b42eb076435b662bf38b90e7a66f0e7d8edff412f366f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 e58134a6f21037e82f8c126f622f4c62c1489e6081f55632dcb0530a94ee1caa
MD5 dee583024eb29342e922e6e30b377d76
BLAKE2b-256 b9718cfc047841b614b81b955023de5c39160d9176e7d2472f94fa708f2d8e51

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp311-cp311-macosx_10_9_universal2.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dc00c351ea53a11687f2099bf8425a4f1e829a6b1f7803cb8ceeb29192908d19
MD5 658a97b6c02c2d71cd3f90dcadcef669
BLAKE2b-256 2992df20c493b10f92afff7d8c0bf3c7e5a932660518a441b02a932e9a8c5d1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1b34aa346e31ab7cca59d10b5c7b0a7343e91877c139ecd9730dc6618f14a1a4
MD5 af2a3ea8620600c8920fc8e5f5bfca36
BLAKE2b-256 8e7558cede2e58f7cf342538e4414d699c6b711e5398263723268bf0d88b3cc9

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exact_tests-0.4.1-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 460775125a43cd032a503d05df2ba4592ba833f21df196dc876973169fd2e532
MD5 6b15d0cad2a63b9f98187adaa236bc96
BLAKE2b-256 006a93bb1ee7073b0ef8b64a94041a482353c33662bd5c75bf562f1c85a920ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.1-cp310-cp310-macosx_10_9_universal2.whl:

Publisher: release.yaml on chrchang/stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page