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.2.tar.gz (212.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.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (924.8 kB view details)

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

exact_tests-0.3.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (859.3 kB view details)

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

exact_tests-0.3.2-cp314-cp314-macosx_10_15_universal2.whl (449.6 kB view details)

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

exact_tests-0.3.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (927.2 kB view details)

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

exact_tests-0.3.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (859.8 kB view details)

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

exact_tests-0.3.2-cp313-cp313-macosx_10_13_universal2.whl (446.9 kB view details)

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

exact_tests-0.3.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (930.3 kB view details)

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

exact_tests-0.3.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (862.7 kB view details)

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

exact_tests-0.3.2-cp312-cp312-macosx_10_13_universal2.whl (447.7 kB view details)

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

exact_tests-0.3.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (921.7 kB view details)

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

exact_tests-0.3.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (854.4 kB view details)

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

exact_tests-0.3.2-cp311-cp311-macosx_10_9_universal2.whl (446.9 kB view details)

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

exact_tests-0.3.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (902.4 kB view details)

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

exact_tests-0.3.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (835.8 kB view details)

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

exact_tests-0.3.2-cp310-cp310-macosx_10_9_universal2.whl (446.9 kB view details)

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

File details

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

File metadata

  • Download URL: exact_tests-0.3.2.tar.gz
  • Upload date:
  • Size: 212.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.2.tar.gz
Algorithm Hash digest
SHA256 71e5745972b102eb1265045adc1e70531c209af9db0f1862819aa3c2e8a411f2
MD5 2a48b65fa377a9b618bf10efbc70861d
BLAKE2b-256 a3cc40e611a1ef6693c2fb1636c92b8ef1a1f44c46d21c7edbfbfba7de44f030

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.2.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.2-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.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1c72b81a4ccb78917ee39167776d5cdda5bdb4722c800f053aa7bbbc4ce4668b
MD5 6ef20afaecbf87e313b2e763d961f7ff
BLAKE2b-256 69b484017891c8deaa8b31f2a6dcd395c6ca3a86520448df95c5258406359573

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 84afed5e1d2aef689ab653ded7d99162e43c61076391e693e2633a5112716cb2
MD5 f3faa7f74b6abea62dc0fe469c47d9a5
BLAKE2b-256 b0e7159600adba7cc96edca48fd352dc03cfa09dcddd32b5621328ad38432a95

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.2-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 5f4c1dfa34c159a4c2c2e9575782a4b017239552b3fdad123e742becb9478527
MD5 c5dc98831d71dec9cd38adc659d042a1
BLAKE2b-256 302e7089021ed642de452d617d014588e37e8dbae640eb8c56943d898149da84

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.2-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.2-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.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a65f26887006f31c893241d007d2932f9adc0745cd2f56e53f59ba5a8326dbbb
MD5 8a688bba968351882bfd50d4a8aca4fb
BLAKE2b-256 6111f71066a71257fd5ae1d70ad6f7cc199f3d48232501338ce91173d3579796

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3b2a9850f13ee93c0fa8f46775be95131f7907ec72f6197551b4bc9776c05902
MD5 4a0e99ecc298b0d21eb92fde01e34999
BLAKE2b-256 bf19da68b3caceb11e8ab7a02d94abce4375b4286e1fe4337170acbef82ef457

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.2-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 c6ae13b232c8697b8995f85847c673a42758ab14e5cf4525cc255e2f271d1de5
MD5 abb6fb5376c51b01ea7b314126532f49
BLAKE2b-256 b5eff852c3a6c10f5d68164677fcdc0e1a4a21f9072fc4a00c8ed69939effc89

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.2-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.2-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.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 901802a00d4624f95aac14240ba5532fc53ca3b7a6039f6b37caaeca6e8866ad
MD5 251240693a7912f3f318e0cfe86636d0
BLAKE2b-256 ae9ddff0251b839907a8e15ed169f5a636b6bd9d656ca1b078719e91b337c9db

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e4850de0c66006f254b55f7c070d92672d2d87695805d0b72c7980cad5006d44
MD5 04b0c82957c6019ed7d5557bdaa36b0a
BLAKE2b-256 fb909671e20f1b795abafc51a16258c985c4448485dbbc49f81a70c6fb6e888e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.2-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 20f498ea9937fe49c08dc86813d763f6f19b44cbf9811dcc115ffce395d1a348
MD5 4b29ec753f7267c2d3fd51b2f121025d
BLAKE2b-256 a17033da16d0427ee0ea2446d5b47312611b84d376a88b0ac6ae1287e6faab62

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.2-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.2-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.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b793b28447836457fd165bffb0afaac6af8ac7710e7d96c321965bf1bc600278
MD5 0e2f35e985c6477fc11487dd3578c6f6
BLAKE2b-256 83c9aca09eef4fd2714c20c401893a12867fc0da6c15714b9341245740fc0e94

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 09354eb6abe91876e770d3472273352a44310817418d3bf317af827a0b351cf2
MD5 284ffc6019ed261b67e344cfc6eda8ad
BLAKE2b-256 b6bc9c5df0ae5d7e63de3d42808df4697dbbadf7d751eb87f657e655988f02cd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 acd3967da9542a6c289cf9c9e7e548837469a7dedb1e4af19d391d90ed91c378
MD5 e35c2dda66212ce0da697378285543f5
BLAKE2b-256 892de0cdcc6fa7a177c7cbee73e2a84448de913aed99d80d5c4eeeb583800a05

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.3.2-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.2-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.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e91f9c776bf27ddd7e4549322602e4a69d0bf9d6fe95ebf102129dd5df720098
MD5 0effe85d6c734df7fb150f0dde27d642
BLAKE2b-256 3beec1651ce3b89d15627f65ef40e8b1bb4ea23abe7a7e8c245113b0c4d60f53

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 06d915650c1ac98979b360792dd6d451ecd1530ef1345afba47a16f30d8cc8da
MD5 7f30948bc81aa7283e73f1c61e33cdb4
BLAKE2b-256 b773349348dc9cb64c68a4b55dd5dbcbfc52935a2ba1ea96eaf3e6ba68badbeb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.3.2-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 b2a3180c523f63d47f23e7a37a7d6aad31164da9177becf7ad214fd7ebd3c0f0
MD5 6345a0e8e3fd4f39c062c3bb6d844195
BLAKE2b-256 4392e51d707c1aa0c3532613fbd0f697211ee47bdac34ec9ddb7e65b708d5fb9

See more details on using hashes here.

Provenance

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