[Scipy-tickets] [SciPy] #1401: Negative p from fisher_exact
SciPy Trac
scipy-tickets@scipy....
Wed Mar 2 17:40:31 CST 2011
#1401: Negative p from fisher_exact
--------------------------+-------------------------------------------------
Reporter: fubar | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: scipy.stats | Version: 0.9.0
Keywords: fisher_exact |
--------------------------+-------------------------------------------------
scipy 0.9.0 rc5 64 bit AMD python 2.6
Testing some rather large tables, I wonder why I see the following flip to
a negative p value as I increase the count in one cell:
{{{
>> import scipy
>>> scipy.stats.fisher_exact([[17704,496],[1065,75]])
(2.5136301681054065, 4.8559900222443865e-11)
>>> scipy.stats.fisher_exact([[17704,496],[1065,76]])
(2.5471452370134786, -6.1984119257362832e-12)
>>> scipy.stats.fisher_exact([[17704,496],[1065,77]])
(2.5806603059215507, -3.4338215334080302e-11)
}}}
for the last one, chisquare gives:
{{{
>>> scipy.stats.chisquare([[17704,496],[1065,77]])
(array([ 14750.72305397, 306.38917976]), array([ 0.00000000e+00,
1.33607929e-68]))
}}}
and I can work around this oddity by adding some code to only use
fisher_exact when the counts are small in any cell - but negative p values
are a surprise that suggest a potentially interesting edge case
(I took a quick look at the code but realised it was way beyond my being
helpful so "I quickly put down the debugger and backed off in a non-
threatening manner")
--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1401>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list