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.2.tar.gz (242.3 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.2-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.2-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.2-cp314-cp314-macosx_10_15_universal2.whl (522.3 kB view details)

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

exact_tests-0.4.2-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.2-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.2-cp313-cp313-macosx_10_13_universal2.whl (518.7 kB view details)

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

exact_tests-0.4.2-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.2-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.2-cp312-cp312-macosx_10_13_universal2.whl (519.4 kB view details)

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

exact_tests-0.4.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

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

exact_tests-0.4.2-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.2-cp311-cp311-macosx_10_9_universal2.whl (516.2 kB view details)

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

exact_tests-0.4.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

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

exact_tests-0.4.2-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.2-cp310-cp310-macosx_10_9_universal2.whl (516.4 kB view details)

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

File details

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

File metadata

  • Download URL: exact_tests-0.4.2.tar.gz
  • Upload date:
  • Size: 242.3 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.2.tar.gz
Algorithm Hash digest
SHA256 6c60a626f8cb86455789461c2e8743fa60d6d5e548258a1c0cf8ee92d5994f4b
MD5 40931b8fa58cb896b253cb15f6158700
BLAKE2b-256 7b5a4872808eced9df8960d48909bf773a7a03fecb187adbe3d645430e93497e

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.2.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.2-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.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 351abf829fe79abc5fda99894bffbbed86c1ff7325057bcef3f2579b42c1173b
MD5 6b7d3d7cf98bc38410e668ff6029fe0d
BLAKE2b-256 0b0de839a8e0ac0b724a70e1fb6bbfe4470630ab3dee4fe834ea5a73a46d659c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0790c3295ad4f401d61aa7a7117d06e54076824003771b7f9c78c68d9bd910e8
MD5 63c9839738b3db14967964d684ee8c32
BLAKE2b-256 7f0d35d87a48c9df2891abc09ef4b510ce57206206f9685086b65ed37e97062c

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.2-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.2-cp314-cp314-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.2-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 5ebfb7a3c4cd1fbe451f650eea18dd14d7f4851f8c34b3d1b473f91519ba1777
MD5 fb9c8739041abfcfeb80d2bee462deb4
BLAKE2b-256 02a8015ec3419f582b56fb2b129608e55624f269c3b9908299d26840728d8a5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.2-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.2-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.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2ef71c9c2a2b2b7ca4fb7ab4b51250cdbe8f972f8d6066bfca6cac893f3d39a9
MD5 23f1c8b5a7b685715048f063dc11e527
BLAKE2b-256 6d30cad2abaf767a3e8009cc99c3e8d0f8f068a2e707ed67f03d8a10b60f5fd2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 433abe7b14e779a072ed966a3ee7f5cae7982e6819692e70a4c53d62d31b635d
MD5 a8c6b6a3462cefc7180232dd8c679d50
BLAKE2b-256 100da153fc38e628326d1ffaffb4fe5f70193647fcefc83a1dc2c95af367372a

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.2-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.2-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.2-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 36c201e70411837fee27ff275c4e1fcc44c0d8f68dc8a3bd041fd0cc32ad5559
MD5 003bdf7f5bba6257496391b1258e0931
BLAKE2b-256 c9a2172953a7e245e571731bd1845948eca427919576088acb9e9e7e6bb010ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.2-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.2-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.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 89ea77fee810077cbfa9c1bb83e2b8fd5710f3e1837af0c549c4b98ce05ec6cb
MD5 d3a8aa14dcba43dd2c84c1263d7735d4
BLAKE2b-256 42e5d1e470392bf9e9d64c99cd151f471bde41087009282983bf9cacb2b8f719

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dfe2651d766f6dace2298b23fe394f4fd989d148b9d15794551bb16be83a8b05
MD5 ef551a560ec853e210cf81a35ec44e20
BLAKE2b-256 eb506acd9d1cf6a20b126e5bd6b8ec25b6c4c46ea468cd10e203dda5e02e4709

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.2-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.2-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.2-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 60f3cb2c6ab8b6d69d91d06d02469ddeec7fa38db30500a7940f9b11be5b2d5e
MD5 f3f198d1cd94563289ea97dda860aaab
BLAKE2b-256 5b165ef1005dc8bfc39e490d8d685fcd1457a28e775afdc672051e9d94559791

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.2-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.2-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.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 029e73f9531e040560b9b6e4dc5284631cf55484353ffc43b07cbbda8896aad9
MD5 c30aaa1c65cf33a747163c93c04bbf31
BLAKE2b-256 d9cad0e44ffc9858e667fcbcea9b670b4dbf430b20b6255f07478768d95c98d3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0d3be722e523ca4fad00e954b417298d384fb949ac0562d3554ddb8e4a1e91bf
MD5 01c263405121f45ebec5627c984a908d
BLAKE2b-256 b24c1096aed33273bd17abd3cf93d194177d70c3f82a4bcc09a698c404186867

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.2-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.2-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6f2900dd13b3c5d5eac34d6fc5a880f6679758ec1a97a315fbd13a0f03eb4328
MD5 73242158100a07d95289fab8284cbd15
BLAKE2b-256 96d2e7896183e73cbf6a9683f1211139611468b15ae66f843e1b2d89cfde8380

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.2-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.2-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.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a8a80d5198239cb05385deeaf5ae12513908fc4e02c657583b08076fbcf7f393
MD5 1722c0aa16c896fb3536c3435208dd34
BLAKE2b-256 5e0da8e38ab22c45a85966345699ba26283a0e8a5591a3c1217b09226a1479b6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1d7779ac608dec03ec05ef64b0b29b3701371525ed7113591484e48d6c941fdf
MD5 406f839e36e822f06edf7c34908da7fc
BLAKE2b-256 b4436e3eb4903afe2c413972da8cf5eae0d956c28902d9accca1cd4f8b1e7f10

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.2-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.2-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for exact_tests-0.4.2-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 b4af6cad7951353478d3f65410c264277dd69a513d701f6e55d070c9710272e6
MD5 dbd26c8808fd28bb8365afa69beb5d7d
BLAKE2b-256 e728c2a1a55f324f2c71d9ee7422c503df95371246d56285cdaa6caedefecd50

See more details on using hashes here.

Provenance

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