Reputation: 3930
I'm using scipy's stats to calculate Fisher's Exact Test score.. It works perfectly fine, except for some matrices, it returns valueError. For example,
odds, pvalue = stats.fisher_exact([[1,2],[9,84419233]])
returns
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/scipy-0.14.0.dev_4938da3-py2.7-macosx-10.8-x86_64.egg/scipy/stats/stats.py", line 2606, in fisher_exact
if float(np.abs(pexact - pmode)) / np.abs(np.max(pexact, pmode)) <= 1 - epsilon:
File "/Library/Python/2.7/site-packages/numpy-1.9.0.dev_fde3dee-py2.7-macosx-10.8-x86_64.egg/numpy/core/fromnumeric.py", line 2126, in amax
return amax(axis=axis, out=out)
File "/Library/Python/2.7/site-packages/numpy-1.9.0.dev_fde3dee-py2.7-macosx-10.8-x86_64.egg/numpy/core/_methods.py", line 17, in _amax
out=out, keepdims=keepdims)
ValueError: 'axis' entry is out of bounds
I have no idea why this shouldn't work..
Could someone please help me out?
Upvotes: 1
Views: 1090
Reputation: 114811
This is a bug in the fisher_exact
function. I've reported the problem here: https://github.com/scipy/scipy/issues/3014
Upvotes: 1