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.4.0.tar.gz (227.4 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.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

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

exact_tests-0.4.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (955.9 kB view details)

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

exact_tests-0.4.0-cp314-cp314-macosx_10_15_universal2.whl (487.4 kB view details)

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

exact_tests-0.4.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

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

exact_tests-0.4.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (955.8 kB view details)

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

exact_tests-0.4.0-cp313-cp313-macosx_10_13_universal2.whl (484.6 kB view details)

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

exact_tests-0.4.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

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

exact_tests-0.4.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (960.1 kB view details)

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

exact_tests-0.4.0-cp312-cp312-macosx_10_13_universal2.whl (485.2 kB view details)

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

exact_tests-0.4.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

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

exact_tests-0.4.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (947.6 kB view details)

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

exact_tests-0.4.0-cp311-cp311-macosx_10_9_universal2.whl (483.7 kB view details)

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

exact_tests-0.4.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

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

exact_tests-0.4.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (930.1 kB view details)

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

exact_tests-0.4.0-cp310-cp310-macosx_10_9_universal2.whl (483.9 kB view details)

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

File details

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

File metadata

  • Download URL: exact_tests-0.4.0.tar.gz
  • Upload date:
  • Size: 227.4 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.0.tar.gz
Algorithm Hash digest
SHA256 bcc4c4e98615f13e561f642d3fcfdf412be0ce38721971f88f1d8f85b7bee47f
MD5 b76c8f8f1dbb0c18452b5be5f3de322a
BLAKE2b-256 c8d4145b7cec8591a22d30a047be11829871bb3a1c75ed1ad9aadca158c8fc37

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.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.4.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.4.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 25bcb6c1ef75cf0f80978af11aa383b23e9ccfd5b22324584eeb10d9b6f70c70
MD5 d1d0209043a62a26e669613c3dceae46
BLAKE2b-256 daf4065c74690509a3050fbcf128b46c67ea148e6e22892587d7534667ee4da8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 56cfd5f2a3ca464050a4f4c96fd4e5c34b04d9a1b78f9256f5343ac3aed8a17b
MD5 8a9957fba06120f9cdbc385bdeb5b5ef
BLAKE2b-256 c9fd7c866a9f8c684adbe91aa279218a3260706cba4faa45afef15f348e5ea88

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.0-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 c252e69f195992525b578a4719816a54f47711d15141b65b6f023891e158791f
MD5 7389b75ac3bd6c4e1e0a70e83f735338
BLAKE2b-256 28befdb21b3a2e649335118c3e499534ec434f8f795dafa14cf10bde298658b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.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.4.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.4.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5cab5b04396f43d297db5e25521aa1ef9c9aa319fb28e9fdf48917c8182d9ec0
MD5 67342aff27d39646aa68cf396bba0de0
BLAKE2b-256 bcbd2e41f7ca0664687dd7e9b05efa1e85521d0c0a8d7176a6573ec51527f47b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8283e2d6a56c25f99bd0edc345a35946c7950cae221ed232ac351ec674dba496
MD5 8cd540a5039f323ca5e185df60060903
BLAKE2b-256 3e056afdea482a1a5979708be490537e0e681ae8f37aa64d4c8d93142db9f9e8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.0-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 5f324d90d84ec7c639a7f172a9aa2629b358d7364c138ea299faabf9265a808d
MD5 c7c0b4afea6b731fc0139777a436f310
BLAKE2b-256 c93678b7f60763e071f3cdb19aa4668e5f0b2b16c931d539820488d4c74060cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.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.4.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.4.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e5d9658049ebe7a8773fdeb3b0d7b854917219e14c63df79124baad4ae01dc4e
MD5 5edc547f03d866efbbb22cfd3b8a33aa
BLAKE2b-256 a84338fc41814c591a0bf55324d72d5906ea1c36c3fda805ac4a66c2947bc347

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8d5a469c5dd0753ba7a6c92d1db05162082f1f0a3fd8477307604e902dfac3d7
MD5 be81d452426c9f030d82b8f5ffe6e32d
BLAKE2b-256 a105e4ee418d1072ff045b614cafe5a6367d798d160fee414442aa8c2636c11b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.0-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 8c90bf7d72f2912d9f03b30328676b7ba321cbb5b9f3c4a329c2f52c17d289d8
MD5 d2dd42f8e878503cf4c98a1354934e44
BLAKE2b-256 fefc2745b47c1a9244f119c4cedba4c649a60a4a52cf2b41b42a53f90435b512

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.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.4.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.4.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 70f0807313e0af39a3f8093f6976223d82f3f89a05c100bb7d83b8a77c08c4cf
MD5 aeb6510596fddb91ec0589e00758f4e1
BLAKE2b-256 d480bb555348edae00b1093e12f7aa926740caa72aa23f41a1e55ae5b5d03d92

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 51aae6ff7144e814f4edc2ec023ba4a81f1c31d0a6c1184794d8e59dcf55f592
MD5 4654778dae570688f1ea1d732fd29729
BLAKE2b-256 6fb4e23b2f79d3951aec32297d97fb27a75c35e5b8a1e2f855f1ea16c745b0b4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 8f768bcbfe0b7b5bd240fa961bee279e0b4efc66683029846e264ea4c410215d
MD5 27619914acdef74da21a66beef3770e3
BLAKE2b-256 b95c627a06479a87c143440baf179c4a89f79d0f526fb9f17d9d956ecdf4fb69

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.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.4.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.4.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 917052c60ccbbf7e1029289f051947ddb68ed514964c4581332bf6646f1c9b57
MD5 695e8ab3d05aa28df77cc8384b8d5a03
BLAKE2b-256 95a70343d406e7f5e2f881d33cda6eeac63a8dea2dd1b62f5117c771d8793bdb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6536622f50bec4558a09b3f58f113fe8ed93e38e75bfbee5b12594a3a2d53c4d
MD5 d7a7e9b37de1f17fc26680dab18eec2f
BLAKE2b-256 8e3fcf09c040c393eadcacec7c8fc6116354a954688ab7058d43a6777859a2ca

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 63ba3fb9ce5cab4eb8486314b64051f4c5450fde71cab10cefb9aeac3db70d3b
MD5 cafd171908e334d7790c09ef48eacff7
BLAKE2b-256 75b98cc91a61b327a4fc616898a4c91480549fcdcca374bc942fbac9be765a1c

See more details on using hashes here.

Provenance

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