[LNT] r208556 - Fix Mann-Whitney U calculation with large sample size

Yi Kong Yi.Kong at arm.com
Mon May 12 06:24:37 PDT 2014


Author: kongyi
Date: Mon May 12 08:24:37 2014
New Revision: 208556

URL: http://llvm.org/viewvc/llvm-project?rev=208556&view=rev
Log:
Fix Mann-Whitney U calculation with large sample size

SciPy uses one-sided p-value while rest of program uses two-sided, multiplied
by 2.

Modified:
    lnt/trunk/lnt/util/stats.py

Modified: lnt/trunk/lnt/util/stats.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/stats.py?rev=208556&r1=208555&r2=208556&view=diff
==============================================================================
--- lnt/trunk/lnt/util/stats.py (original)
+++ lnt/trunk/lnt/util/stats.py Mon May 12 08:24:37 2014
@@ -31,7 +31,9 @@ def mannwhitneyu(a, b, sigLevel = .05):
     else:
         try:
             from scipy.stats import mannwhitneyu as mannwhitneyu_large
-            return mannwhitneyu_large(a, b, False) >= sigLevel
+            # MWU in SciPy is one-sided, multiply by 2 to get two-sided.
+            p = mannwhitneyu_large(a, b, False) * 2
+            return p >= sigLevel
         except ValueError:
             return True
 





More information about the llvm-commits mailing list