You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: multipletests raises exception with empty array #763
I'm trying to use multipletests to correct for multiple comparisons after doing some nonparametric testing (Mann Whitney, Kologorov-Smirnov); it seems to work perfectly except in the case when all the corrected pvalues are still less than alpha (in this case, 0.05). Here's an example from one of my analyses:
In [10]: d=array([2.6055703594036331e-165, 0.011245207233783866, 9.00998740598526e-109, 1.1247302716811245e-07, 3.5737087013141192e-70, 2.6211382176455862e-14, 6.0796933628422312e-130])
In [11]: from statsmodels.sandbox.stats.multicomp import multipletests
In [12]: multipletests(d,method='h')
------------------------------------------------------------
Traceback (most recent call last):
File "<ipython console>", line 1, in <module>
File "C:\Python26\lib\site-packages\statsmodels\stats\multitest.py", line 113, in multipletests
notrejectmin = np.min(np.nonzero(notreject))
File "C:\Python26\lib\site-packages\numpy\core\fromnumeric.py", line 1861, in amin
return _wrapit(a, 'min', axis, out)
File "C:\Python26\lib\site-packages\numpy\core\fromnumeric.py", line 37, in _wrapit
result = getattr(asarray(obj),method)(*args, **kwds)
ValueError: zero-size array to ufunc.reduce without identity
Is this a known bug and/or is there a way around it? For the moment I'm just trying to get at the booleans so I'm just putting the call inside a 'try' loop and catching the error by returning an array of the same size with all 'True's, but that feels sloppy and I may want the actual corrected p values in the future. I'm running statsmodels 0.4.3 in Python 2.6.5 in Windows. Thanks!
fix is in a branch josef-pkt@5e561e1
pvalues were not affected, an example with all rejects produces same p-value correction as R package multtest::mt.rawp2adjp and stats::p.adjust. stats:p.adjust doesn't have Holm-Sidak
Activity
josef-pkt commentedon Apr 10, 2013
simple case
it looks like for 'h' and 'hs', we just need to set notrejectmin index to 0 if not np.any(notreject) ?
notrejectmin = np.min(np.nonzero(notreject))BUG: multipletest, fix 'h', 'hs' if all rejected, closes statsmodels#763
josef-pkt commentedon Apr 10, 2013
fix is in a branch josef-pkt@5e561e1
pvalues were not affected, an example with all rejects produces same p-value correction as R package multtest::mt.rawp2adjp and stats::p.adjust. stats:p.adjust doesn't have Holm-Sidak
josef-pkt commentedon Apr 10, 2013
There is something wrong with that fix.
BUG: multipletest, fix 'h', 'hs' if all rejected, closes statsmodels#763
BUG: multipletest, fix 'h', 'hs' if all rejected, closes statsmodels#763