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.5.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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5.tar.gz.

File metadata

  • Download URL: exact_tests-0.4.5.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.5.tar.gz
Algorithm Hash digest
SHA256 9440fc233b9966d0f22286b0eca7aab760f93b2f17f58fca46bb003dd51d0763
MD5 3cfe2ad1166dd030f41f752a2795c224
BLAKE2b-256 338e8d4800a1664d4b126086cfc9bec6c89f586e0dccec3b9147583dc5f30819

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.5-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 63a032131fbe5a6a0350a542321f58223a83a510eb143bab51aef966185dbd79
MD5 f0c06abf11b3056cf1b0322e3a50d601
BLAKE2b-256 bc016aeade2dd9dec6abcc0ca89586fd05565be726502cb96d9c683214a6d804

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.5-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.5-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.5-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 b92a989546371f87d854d3692dda129e72b40ca2d7ce34cfab565a2e226a9268
MD5 3cda51afcdeb7111e05d9882a4bf40fe
BLAKE2b-256 5efb63a409dd8b4aff4c0a778527c056182567b9d0e0c64fee1edc50ea972137

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.5-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 f3ad63ce2905a6f5347374c5b7bdaaa2b0260f55b7c21a798eccd96efa194151
MD5 6ed88e7af4b5834f3756c524528da2eb
BLAKE2b-256 4fbacb9655df3e204b6405d0d20179768f6ce19df4168b85dab7b330c4d0444f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.5-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 54a4ed7e81c0c93b8ab8d5368ab6aaa88875f05729eb408ebf3d2a40791f6783
MD5 b93c864006b9e7ed80a8e26bc0cc009b
BLAKE2b-256 1bb6cfaf5c8ea4a51136c8aa8ab3a562b7c5751de917b4b40d9e8b1ab6aa262d

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.5-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.5-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.5-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 1fc8771302306fa305bae1b0aeb20994c35c979372c5872cdc6c1093a24b1dfb
MD5 0efd307e282218c8d8fe92ed4bfc0186
BLAKE2b-256 cf159dc88a8209e8521aff22b66934f17b5a5a7c540b939e4c9a60b0feb55639

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.5-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 b7dcbecbc7e9a50231dd699f88c54fa02f4b67c55fd056bbf28d16030c53250c
MD5 19dd9b60fb1b7d566cc4d03e3e37f641
BLAKE2b-256 3385890d6b7121af283f14e715b851a71215baf0a3e9b3ca903669a544aa0204

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.5-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 36358b069b83cbccb80e86dca8ebf8380a560f6a079d14b764513185933ff2b0
MD5 0a4def353d54c7a05de307ec610ce043
BLAKE2b-256 62ff8f9c173d6866e3f106e7b3e00b19f71c85265817e145a08177e280157f74

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.5-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.5-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.5-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 f24c5dd653bf503aa2fe71c92e6077cfe96eb0f50d92251cac84b5f8d987c573
MD5 4aba33dd6b977d94a472e6d9318d1ff5
BLAKE2b-256 40661467be31bf9ce60e877ca65e629c59403ddac8ed6ac54dcd383db90aa917

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.5-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 b3dbb382db3cec85c815e123efd2a9f6dd7b73c835801ae088cf96de46db6752
MD5 4d867d2f8921596f3f95c55a8fb16987
BLAKE2b-256 0d8b7c91319fa3e8986a9ce94545ca921d34432c8e8386798a7f5d553589359e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.5-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9dec931083d36f205ef0dfc4cfac2cf684cd87ee34a11132b2bf9a71d59e89c1
MD5 2a9061ab4d4bf0d1cc50516d4727d58f
BLAKE2b-256 24c4140813a50f1da2498a11dc88049123ab9d2b54b31a54959e30aaa1de29d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.5-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.5-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.5-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 e17b91ff622891707080b4b3a59d1268b64d87386b468965500b62f2932f0583
MD5 ee86af16a2c44ac9f7c86ab8569eb223
BLAKE2b-256 99bba59cf406d8a43ffef64072257eb2154185e7a3fe34d68502024a07aa9c9c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.5-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 d05761b3636ab5e4c89471598aa4558c918fead6957337a5c173d1e8eddc6b50
MD5 93419bfc973b68ebd73f6b895970fe6c
BLAKE2b-256 64df9411aef532b7ed75d3131ccff552cdaa7b2b2e19268d22928f1cb4da809b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.5-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9e11f982604575e700bfdef7dca4536fe52185f068a7c23ad57f0ee9871a9efc
MD5 96f20a5f3be10d3e32d55ae7ee0f3407
BLAKE2b-256 61766fdc4a0d7217f117bd86e39cb88302ac494a1ad0f9d00df42756ed2a67ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.5-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.5-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.5-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 c075d3e4a9ca535aff033890d0d68f82e8ba1632cc0242d64638ff3d48407a9a
MD5 69e929299ee61907c60d77f9aedf618b
BLAKE2b-256 5ccaa507326d88eb92da03d2172a469dd205feb2f877ff009022fec1d3b59499

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.5-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c544b0b6ab4cef67a8c3058833351c71d15088519c07822671d2d68c762e1016
MD5 d9c9bd6d90e104c7d23ae04ba5f152e1
BLAKE2b-256 00d2602086e3a2d6106783c12170c5011790af2a0de05119869061f984b7afe9

See more details on using hashes here.

Provenance

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