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?
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.