[Scipy-tickets] [SciPy] #1394: One-sided Fisher's Exact Test

SciPy Trac scipy-tickets@scipy....
Mon Feb 28 17:21:16 CST 2011


#1394: One-sided Fisher's Exact Test
-------------------------+--------------------------------------------------
 Reporter:  gotgenes     |       Owner:  somebody
     Type:  enhancement  |      Status:  new     
 Priority:  normal       |   Milestone:          
Component:  scipy.stats  |     Version:  0.8.0   
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by gotgenes):

 I attached a first crack at implementing one-sided Fisher's exact tests,
 however, it seems only to work for small population sizes, and goes
 completely awry for population sizes in the thousands, which R seems to
 handle just fine.

 The second file I attached, `try_one_sided_fet.py`, gives three test cases
 and prints the results for my SciPy-based implementation, the R
 implementation (via RPy), and a [http://pypi.python.org/pypi/fisher/
 Cython-based Fisher's Exact Test implementation] by Haibao Tang and Brent
 Pedersen. You can see that R and the Cython-based probabilities generally
 agree, but the SciPy-based ones get progressively worse, ending with `NaN`
 for the final test case. I do not understand why.

 {{{
 $ python try_one_sided_fet.py
 Results for table
 [[2, 7], [8, 2]]
 SciPy: (0.018521725952066512, 0.9990149169715733)
 RPy: (0.018521725952066501, 0.9990149169715733)
 Cython fisher: (0.018521725952066515, 0.99901491697157307)

 Results for table
 [[200, 7], [8, 300]]
 SciPy: (1.0000000000002758, -2.7577939931688888e-13)
 RPy: (1.0, 2.0056578803889148e-122)
 Cython fisher: (1.0, 2.0056578803895885e-122)

 Results for table
 [[28, 21], [6, 1957]]
 SciPy: (nan, nan)
 RPy: (1.0, 5.7284374608319831e-44)
 Cython fisher: (0.99999999999957823, 5.7284374608304319e-44)
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1394#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list