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 functions. (Only binomial test and 2x2 and 2x3 FET implemented right now; the rest is coming soon.) 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.3.3.tar.gz (218.8 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.3.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

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

exact_tests-0.3.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (902.7 kB view details)

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

exact_tests-0.3.3-cp314-cp314-macosx_10_15_universal2.whl (466.4 kB view details)

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

exact_tests-0.3.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

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

exact_tests-0.3.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (903.3 kB view details)

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

exact_tests-0.3.3-cp313-cp313-macosx_10_13_universal2.whl (463.5 kB view details)

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

exact_tests-0.3.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

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

exact_tests-0.3.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (905.8 kB view details)

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

exact_tests-0.3.3-cp312-cp312-macosx_10_13_universal2.whl (464.2 kB view details)

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

exact_tests-0.3.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (998.3 kB view details)

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

exact_tests-0.3.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (896.9 kB view details)

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

exact_tests-0.3.3-cp311-cp311-macosx_10_9_universal2.whl (463.3 kB view details)

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

exact_tests-0.3.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (980.9 kB view details)

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

exact_tests-0.3.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (876.6 kB view details)

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

exact_tests-0.3.3-cp310-cp310-macosx_10_9_universal2.whl (463.3 kB view details)

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

File details

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

File metadata

  • Download URL: exact_tests-0.3.3.tar.gz
  • Upload date:
  • Size: 218.8 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.3.3.tar.gz
Algorithm Hash digest
SHA256 2403c456a1f3dc8842ac30c0ecc7e8d776784ef01ad4325773c7aec3d77feaae
MD5 05447000cd7ef26cd66f8ae8750ffb88
BLAKE2b-256 f80878ff70ffc3b81ecf07401a414c4b1a2772a0d2c184f93a856f62d284c958

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.3.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.3.3-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.3.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 de584da9f08d306f14ddad253543b3509ae6541e2038a7d8ff349b9663200ce9
MD5 d8c6b204edc6ad6b7a3023600208146a
BLAKE2b-256 0af2e4a94903493a302083d9bacb91efbb537db175dc86a3afeef8ac349eb75a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 758626271e24e54447ebe30ac82519c1ad5430a34bbb662e55f463d4f3ec29ff
MD5 8a6ad20082158ac406478a7f9d19fe4e
BLAKE2b-256 87e0b59abd30f1730de231453450777479f14a2834c684be5d6d45cd438c7710

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.3-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 094e59c6b5542fe7aeccb27186b3f635a3d8851304a66919f9041131463a2fef
MD5 6019656cda6825bf85825f553a92008c
BLAKE2b-256 37175ccd739042b95aab33abb53a16818d394652e35bb26247ba042ea7732ef9

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.3-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.3.3-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.3.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3c19c95f9f974a7edb6096cfff7b5f4394da64a5fcb2eaf5fb0f2e89ade3de88
MD5 25a31c2ee426e6eb520c3815f878193d
BLAKE2b-256 d3b607a39efa3fbb782fd22d2ff9bbc6707115d4821e2faf9466df9bc5264178

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9390982ac94532cb11c4d113be1c7de8cd057c45a94738590ea94a6bcec445fc
MD5 1bd86d28177de8d1604fbfadb462dea0
BLAKE2b-256 96acab3b1ad3814c3107260b248f98b8718dcbe289bb72430a78210f858c92c6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.3-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 7c00294d05a9eb32e00fb2850440184e69f53d36aeb9f451ae21ee5ac37baa85
MD5 7c2cd9cbe4adca032b3664fa3715cfc1
BLAKE2b-256 7548739c579edae11fb60968961802b38e191584ca63b8c1dfd95bc67079361e

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.3-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.3.3-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.3.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f9e2823eb4a492ac259e8399d8a61d0a32a03be36ae11de13ddc03cac37c99a0
MD5 721b392f7a23c2aef9af2081ca20c42b
BLAKE2b-256 6a4e5441064bbbdebc252053a584ff39beeeee4d8584139873fab616075c8218

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 09b293988c97071b05e9f1d3e6eab631f19c002c6f56c27c59122a5c88125458
MD5 64cca4d5a6667996b3ea767e82415b5a
BLAKE2b-256 d5fb6854160aa99229fe27d99e877de31b776c72c751c6450bc939c306e611e3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.3-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 61054680093e58d2868fa7cd43654d96744606fec3bd693abce916bcd4292da0
MD5 4739f928009ad7b58f7c382169b47476
BLAKE2b-256 8832be855cb619f14e0b4f2579074246e54e0b9b17b59b7b802a63d497845840

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.3-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.3.3-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.3.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0516272d972af2cfda76ff4419a143ee2cac0397721cd717d20733dbed08dea4
MD5 cce1dce441a01e98cc414915b7d2d83f
BLAKE2b-256 8241171d5043233fd1f015c765a7c1a00571ee0248f0a2bab52d0c953dab3beb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8ddb3baeb32a0c21979b455a72d490a6b57e48779e1f7417d0af995adedf4582
MD5 b47ccb45210e9a9992af16455b1d5f1f
BLAKE2b-256 f7632eb776c08bf80240c6ed2eaa0ae3f4e20f883b63c3bd60416755363f86e6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.3-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 56f8198103b73ba4f5d17143de327e84124b20ab5b7f48aa7b083805c670184a
MD5 6dc8ddfaaafb293ec41af4c4618cb597
BLAKE2b-256 c7e1c5195295a762c2518032f0e9b1ff5728cc7e45c009637f127219cb1e0d92

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.3-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.3.3-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.3.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a619c304a4f3f987a0287d50318231617f3275851f9890687063b5ab4158759b
MD5 c1343f1daf62e99f751b129826e47da2
BLAKE2b-256 938bf117e66e25c3a1fd9ab1d26c268f1b5b1f6fe4f74d6bfd121977a0809d8e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 afcdf4dd4096674b325a99a15b4be67b27016aecabeab38ed4064918ac040e04
MD5 229cad20badb2c97431073dc50121088
BLAKE2b-256 14777fe8e7dce1bda23880f4683f304fac18f6beab4225c817187758e15f37b8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.3-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 794c602f2cb7132a4de3816abe4f42dc1e1a16f311c948814a69d0ab4d6f9eb9
MD5 92667cf7ee868ecd4e8222a23621d3ba
BLAKE2b-256 56c906afd22a429328c637b417483d0ab739b865a697489db475fab7ccdeb428

See more details on using hashes here.

Provenance

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