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):
Fisher's Exact Test
Simple, fast implementation of Fisher's exact test. For example, for the following table:
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 :
From PyPI :
Or install the development version :
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 :Benchmark
A simple benchmark that calls the Fisher's exact test 1000 times (in
scripts/rfisher.py):So the cython fisher is up to 10 times faster than rpy or R version.