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.3.tar.gz (242.7 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.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

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

exact_tests-0.4.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.0 MB view details)

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

exact_tests-0.4.3-cp314-cp314-macosx_10_15_universal2.whl (522.9 kB view details)

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

exact_tests-0.4.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

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

exact_tests-0.4.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.0 MB view details)

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

exact_tests-0.4.3-cp313-cp313-macosx_10_13_universal2.whl (519.3 kB view details)

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

exact_tests-0.4.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

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

exact_tests-0.4.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.0 MB view details)

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

exact_tests-0.4.3-cp312-cp312-macosx_10_13_universal2.whl (520.0 kB view details)

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

exact_tests-0.4.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

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

exact_tests-0.4.3-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.3-cp311-cp311-macosx_10_9_universal2.whl (516.8 kB view details)

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

exact_tests-0.4.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.2 MB view details)

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

exact_tests-0.4.3-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.3-cp310-cp310-macosx_10_9_universal2.whl (516.9 kB view details)

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

File details

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

File metadata

  • Download URL: exact_tests-0.4.3.tar.gz
  • Upload date:
  • Size: 242.7 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.3.tar.gz
Algorithm Hash digest
SHA256 ddaea1f3e62ee9cf6cce6e1aac423adc3a1ea2848f8c46bd9e11528321530c8f
MD5 7f9fe4422340d605b9588cf491144064
BLAKE2b-256 643e4d9c48b2c41bab5ff6517344e94c133261bb90e2bf7ff0cf85b5159fb4e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.3.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.3-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.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 685068df45950e836e0ac1b91cee578c42e0ced92b1a794a118f895a52fd7f5e
MD5 6ce6ec71b0b03efd7c1ecc4c79da0e07
BLAKE2b-256 2e636cffaaed55f14bad1369947342833b867ee9eece3514fe94861be18a4c11

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0f17434a86ec2c646db2f0652232a1ea6f8036a2f60886adc1d857eae71984bd
MD5 5c1fb95a6c3a689bcded4ffe115edc01
BLAKE2b-256 44e8f244900ba847dcf93357f230cf57f5f0433829aad49568fc1b11af04e2c8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.3-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 703cebc0c117d58c5461ca3499ec81d59313b835b49fde7fbcdd5612bcf80a6e
MD5 314a216281cc7eefa38091988d83703c
BLAKE2b-256 2de01cfa62db5b1d6c77f53d5e2d2db97460669530a998b92a40cd654e0c429f

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.3-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.3-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.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5423f5d53e834cfefa118f7957c2d3e453d29e93500c3a90e86ed0cd729d4a30
MD5 bdb9bff494d7969e4be1b992291d6249
BLAKE2b-256 5b262d57f3b70b0c7a1388eddf9689e3fad3e6440fa4f5fb5e739a68c0f718f2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b9651e53104cf4e1a1d99a6e841925b9a213440925d56a72c23b5dd3f57fd172
MD5 aa3bf87e19f590d53a5967c4b90fee67
BLAKE2b-256 9aa9412966af46ac477a74c3290f9ca9b4fd5b7c2f105154303c662e3497fc08

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.3-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 0b148c29b7aac96bfe82db5d2ae29231e67406209cfaa62f4bc61c07809bbdef
MD5 a7268b694551e335d2a85d014ded1f45
BLAKE2b-256 05f4b3c25c57ec8d705c5c33dfccf7fdc46e0e91e0d6f37f1aa0d57b37263b82

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.3-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.3-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.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e6418f9b2a20df534605a71f23c296d884f91d3f3ebd4312ee2b3a021b093601
MD5 fec18c350f37fe31bf595973751e87ef
BLAKE2b-256 661d52867ce9c4d666fbcef473945d2751cd11ef493eb1892bb586242889f81a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cd54e7471aee7ecdda438599ab396767865233d276e7e09310f18b071da24929
MD5 9aa0a4baf07cb436fb7ab2e651b542e8
BLAKE2b-256 7482eb40e689ff94c26b2896268c7991d81181d9890759cef9805403b1c343f9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.3-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 75591b61220da2e365170644c630c3c44324b05497fdc945a84e64ce84ca76f9
MD5 fc4f0fd5e4c0f8e484da48ac9058a79b
BLAKE2b-256 4383ff0b79ef5c8e583ea5ea29e7aa0b310a8c08c85d63ae1fbecb05326697db

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.3-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.3-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.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 00bc79db0007436569a66f12c9b56475a8a41562bd3031d16b22dc47ef937751
MD5 dd8bd5f3b59781ea01bb4bee21f5280d
BLAKE2b-256 f753d5600a1e7c76a9451f062218dfc61e8f1e02987b00ee7c2e3ef850984c9c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0d139a6d23af2f602405735e198f304f91071eb51e59e3c0c782b71c20f81855
MD5 089c88097aa87fcab8ed0516321f3acd
BLAKE2b-256 19abe35d6dc8dc2026ee7ddfa27f00dd418ce1fa91088fc2a2f141bd97e6136f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.3-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 2f5af8aa14be225567d048369f1635e7e93e0f2a574603e33739e2e9f5dbf557
MD5 3c9e639076506105c301c7b688c026ba
BLAKE2b-256 33d0c7412db8919e3b2642cf807efc48b133cdc7fd94824a1843308812f1b3a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.4.3-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.3-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.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2a8388387f7930e2ebc4bf807e51965ece05f5ee1286a08b2942813af21bff17
MD5 13416b94ca626b8a18463eb820c5d643
BLAKE2b-256 d825f8784c777f61cdb91735a16a8a92f0504f0af470a87ccaa14bbc333343d6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ae0f7643d6a654604f1744dde03a3c14ac3805e5576795dd0ab3cd372a9cdfa0
MD5 3c416d64301f15e6fcda38a37ed224d5
BLAKE2b-256 772c0457dfc3ad37c72071b09942d25b6b8618816f968960cdf07c8fadb0f2c9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.4.3-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6eb8934b6673e36b782567a20f2efcc491eac497970e5a5127ee7be75b43b0de
MD5 4e3fc39671bfe4ebf632b639f0688a51
BLAKE2b-256 2fea62454a9e2f9236edd00b6229bef48b76dc1ad90cd4797b3c36226e77ec99

See more details on using hashes here.

Provenance

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