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 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.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.1.0.tar.gz (181.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.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (755.3 kB view details)

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

exact_tests-0.1.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (694.3 kB view details)

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

exact_tests-0.1.0-cp314-cp314-macosx_10_15_universal2.whl (389.3 kB view details)

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

exact_tests-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (756.9 kB view details)

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

exact_tests-0.1.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (695.0 kB view details)

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

exact_tests-0.1.0-cp313-cp313-macosx_10_13_universal2.whl (387.6 kB view details)

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

exact_tests-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (757.7 kB view details)

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

exact_tests-0.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (695.7 kB view details)

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

exact_tests-0.1.0-cp312-cp312-macosx_10_13_universal2.whl (387.7 kB view details)

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

exact_tests-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (752.4 kB view details)

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

exact_tests-0.1.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (690.1 kB view details)

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

exact_tests-0.1.0-cp311-cp311-macosx_10_9_universal2.whl (386.8 kB view details)

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

exact_tests-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (743.0 kB view details)

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

exact_tests-0.1.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (679.4 kB view details)

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

exact_tests-0.1.0-cp310-cp310-macosx_10_9_universal2.whl (386.9 kB view details)

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

File details

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

File metadata

  • Download URL: exact_tests-0.1.0.tar.gz
  • Upload date:
  • Size: 181.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.1.0.tar.gz
Algorithm Hash digest
SHA256 1249b64a85e1672bcda6d94bc4a64affa26d773a9a619859725d8d965d5e0660
MD5 4aa04def8cf950ec0139ce542c1a91d7
BLAKE2b-256 83125378b42b8a65c42676ae968b034b26d14396b19e0a8e9173bf4222e3fb15

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.1.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.1.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.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6e880654daa895baa8bf1657428e3e7ee473782315c0d26fe95b020ab7dfa02c
MD5 3f4ebe96bd35c8c5c4e05a2bd7bcbe57
BLAKE2b-256 9f5b46f2764de0ed413a2f09c47a44c01fad10bb0d4151817d8f42a303704b58

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.1.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 737afe667a120f223b7d039ecd9d35ae06b0d428ac4f29fe42a7f2f9cf40cc2a
MD5 bbf2018670ecb6acab883fe8258748d5
BLAKE2b-256 ffad23b3847c5b6857a0bede1706baba3c6d44932f87c9d8560861bd99330353

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.1.0-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 107961f9fb296b6c1fe6ec7b05246278dd7c1f4364581dcf1d4103a69fcdf37c
MD5 2e19b65bf2b704aab70fd8050319e704
BLAKE2b-256 13db442e1a282ba024d2aef4333ad4f18acfb909183cffb108dee6cb06bf02a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.1.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.1.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.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7c135d92f83deb69acd9ee02e7eff308301315391c683ae39b9c3e61ace943cc
MD5 9435f030ad7654672747c187e533cd52
BLAKE2b-256 d7e795ebca801a6267e2e9b59db72fc3b147c95741dc524d86dbefaac6805b57

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.1.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4e7706a8d717f57f5c7edd366cbd607f1e47e6999d8e02e4bdbdb74d68f76b8f
MD5 eb8cce2d374e8c16601f4901cfbbd7da
BLAKE2b-256 07ffd0b2004e1669ed3d2479d1b1fd162e6470cdbe6a748491a4666e6769463f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.1.0-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 f12e1f1ab8429284d80c7ec8dca2fc4ca344687f993ac5a79546df820872f713
MD5 35b378d3ba519c84ec4c7c149014e769
BLAKE2b-256 3e7f1ae7455e3db64c40deab07cd43edd69d2909d395c93e4275fe84fd00a082

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.1.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.1.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.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 749616a7ca172d806a74ca1fb6c7a1f647b3ba531e6425496d70171d145f403e
MD5 8cc5752cce18eb2e96b81ec841528222
BLAKE2b-256 ae725b0a1a5daa3bf693f84b20a06255177531ab58dbab4df241edd06b8e2355

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5fdf6f8fc6823c18f0079dec84d67469ddef1341e564a3351610f2d9ca6ed36e
MD5 70ca88165fed98f6f5a658613fc722a7
BLAKE2b-256 963e37a9d238cc3e2c8e5e4745671a4061e9979555c98ced262dae5413f7fbfe

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.1.0-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 e9a89e7ed7cd1c4cad6abc7ff99a0517b37a8f90bbf3518af605c31fb56a008a
MD5 7185e72f5bdde4abbcc817fa36190da0
BLAKE2b-256 92e0a8055f57fc43e1798440e9996773d026949fb2731ca95e3a0bdadb04d133

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.1.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.1.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.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9481d9ce9bd955dc92365f467eb1c4a1d74a719458dc690eeab55a6eb36e7111
MD5 c70d8c07aa1bddcfb9fc7a0b733112cb
BLAKE2b-256 fc5437268e97d23aacc047fde189662f58ab185dd45ef5348ad8fb7154376944

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.1.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 109c32ee2f2684b627ecf13269d3e4685c48023f7d59b5c905b485973ffcddaa
MD5 15ca4acad9df25f1a7cbf370cbf75657
BLAKE2b-256 b072b9ee1e63951c6b1b713dcfe60696cabd138bc2c0e35ce08ebe288405d5ad

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.1.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a4de90fd20a32699d347555f286e3d9f27cf37c9c9f9d5e8bc6a4e9c40d5af59
MD5 4e7ca9f16db85edad027d6e2412098fc
BLAKE2b-256 93e32712aeca56062e23c0fbfbbe553ff5850ef81332e616d4081c4979e98142

See more details on using hashes here.

Provenance

The following attestation bundles were made for exact_tests-0.1.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.1.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.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9b00eda518849a06080b081ccadae269ccc15100a03ea6c5eafbda3fad30e11b
MD5 de72db518d9fa15f8188d26d7a8062f8
BLAKE2b-256 457f101800432b47b972f4ea658e4126196d727cd265cb5ee37c8824b094f6d1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.1.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ecb0371a544820600515fa93792fa94a316c539573186da74b011f27d4673d3d
MD5 a6e044e350986964b472ed3196af8cee
BLAKE2b-256 908b33c8ce2c97299c551bf80ccfd53d98106404a8eb8a77d94dd8cf9fa3ba6b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for exact_tests-0.1.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 5a9cd8b8080462d675df5cc2498797bd8aa191b99c85430009589995b12acfad
MD5 6ec097217d58e91b5e2d10881453445e
BLAKE2b-256 2de133826df93203222085b80a990873fc6f324bd44de8f497866c80c9acfdf1

See more details on using hashes here.

Provenance

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