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.7.tar.gz (219.1 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.7-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.1 MB view details)

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

exact_tests-0.4.7-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.7-cp314-cp314-macosx_10_15_universal2.whl (446.2 kB view details)

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

exact_tests-0.4.7-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.1 MB view details)

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

exact_tests-0.4.7-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.7-cp313-cp313-macosx_10_13_universal2.whl (442.6 kB view details)

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

exact_tests-0.4.7-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.7-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.7-cp312-cp312-macosx_10_13_universal2.whl (444.1 kB view details)

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

exact_tests-0.4.7-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.7-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.7-cp311-cp311-macosx_10_9_universal2.whl (440.8 kB view details)

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

exact_tests-0.4.7-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.7-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.7-cp310-cp310-macosx_10_9_universal2.whl (440.8 kB view details)

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

File details

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

File metadata

  • Download URL: exact_tests-0.4.7.tar.gz
  • Upload date:
  • Size: 219.1 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.7.tar.gz
Algorithm Hash digest
SHA256 9e522e7a38ed1d1a904fe4dadc33a0f66f812f1a343d1f7f32a1972da207a419
MD5 b1163390acfb0fb411047a1bbb2951d7
BLAKE2b-256 57244b8a2fa72ac58295571869ded8bdffe5f31869fc2f50c6865614b6070304

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.7-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0cb1b5a9b70b984279a0a1a4d5ac78e8d68a86d1ecddbf3639c6ec0639bece2c
MD5 f8572d14d696b6211222712122df11b7
BLAKE2b-256 522e3d45fb2774053f265b1c789aaa3793bd2907075e26ba1ce9499b46e41c1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.7-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.7-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.7-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 fc70cba01fc79d0692eb756a2ed12646eb32cc4d646391a26cb73e904a90d293
MD5 954f6262ecce7c9219c6b9c0e9e986cc
BLAKE2b-256 f93d2347dda60745b3278390dc97b32e53aa994a769255adef7f2e2fcc7ec1ed

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.7-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 ca9ea50c179e45b35936590b952af10f15144def521aa83a09dc54b27748238d
MD5 d5e1b7b539180b77360a108eeb243abc
BLAKE2b-256 a375a633ca920ef0e8723185b4fb83c2042217e9ca5497c1e26573decf8759b7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.7-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 88c2f106d644611510f6f23c81614e6b2a0243d571eb15e590b1302b408eb68a
MD5 106d23d94072d7396578a50f96eaf362
BLAKE2b-256 74f0232343819b3e271d461b2da835f44ba6a49fc53dc8e88e72ff234e029596

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.7-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.7-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.7-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 8948377080f8eac99ce9e832a6417bdfcba3bf4d9fb04b832296033a99cd0113
MD5 25cd497fc898d44c744635baf139f654
BLAKE2b-256 e57851880e23c049f422c1647876d0280cbd25648a0fbc620b88e1c05014fa43

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.7-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 1d6a9b6505a1490a699efad7f22d6e2d8e78af618cf73e2f74363278884da9f9
MD5 dd598ed24d06d96fded62ff469fba045
BLAKE2b-256 6aeed8ec4cee145922d1059bb73eb5b361cef5de206eb960498c52a2e504b06b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.7-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 47a22e4fe8f67684dfd0265a7cc8e84ed10f626c10be8a33a466ca45e7d904ee
MD5 3fc5e57e47c0523db52dd8957ded2c65
BLAKE2b-256 8f8ef5db76378f2b67c21f1e219e65f910d53e9407be9f158783d733f373a597

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.7-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.7-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.7-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 6d98150bc2ea40a517a0c397140e3e6cf2053396a4035d0f1ef79f6ad02e9af5
MD5 0b67d0825b45b85479f60e6a7a0ee430
BLAKE2b-256 2b2ef6a3b44fa6e2e1cd858b1be28421207b7acd574b0795a3d48d6b004f8897

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.7-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 2a6207fce9e870fb0f3bf0c8d6c4cc79f949d53832da629582ed3744638f0b8b
MD5 d5cd41e299717a438a1cc007cedda819
BLAKE2b-256 4adf69d07e563ce5e7e9ebe78b27fc4929111ab8cacb74b7497d8d401e3cda60

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.7-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 21a5b87f6c034ddb1055d8d6f175a6e3b4ba1dcf1f464abb98910542f8d37da6
MD5 92a6eb69395bba09204b695c95d48511
BLAKE2b-256 4ad1a07e5c53a1ca49728e524f2b3679cebd22b3bbcba2102b57b8a1af3dee7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.7-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.7-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.7-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 c3bc70d5924b2b01d20e1e3b27b437dfb3a0277f2fb43f6410c28ee6e79cdbed
MD5 e60039490f9b8dc145ded15caeb4eaab
BLAKE2b-256 157653c03075d9badff84b3780bba3b033cd9de245fda27ce856b5d63432e371

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.7-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 1fcf895f0f6700d4777a5421d0f755ebb7d24cf7beec57f6e4dd38bdd376e733
MD5 c6afd338632e95a8959fc9c391fe482c
BLAKE2b-256 b5d3652c1decc4c726e8e42b9003de66b9b2589e6f3374a04d77146cc04b65ea

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.7-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2e0f9e1006807305b176cc014fe88de6119b5b8e02f77c42c03846f639a13a38
MD5 7ec281b2548b9a2e14a74dbd315f64ca
BLAKE2b-256 c6e34d319081ca760553ae83df5a36c9c3ce25f2cd4dda36c08800de79f264f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.7-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.7-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.7-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 e3205dcbf9a0ac2b872ae806a9850c0591a86b3a8bf9560e10468fef3c3d4f49
MD5 050544739c3cdd868af4316875b012c1
BLAKE2b-256 28ea1c727d04a359b4f3ccfc025b7a33480b4d5507b4a926d81190ea0f110515

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.7-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 0df2b0cee1f95b1107755383cfda14e07abd843ee2800500426691fe57ab195b
MD5 45647c45709fd7892e1bc58ec5cbb53d
BLAKE2b-256 a205b5db5f89177cea7ce928a05ee701720b1f0637893464f093167106678be1

See more details on using hashes here.

Provenance

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