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.0.tar.gz (202.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.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (905.4 kB view details)

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

exact_tests-0.3.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (842.6 kB view details)

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

exact_tests-0.3.0-cp314-cp314-macosx_10_15_universal2.whl (434.3 kB view details)

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

exact_tests-0.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (907.7 kB view details)

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

exact_tests-0.3.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (842.7 kB view details)

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

exact_tests-0.3.0-cp313-cp313-macosx_10_13_universal2.whl (432.2 kB view details)

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

exact_tests-0.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (914.8 kB view details)

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

exact_tests-0.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (847.1 kB view details)

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

exact_tests-0.3.0-cp312-cp312-macosx_10_13_universal2.whl (432.8 kB view details)

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

exact_tests-0.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (901.4 kB view details)

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

exact_tests-0.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (836.2 kB view details)

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

exact_tests-0.3.0-cp311-cp311-macosx_10_9_universal2.whl (432.4 kB view details)

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

exact_tests-0.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (880.0 kB view details)

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

exact_tests-0.3.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (815.7 kB view details)

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

exact_tests-0.3.0-cp310-cp310-macosx_10_9_universal2.whl (432.4 kB view details)

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

File details

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

File metadata

  • Download URL: exact_tests-0.3.0.tar.gz
  • Upload date:
  • Size: 202.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.3.0.tar.gz
Algorithm Hash digest
SHA256 cf86b68fcf08b8d66dbeb3c769acf07fda1892707de08dd37ca04f5c1884aaad
MD5 0b00b406b87ffdc6ae738f27053ca8a1
BLAKE2b-256 429eb85deac027f87dc6087bea295dfb88da88c1b9b3aa51ba1781f3a75451d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.0.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.0-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.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 536fbf3a3a7872a5b9f041ca2ce280a9caf7bec481239653b60d837563eea35d
MD5 3edf6b4305ca1e5779adda275c6be954
BLAKE2b-256 2a973d8a0498515d7ed3b5fdb9673623031f5870b2047d3df106a39fda1c39ab

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 52e7da54b69e42c55d5e81361eb043166b520766f28e5290a5998747aae76e08
MD5 10a07a3b58d4151c29474ab371f5bed7
BLAKE2b-256 b75617b01f063ada0439253abc5f626623a1ba9e0947c1cd1fa1a5337993ca35

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.0-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 7e9ec328e2d39dbddd153752c424bd837e26cb3c84043ba3cff58e48c376fb4a
MD5 6faa197794767952d1eeeb15e6543f23
BLAKE2b-256 6da93429893d91cf8d5bd63b45d712e864bee80bc9801e363903657070826603

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.0-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.0-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.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3da9ab4b9514c78ff0487ab4a0e839713f876cbd3cda9a353c7f80db5df73a49
MD5 9090758603839d03486ceda035ed937c
BLAKE2b-256 124d313ea1ce33f238acfda4001e5d0d33899cdb11692f3804509aa1dc3b6f17

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 176ce810323075eb79f4f3d8074270e94a70fc7de542844713a8ca82984589d1
MD5 302b99d2eaf67c81e86b6193286077e6
BLAKE2b-256 0ad7d555817da05cc3bd4b17a85c0fe8192e91de4a86ded499be40b8f228c2a9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.0-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 d6274b52e0114f71747f7dfcccb2e02664c522c54a9cefd29bae338eeb436531
MD5 ec8b805eb90fe4fb31e4b359f5c33b3a
BLAKE2b-256 79ed0eab1e7773863f9cd33e5f4564bb2b1ed6d30670cd6ebddc109c7007a188

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.0-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.0-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.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 86f7eb963b751457b813943b5833589bd500f22aa2aa7d622868a9394c1b736a
MD5 db36624b7d77a595d8a6480ff3a5d9b7
BLAKE2b-256 1cbfa8aeaa596c44c8e9479d4a9e4e94cbc27122b59c393cedd1cf3e221735b9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ee668944887dcea4bf6aa343e23d4edc66445b56442dfd2af0dbdeff4e06b3e6
MD5 d7a74e3516d85c4d08247aa0c9762755
BLAKE2b-256 24ecdf2054b03cf52743269a3f939c0207f7f897f5e646a14fc59fecaf236799

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.0-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 276b03b7a2e007b44e19900804b21b0da8bbc8676b266eaa6f81b0cf9a020cf9
MD5 fb84b184cb76bead750b97d7247df175
BLAKE2b-256 c5dadf809b011b13260efcca1be4770ed5735a6018c0ccf234a0c1e1f2354ff0

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.0-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.0-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.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 afefe14bf0f2e41d3d0e5ef5959813ef1a18e88cad3e92b36a0f78a301f96425
MD5 1e42f83a8fc56a7f904046073c3a61c0
BLAKE2b-256 48ea9429fa94ef4e97355f57be57e66be4a7a49951eb978b5835e1a088892316

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e5cea7dd235bcc8aeb17d7290bcfd0cd5b5ad475421591799e7c838cfeb87ac8
MD5 8f1c5357f56b7fbc736820e480e6c723
BLAKE2b-256 2ca0a30699e74859c6a8a1c13207349197693aa6993530579806aa7990bcc126

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 e93dc646683864b2758da0c7337319f17ded67cec6da3cbc2104c6e024375f43
MD5 569d902d1b5b97ce4e1e137fbbf83a45
BLAKE2b-256 db36ff6f55cde57f89c248b58559d9eb1f4158a63282aa4e1a7be4dd9963cba3

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.0-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.0-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.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fb410527d74ba5586354e3a26859bceecadb92c4ad50229a521e8777dd128112
MD5 bce5ca04f6afbd9e568e005961ade4d0
BLAKE2b-256 3772e88cc7d6c615ec52f2ed84dd407e812b23d20cc49acf51ad55db04779185

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 52e3336c279a68f68b36d4f0ad2e5de3826c254583867ea4e3211de3a691a6d8
MD5 cba13e4fb282bdc7ae2d90e8a579ff8f
BLAKE2b-256 6638f4c19c5114f4a3cba2f1ed2d6dac45c90094e210e658ec23a22619ce2901

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 58128bc14964c03ce845f3784a6bd42ff81605ac91ed7d88fdf9c3f054302029
MD5 6e58e1e4d35b9200ec35ab7ec4af31d7
BLAKE2b-256 4e2e856411917ab7767f1a8a6879694a667f483db7ffea85638acf0a707b3e28

See more details on using hashes here.

Provenance

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