MATH-790: Patch applied to fix the overflow issue.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1348024 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a40ad8af53
commit
33169dcf75
|
@ -170,11 +170,11 @@ public class MannWhitneyUTest {
|
|||
final int n2)
|
||||
throws ConvergenceException, MaxCountExceededException {
|
||||
|
||||
final int n1n2prod = n1 * n2;
|
||||
final double n1n2prod = n1 * n2;
|
||||
|
||||
// http://en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U#Normal_approximation
|
||||
final double EU = (double) n1n2prod / 2.0;
|
||||
final double VarU = (double) (n1n2prod * (n1 + n2 + 1)) / 12.0;
|
||||
final double EU = n1n2prod / 2.0;
|
||||
final double VarU = n1n2prod * (n1 + n2 + 1) / 12.0;
|
||||
|
||||
final double z = (Umin - EU) / FastMath.sqrt(VarU);
|
||||
|
||||
|
|
|
@ -100,4 +100,16 @@ public class MannWhitneyUTestTest {
|
|||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBigDataSet() throws Exception {
|
||||
double[] d1 = new double[1500];
|
||||
double[] d2 = new double[1500];
|
||||
for (int i = 0; i < 1500; i++) {
|
||||
d1[i] = 2 * i;
|
||||
d2[i] = 2 * i + 1;
|
||||
}
|
||||
double result = testStatistic.mannWhitneyUTest(d1, d2);
|
||||
Assert.assertTrue(result > 0.1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue