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.4.tar.gz (245.1 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.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.3 MB view details)

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

exact_tests-0.4.4-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.4-cp314-cp314-macosx_10_15_universal2.whl (531.2 kB view details)

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

exact_tests-0.4.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.3 MB view details)

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

exact_tests-0.4.4-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.4-cp313-cp313-macosx_10_13_universal2.whl (527.4 kB view details)

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

exact_tests-0.4.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.3 MB view details)

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

exact_tests-0.4.4-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.4-cp312-cp312-macosx_10_13_universal2.whl (528.2 kB view details)

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

exact_tests-0.4.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.3 MB view details)

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

exact_tests-0.4.4-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.4-cp311-cp311-macosx_10_9_universal2.whl (525.2 kB view details)

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

exact_tests-0.4.4-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.4-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.4-cp310-cp310-macosx_10_9_universal2.whl (525.4 kB view details)

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

File details

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

File metadata

  • Download URL: exact_tests-0.4.4.tar.gz
  • Upload date:
  • Size: 245.1 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.4.tar.gz
Algorithm Hash digest
SHA256 799af05bf87ccad67250dd6bcdbd8f493687945de8739b15d947edb351b7daee
MD5 8598ab06b3e948b3a07a9154cf8666fc
BLAKE2b-256 694eb88cb806c5b1ef047fa9a0c34abe376f5fb1fc55e03b5f3d8fb131f44163

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.4.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.4-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.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f85d4b4a8f56e404fd2d1025b8337b4665352e97c7e8167d362c811a24dc27c6
MD5 950ba1bbfedb4dd7ba113ea35c8b72e6
BLAKE2b-256 db08d5d2c9f18473e78b3155fc19b75732d25b53a023f83c64aabe201d7a52c7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0222b145397ff51cfa974b6f15f8c5e74addf2ccb25fa12429448dd415278329
MD5 68d706050a46858246a2e3f0ee188f5b
BLAKE2b-256 8dc64115c8441a04cfecafccfa4639e6dd9bb18fadd25e0f3b0dfe8686502687

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.4-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 82d6e44556be3634166c99f053ff4bb2baeee611096d0584050992c96818e3ce
MD5 7ad6a6659a95d11ba44076eb4b1a4e2e
BLAKE2b-256 67b8ce614d9e775b1271232200c2f11b8aa888bba8129310f74510cef4555c1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.4-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.4-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.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 edd14601a36357e57c713cced04e1bd0f33ceb344ea7945a9376b0097225b697
MD5 0108a4fd2d7c2d7ed73ccb3151d2de4e
BLAKE2b-256 c2cd4325988590e0233bce9d7c7aff7f1916f305a169734d9e603357b3d0e99d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 aff4a295f6003d656c97f15dfed605bdb972ff0b77ff8767a3db3d709b5ceefa
MD5 38c6ca1b44790a26fe40705871be51dc
BLAKE2b-256 793ef2edc8bdd16bd876c90264e318b710f5b412b7a17efa1aa2d323a050b732

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.4-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 12bc2f901278f0707fb52e4f9fc10229ccf95ff3b0380842cd31a00f85a085de
MD5 02789aca31ddb7799930e8058c9cd8e0
BLAKE2b-256 454ecc9dcdb552b3567e37dc437d72b4f5d742d93c5c8449eebdf007befa34db

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.4-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.4-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.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 71c0f759c8ffe7d20db85a8f3c3ede09330c3376be072ac475d17ba839687c55
MD5 9b9587968918f3b28fd69fa5eaa241c5
BLAKE2b-256 adc5f158c16023ddc36b99c2314c0c7570e7f28410947445b636507abf629e32

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 97ae365cf7dd44e7aff241b55610619526074cf2d5a134077dea7a4b1bea42b8
MD5 0f6c5bf31629212a16ee50b95ea60506
BLAKE2b-256 d00bfc46a9ad0fe425766c6a27c6e0e5547f6a3340774d1416188cfcb9a77b9e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.4-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 be082238f8bc065aa69acef7fab5a8e656bde17e1a63c5d445bc26d1d3d051a5
MD5 4cc71b0d95705385455e50ad0313069f
BLAKE2b-256 943f9c8f3310b230fffb99e345638ba34968dbae3d159bf7028ac07a27bc55fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.4-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.4-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.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a7727921b7456498851ee7ff420e7609688b8cbf7ea8bc61af7f076fc89f1b93
MD5 bff3595f450ec59d820a5b83f68c1685
BLAKE2b-256 8c647e46c8f8a28abf11fdb5f5f371cc689bad3f3152cc05b5d45a7c80ef9949

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7747d023c54e11b5f089ff06502201dfc201251b8b8d202d5ca38f0c862ced78
MD5 d88c838596836cc7b0b59bdc5bc2d981
BLAKE2b-256 ebb47aa3492e35eb660c11945b5e3935789f92cdb3a305fb4790c216680ddc8e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.4-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 95282a1133da96e84188951932efcd2054d677d63dcd17ff8c636252ce825b47
MD5 0f2bd1201cdf179083378b85bd55712f
BLAKE2b-256 49bcaffffab50f02b065a464ed14cbde32f396fbca2ff8802ba2efca5c8ec6a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.4-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.4-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.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3666a29c9de23eb1bbb9dbf98cc5ad5add268088e1ce666bcbfbba01c08a6c9c
MD5 afafee4c75bb3bb4e153c671579796bd
BLAKE2b-256 71627ec977e9b8359ba7a31a1852faae67c6d8e9bfb0e4413b6364ac3d3a7c36

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3fe202b817f95c29d21581ea06f1d7834bfd53c7440f3716fcd401437f6f800c
MD5 291e451864c3c9aa2cf131c7e5188ecd
BLAKE2b-256 9886b4438d87545b9fa2267ebc3bf38f8cdb6d8e3bc7e76ed5f6979410adb315

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.4-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 69983e302d24f625829b34d8e8affacd0409e3dae105866463f44629a7457b93
MD5 5604d8efc7364d879519f0cc0ea8b39f
BLAKE2b-256 8676e3cd223673d919aba1d8f720d201fbc8e78e957a82e547f5b6ad346d806b

See more details on using hashes here.

Provenance

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