0

I am currently trying to use Mann-Whitney U Test and I figured out that Apache Commons Math has it implemented. After consulting multiple websites (Wiki is one of them), they indicate that the U statistic of this test is the minimum among U1 and U2. However, when I look into Apache Commons Math MannWhitneyUTest.mannWhitneyU() method, it returns the maximum of U1 and U2.

My question is why Apache Commons returns the maximum of those two values, whereas all other sources I found online indicate returning the minimum?

nick.katsip
  • 868
  • 3
  • 12
  • 32
  • What if you just think it returns the maximum because you misread the code and provide no support for your claim that Apache would implement something wrong (or at least differently)? Show us the proof. – Kayaman Mar 01 '18 at 10:10
  • The [JavaDoc](http://commons.apache.org/proper/commons-math/javadocs/api-3.6/org/apache/commons/math3/stat/inference/MannWhitneyUTest.html#mannWhitneyU(double[],%20double[])) for this method indicates that the max-value is returned. Also, when I look into the source code of this method, a call to `FastMath.max(U1, U2)` is made. Therefore, I don't see where do you see that I claim that Apache's implementation is wrong? – nick.katsip Mar 01 '18 at 10:15
  • I don't see anything because you didn't include relevant information (code and or javadoc) in the question. But yes, it does seem to return the maximum U. – Kayaman Mar 01 '18 at 10:17

1 Answers1

1

This is a bug. See the discussion of this issue. When the test is performed, the minimum value is used. The minimum value is what should be returned.

Phil Steitz
  • 644
  • 3
  • 10