Skip to main content

Fisher’s Exact Test

https://travis-ci.org/brentp/fishers_exact_test.svg?branch=master

Simple, fast implementation of Fisher’s exact test. . For example, for the following table:

o

Having the property

Not having the property

Selected

12

5

Not selected

29

2

Perhaps we are interested in whether there is any difference of property in selected vs. non-selected groups, then we can do the Fisher’s exact test.

Installation

within this folder

easy_install .

from pypi

easy_install fisher

or from github (contributions welcomed)

git clone git://github.com/brentp/fishers_exact_test.git

Usage

fisher.pvalue() accepts 4 values corresponding to the 2-by-2 contingency table, returns an object with attributes for left_tail, right_tail, and two_tail p-values

>>> from fisher import pvalue
>>> mat = [[12, 5], [29, 2]]
>>> p = pvalue(12, 5, 29, 2)
>>> p.left_tail, p.right_tail, p.two_tail  # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS
(0.04455473783507..., 0.994525206021..., 0.0802685520741...)

Benchmark

A simple benchmark that calls the Fisher’s exact test 1000 times (in scripts/rfisher.py):

calling python fisher...
iterations/sec: 3000.62526381
calling rpy fisher...
iterations/sec: 289.225902364
calling R directly...
iterations/sec: 244.36542276

So the cython fisher is up to 10 times faster than rpy or R version.

Metadata

Release files for fisher-modified 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fisher-modified 0.1.5
File Size Uploaded
fisher-modified-0.1.5.tar.gz 129.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fisher-modified 0.1.5
File Interpreter ABI Platform
fisher_modified-0.1.5-cp37-cp37m-macosx_10_7_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64 Details

Total release size: 209.6 kB

Release files / fisher-modified-0.1.5.tar.gz

Download URL fisher-modified-0.1.5.tar.gz
Size 129.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ee7d7282e57dba280af1d16116df936dc998dce5c5dfc742fbe2fe4e674f519f
BLAKE2b-256 checksum
How to use checksums
18ac3894b8b3ba9bfe7c76bfb4a4b6f3c205e7dc3605f3a2c1d3e253d1cd77d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / fisher_modified-0.1.5-cp37-cp37m-macosx_10_7_x86_64.whl

Download URL fisher_modified-0.1.5-cp37-cp37m-macosx_10_7_x86_64.whl
Size 80.5 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
57a52fa93f42096c776361aa614ee0a74d1c43404e517f91118c58a43bdbf89e
BLAKE2b-256 checksum
How to use checksums
1b34e1056105b2980e7c0a456d8ecda694aa4951dca5250da7c7507f29896413
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page