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.6.tar.gz (218.7 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.6-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.0 MB view details)

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

exact_tests-0.4.6-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (1.3 MB view details)

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

exact_tests-0.4.6-cp314-cp314-macosx_10_15_universal2.whl (443.1 kB view details)

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

exact_tests-0.4.6-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.0 MB view details)

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

exact_tests-0.4.6-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (1.3 MB view details)

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

exact_tests-0.4.6-cp313-cp313-macosx_10_13_universal2.whl (439.6 kB view details)

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

exact_tests-0.4.6-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.1 MB view details)

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

exact_tests-0.4.6-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (1.3 MB view details)

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

exact_tests-0.4.6-cp312-cp312-macosx_10_13_universal2.whl (440.9 kB view details)

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

exact_tests-0.4.6-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.0 MB view details)

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

exact_tests-0.4.6-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (1.3 MB view details)

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

exact_tests-0.4.6-cp311-cp311-macosx_10_9_universal2.whl (437.7 kB view details)

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

exact_tests-0.4.6-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.0 MB view details)

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

exact_tests-0.4.6-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (1.3 MB view details)

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

exact_tests-0.4.6-cp310-cp310-macosx_10_9_universal2.whl (437.8 kB view details)

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

File details

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

File metadata

  • Download URL: exact_tests-0.4.6.tar.gz
  • Upload date:
  • Size: 218.7 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.6.tar.gz
Algorithm Hash digest
SHA256 22d6411d04bf0a7afdab9bea86de2c9d32ff6992c69b56350fdd7c4fb697df2f
MD5 5a6418c56a57053f49dce0bad6bd3b65
BLAKE2b-256 1b8274f9c91e5a985b6f1f769ff6c4255c15c57e4f36b119020917cfc7a1191d

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6.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.6-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7a198848e312882b248bf3e854109291780c0fc5b07ed38e89ee85da5efd5ee5
MD5 bda17f3b8a652c15e540a22f931fd06a
BLAKE2b-256 450bb9d966b27f4d91b280ae0a1e39b592e77ec1eb191bd9e8eff8842e7a0b47

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-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.6-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 cfa1bf993516ee4e83f0fa67d8d29c82548d95b41e1d8170ecd0957c6ac72647
MD5 c91109610e0d635558d7d41f16aa3527
BLAKE2b-256 6a2c50c64c52973dc45fb57e923054212a2748094829148528967b57ff3e53ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_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.6-cp314-cp314-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 db0cfe6665e2654f04ae21b0915708129fc686201fc5dcc0cdc4d64152f9117c
MD5 1be69897cef131e4c29f19b6ca12af40
BLAKE2b-256 5d153bddb89206d33d2c3e50241d92a9d567f84165885c441807806eb1340ee2

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-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.6-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 60b177bb90a3b7b828b5d42973f9b19e12a41c0b936571d0e128d6c5fcc58fec
MD5 152a5c51b344000a0fde8464253cf90d
BLAKE2b-256 a48ba279691b87cafc8f3f18216f37801b70d765172a77b1d92bdc90ac93d404

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-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.6-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 2768ad865c3e03293403c6a209213ecf5cc1bb9dff9d07b7942723a5783b85ac
MD5 6d66944f2dcb4f9a246c36cb212f7c91
BLAKE2b-256 a9d84063e28dddc6b5d299071f385d28e67520a4bfbf2c23d24b219a17165076

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_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.6-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 fa88a766ddecfed8549e417696b7a0eea374bed6dcff9aa43ad4f7fe36ec5c81
MD5 1e585aada6c07f1c926a447e83196c7f
BLAKE2b-256 192477375fed678c9045c2ea6052b1e29df44721c1b9b5c2d0344382540a8e63

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-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.6-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3a16fea8fc9e2063ad412924bff0319620c955b0dabeb044baeb9195edd13f8e
MD5 4a5362a17fd8634453370f54db0aa45e
BLAKE2b-256 21638e472ec2580895fdc2418efd5c47e6dd106074a61fcec0e5eeff14c4a6a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-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.6-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 b484bd49988a347cff101de38918bbb74205c071586389083d8edcbff076a4ba
MD5 2efa8301ed5a7bd7f4ba815322413dcb
BLAKE2b-256 707ba951c2304572c5717ec29a19e79be72227fcf9b26c7f1a88e18da2f6a68a

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_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.6-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 646da224466bd6b72387208be4ff40281a71e68de39e7c01ad45079d3a5ca085
MD5 7e80364668513c88ef06ba2b73d73b57
BLAKE2b-256 18794b824a4a01041407df7fec877a96a61a22e593a9c7e2e93c68517a840512

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-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.6-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e84eaa8fc382fb861b26191355104f52c2dccbed14948a3e7da64d6cda9262d2
MD5 26f369b5ae339e5b0c9cd95091a52e2e
BLAKE2b-256 bfe2bbd1883e11df1ce9c9d03661ff3a26390016c63bc62fd9694d8f345762d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-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.6-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 a03d9abaf55c5ba0536b9e0513d0aff130531e8d7df19edef02bf8db867ff416
MD5 a4111063d37b9a4a1bee54243293629d
BLAKE2b-256 e8028720f954461743211f302b611ede9743c5fa6fb77bdab804e509aca6c6f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_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.6-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 e0c11ab1f97c1363e3af4ed0da35020d282c0ec0b2faa9f15cd348533209e877
MD5 9fc8a9941ebe23922d55cde4eaa4ea11
BLAKE2b-256 60d81d95f0c0af59b3418642fbaf8e7fee2286971edb1560b4f3bafe97893679

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-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.6-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 400329ded083361c5a253c3bc440a6b2f35b55bec93faeaff59a5ae52db1d7e7
MD5 f8f63c75aca1ba85f6fc83f7494027a4
BLAKE2b-256 b9c43def6d4b237c715495a7ebbd14f04e35739b8a22ca5edd4d2fb35b2f97a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-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.6-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 dd851adac36d9087ccb3813064518a9f4e1d05e1bb3cf52b61eeffeb5138ba43
MD5 3fded05fa3cd7322146cd9229e7f82e8
BLAKE2b-256 32bcb2ea615f5dadad528929255e09bc9c5ae5046973203689676bdf937be9e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_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.6-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.6-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 0f2ab5c11cf9e32e72621d221ecf86b826cc742749aec4ea8f883d2d7810fa1f
MD5 9a3ad6fec31c6da95f447068c9e713fa
BLAKE2b-256 202457dd5dcd695c89faec70a37bd7a2024c89fdedf34818165c27cc82aeb120

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.6-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