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.2.0.tar.gz (196.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.2.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (841.5 kB view details)

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

exact_tests-0.2.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (783.4 kB view details)

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

exact_tests-0.2.0-cp314-cp314-macosx_10_15_universal2.whl (420.2 kB view details)

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

exact_tests-0.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (843.1 kB view details)

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

exact_tests-0.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (783.3 kB view details)

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

exact_tests-0.2.0-cp313-cp313-macosx_10_13_universal2.whl (418.2 kB view details)

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

exact_tests-0.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (847.3 kB view details)

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

exact_tests-0.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (786.9 kB view details)

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

exact_tests-0.2.0-cp312-cp312-macosx_10_13_universal2.whl (419.0 kB view details)

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

exact_tests-0.2.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (838.4 kB view details)

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

exact_tests-0.2.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (777.8 kB view details)

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

exact_tests-0.2.0-cp311-cp311-macosx_10_9_universal2.whl (418.7 kB view details)

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

exact_tests-0.2.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (820.8 kB view details)

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

exact_tests-0.2.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (760.0 kB view details)

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

exact_tests-0.2.0-cp310-cp310-macosx_10_9_universal2.whl (418.7 kB view details)

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

File details

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

File metadata

  • Download URL: exact_tests-0.2.0.tar.gz
  • Upload date:
  • Size: 196.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.2.0.tar.gz
Algorithm Hash digest
SHA256 989ee728d033d58b640a8a48819b3e10fd9e97694442773a18afcab2c1dea003
MD5 304dc5b6094c628876e65a5e937273b1
BLAKE2b-256 e5884ee9d59b96931b737652f53b2417b53e1351ad6fa1b5836cb1db26938e40

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.2.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.2.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.2.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 01be1dbd334512c69ad8ceb08090f1e13d8997b2e32060e6304d49d83e0fdf78
MD5 f8e210e4f411711d3c0ee222624cd37d
BLAKE2b-256 cd7db3c0d1884c8c0a11111cc4f7f366a69ccbf78344d429f31f555613dd7b11

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.2.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7bc9bf3ee78fd5645221509cfe8a05f325d49f13deb0b10f8724528f8c808b74
MD5 e0437fdd9bbb69166d88462dd7f14939
BLAKE2b-256 e2d83c09648647d6e7ba114adc7b0e25fd58b15d769d5f8e56c9619332454c08

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.2.0-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 71f24f0f3b7c57e34a6f51df2692f1d13593dd3e13be162e84866119f94029f5
MD5 80e5f9a6c0c47f6d1575e2e41c95b835
BLAKE2b-256 769667e155ad08a5a05c64db6957cdde80e9c31ce2210ea8748db7657300b713

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.2.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.2.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.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cefa9d6698641a534425464797a50f141add07840f86abeea406f796252ac488
MD5 a5566093fffc0d16497e56929b54bc48
BLAKE2b-256 b242909edaff3f69e5d76e35d80a0cd480a8b362fab2ecaa94635b6f7e4205e6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9279a352ecf112daa1a0bc32cfd330778a3cd12a7b435c28aa5cf01dbec95d24
MD5 5833c20d60099852c16c330160359690
BLAKE2b-256 f1136590a4a0243d267f558cbe0dcc1a7301873921617d06cf6a612da91acdfb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.2.0-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 bfd1c89e46bbd045f507a8bf618b8fa3b72f4eb4a3eaa0c5f89eebb49a84c033
MD5 98e7279e5e99cd6fd8d1ee38019262ed
BLAKE2b-256 6bdb6b36de507acc28ceb213be4a2865cb7e224c5e85d4b4cdac8593910bc147

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.2.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.2.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.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4bf3ff55b8e34558a341af1d3d0362c45ec9f6612ef9ef59516451012dbffcbd
MD5 a132ab1c2aa9be3ec9ecbf61db74be10
BLAKE2b-256 715735ef51951e49d4d1b61ab03efef35404063e2ac7d6aca70dbb3f0743754d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0b0c00966858b0d8d8c2c5f78aee802c887ca26ad801aabed310186e919c14af
MD5 efc88ac00bd03f2700315e9255dc2eb7
BLAKE2b-256 cb9361dfd781c7e6f5fe0d8091545315729b455e2dfaf3f882848cb752aba6c0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.2.0-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 9abe8e55b730661480afebfed75973eb5d83a784aeee7fda312784dcdd72ea44
MD5 87bd3bb55c72d986ef733d732572c310
BLAKE2b-256 a179e85d6b4def476469fbe6b1d040fd7b518323b5f825b770cdbb46da43f70d

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.2.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.2.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.2.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d556d45e339cb2e3a32c11f64521d0a3b51dd5e9757dcfa723940adb6f77d69f
MD5 5c548d33f1145e0fbb92105b4196af58
BLAKE2b-256 b017ef027942f847ddc7aa37a85d5d6cd5cf30974afe69d572f4631d3c812600

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.2.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 60ad3e141d9cde2fe81e18baed5daad12b274fa232fc4fc3794d6e11c92b8108
MD5 0ac8c4fbf07e354e5d76118e8e64c621
BLAKE2b-256 e8c6d59d05ef812923c1b21b96935cdb845668f0fd4437299a9e926fd4c85304

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.2.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 95c82203cb899c37205726294ccf02ed92bc2adb0a1413cc6aa30c19c635bf0f
MD5 79fa92aa9521be5da23e86245800e167
BLAKE2b-256 32ca204c3d8d38d4c2f4fd21b39d750fbad4e9ece67439499f6845116c58f0eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.2.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.2.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.2.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 921035c55801a19b2b8393c54e042caadd00a74996183aee778d9f4a495e4574
MD5 8c9496bd119d6ec23acf28a9a656ac77
BLAKE2b-256 99e9ea038c2755da804c56584a0d122a9b06e85293fbe45ca2388091470879b4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.2.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c88cfb4bcbcc39bcdf026f73d5f6679772b99bedc678d2145d0c557e47d5c3aa
MD5 8c910421a1598dc9417963cbfd6b61f7
BLAKE2b-256 3868b5a553f3e7e7e95737e9f7ccb28e2f14e08dced66fb915d7fd8c814786c5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.2.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 555897c35c3e870cd1f83ab481f6c8e42db3c90ae21fe098c324fd2cbc084c56
MD5 883f05770d839fdea5e3243d6a917b7f
BLAKE2b-256 2e44307dbf68ed2cc01505299da27416cd7205da054a87e3a6478bc54d5f9733

See more details on using hashes here.

Provenance

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