python - Fisher's exact test for bigger than 2 by 2 contingency table -


hi scipy stats has implementation of fisher's exact test 2 2 contingency tables. want test on bigger 2 2 tables. (5x2 ,5x3) know there fisher.test in r can job want in python code

anybody knows python implementation of fisher's exact test can work on bigger tables?

also not sure if ok fisher's exact test on bigger 2 2 tables.

thanks

yes, ok fisher's exact test on 5x2 or 5x3 tables.

there aren't clean, tested solutions out there in python. 1 solution use rpy2 , call r function python.

import rpy2.robjects robjects rpy2.robjects.packages import importr stats = importr('stats') v = robjects.intvector([4,4,10,4,5,6]) m = robjects.r['matrix'](v,nrow=3) res = stats.fisher_test(m) print m >>>      [,1] [,2] >>> [1,]    4    4 >>> [2,]    4    5 >>> [3,]   10    6 print 'p-value: {}'.format(res[0][0]) >>> p-value: 0.668165917041 

another solution dig c code r version uses , call code directly. here link someone's github project went original fortran implementation , call python.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -