[Scipy-tickets] [SciPy] #956: Include Fisher exact test for 2x2 contingency tables in scipy.stats

SciPy Trac scipy-tickets@scipy....
Tue Nov 16 08:48:36 CST 2010

#956: Include Fisher exact test for 2x2 contingency tables in scipy.stats
 Reporter:  dsimcha      |       Owner:  somebody
     Type:  enhancement  |      Status:  apply   
 Priority:  normal       |   Milestone:  0.9.0   
Component:  scipy.stats  |     Version:  0.7.0   
 Keywords:  patch        |  
Changes (by josefpktd):

  * status:  needs_review => apply


 looks good,

 I added to the script

 for table, res in tablist:
     res_r = fisher_exact(np.asarray(table))
     #print res_r, np.array(res_r) - res
     print res_r[1]-res[1], res_r[1]
     np.testing.assert_almost_equal(res_r[1], res[1], 12)

 to compare with the corner cases. The last assert can be added to the test
 res[0] in tablist will not agree with this implementation because of the
 difference in definition, but I think we could leave it in the test script
 for possible future usage.

 I think, the variable names min, max should be renamed, I don't like
 variable names that shadow a builtin function.

 Since all tests pass, I think, it can go in as it is. Adding the one-sided
 tests would be a nice bonus, but doesn't prevent this version from going

 At least in the test examples, I didn't see any issue with the lower
 precision for hypergeom.sf.

 thanks Ralf and David

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

More information about the Scipy-tickets mailing list