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.1.tar.gz (208.6 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.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (921.2 kB view details)

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

exact_tests-0.3.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (853.4 kB view details)

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

exact_tests-0.3.1-cp314-cp314-macosx_10_15_universal2.whl (443.3 kB view details)

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

exact_tests-0.3.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (923.7 kB view details)

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

exact_tests-0.3.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (853.4 kB view details)

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

exact_tests-0.3.1-cp313-cp313-macosx_10_13_universal2.whl (440.5 kB view details)

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

exact_tests-0.3.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (927.2 kB view details)

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

exact_tests-0.3.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (858.1 kB view details)

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

exact_tests-0.3.1-cp312-cp312-macosx_10_13_universal2.whl (441.4 kB view details)

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

exact_tests-0.3.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (916.2 kB view details)

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

exact_tests-0.3.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (849.2 kB view details)

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

exact_tests-0.3.1-cp311-cp311-macosx_10_9_universal2.whl (440.4 kB view details)

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

exact_tests-0.3.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (897.2 kB view details)

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

exact_tests-0.3.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (829.7 kB view details)

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

exact_tests-0.3.1-cp310-cp310-macosx_10_9_universal2.whl (440.5 kB view details)

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

File details

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

File metadata

  • Download URL: exact_tests-0.3.1.tar.gz
  • Upload date:
  • Size: 208.6 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.1.tar.gz
Algorithm Hash digest
SHA256 10830889d7c4fe27ec2b15dabd16ac4f53c56fbf64fb63e82cfc5327207f4c2e
MD5 b3f928e5373895b2bbed23eecc247bdc
BLAKE2b-256 802a22729705ceb21dc336e78009afa15b714f85acac3831b9591304af228865

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.1.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.1-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.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 12517f635edd51691dfc0052de899402145082fe26474e2bf483452ffbea89e2
MD5 7b1769c38c431662749e065c82c092bb
BLAKE2b-256 faf3dbf66dddd5c7b3c1053f35397603657f7dd4ace875956829a4f2986300c9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 fc396dd5f3856e5125130bf590a6332bbead73b8a1bd7f14de108e694c10059b
MD5 02005401b2135a79a993881d2cb8f362
BLAKE2b-256 13d5a97fa12a07f510e9b5b6be6080da6faff8be93197af26533efb9ec3de267

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.1-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 1da10f2a96734f11f4671dc55d8442a1eeb5f5a4290f174d8a5764850272e594
MD5 a5357d044640a73a67b81817901201f5
BLAKE2b-256 b78762f25afe6afe6a2d54d43a066df2c34a4bf24011aaa26be0e5206ce171b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.1-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.1-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.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6e0a486b0fcd29b0df3f76186da7e768b01b4d9e7429d292394d5934dd5301d7
MD5 279b5e4050b9de382b92eb3df147e7cf
BLAKE2b-256 27705e7910bc5935d2ee9f9e6252ffa754ad1476a05000e8835ff5ab861c09cf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f82505c57b2eb841fae11db16d234c4dc716985d9ba6f967631d958383ab35c1
MD5 9344ffa1ff3328ba14a84e41d59cabd1
BLAKE2b-256 ae199e47028e1f3ae0971ecfd2d94f43f66d6a7eb46b62a2afc8a376d7d6b453

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.1-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 04aed30bf7ed5bfccc94a1c4b1267d4d05c75364a577f34ce81c84b103312666
MD5 14c17c3603f6057f3022ff1b7de58053
BLAKE2b-256 db65b54f95f340c614c52e474cf78c1efb603300df9f3fed75f4de6f99047c1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.1-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.1-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.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c0049ae0e660052d59edde372e9c831c09f2c80b12eb1d6960eed1d0a4582bb4
MD5 632155a3468e68091dfef8053e23ffea
BLAKE2b-256 e49b8622925ea854687518e9bf9ae7afe6c6d1025e9e77c6e93946c6fc96d967

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 df3f1d551bbd27b14780f8f92a354501f330e36d53603455c1dde26368ed7130
MD5 75f3d6eafbca9ed19df4b02ea556c015
BLAKE2b-256 7b9dd4e75ee0e08a052960ea19ae55bddebc1002869711ab65b1f4bcab504ab1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.1-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 45dee836710992e3c6bc0004b273a9458abeb3c9f192a439b95bb58da808f8fd
MD5 77d243cd87744b803cbe56e721c9b4bd
BLAKE2b-256 ad69625580550fe625392b766fb0e5e85ab63cce0342931aa0a09f220c44c3ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.1-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.1-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.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 237e5cfd1e039871eb50885fdd3493445903f9f3bb5cd14729bbfbcae413ec7e
MD5 e6e856c59f286bfab8bc77708a9a3199
BLAKE2b-256 0321205884fee1a20e0c27967b1c4d4eae3b3c9aa813ae4d3c6d80b9c08376fe

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b85404a751dc5b560595b3d387b575a070aacf60ee0ceb5359e49011d014e03e
MD5 f7348b309b2902d91acc3bdb504aa8fe
BLAKE2b-256 7ba4477389ed87f1cf204e079a2351774aa3690d67a1b858781dba2f4533f75e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ff5747d5cb1aa3aa8acbc39f83462ce8f05c48b52d69edd4ac733c43cfc1bfcd
MD5 49810be358ab4f2f904ce5a726bc6181
BLAKE2b-256 67960b5f7cc992a8a1377c2a4ea25bc530344abd980262cda5802bc4389b10cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.1-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.1-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.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f5edffbeeef9015654bed5987132c6f0bba725c02fcc06aeaa5a6d9b5e7be44e
MD5 7078d17f8426f200aba215314c1b83ed
BLAKE2b-256 4f6c7b8e1cb2ec011b8ce7e681a5dffcde71ab077ea3d9627b840e02fb1350e2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b4d128b3a64edc8b054284e0525ce3f14a9492e9caccb1d19cf3a19dfe94bb53
MD5 2212732e756ef0d7078011818cd74133
BLAKE2b-256 c54ba77323047471ed28f6aafe023730bdb2be2e3cab418cc48afcac70c4affb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 152c87c378408726bc4664c1467055937f3b7f5e98e4a1a87e33bd35e729f539
MD5 f09d008e87e53d6c0604f948784f38ab
BLAKE2b-256 62ad31762c16e295662601f5a1affecae32cf082de99ddd62817b7be39ae3b1a

See more details on using hashes here.

Provenance

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