Esempio n. 1
0
 @Test
 public void testKSOneSample() throws Exception {
   final NormalDistribution unitNormal = new NormalDistribution(0d, 1d);
   final double[] sample = KolmogorovSmirnovTestTest.gaussian;
   final double tol = KolmogorovSmirnovTestTest.TOLERANCE;
   Assert.assertEquals(
       0.3172069207622391, TestUtils.kolmogorovSmirnovTest(unitNormal, sample), tol);
   Assert.assertEquals(
       0.0932947561266756, TestUtils.kolmogorovSmirnovStatistic(unitNormal, sample), tol);
 }
Esempio n. 2
0
 @Test
 public void testKSTwoSample() throws Exception {
   final double tol = KolmogorovSmirnovTestTest.TOLERANCE;
   final double[] smallSample1 = {6, 7, 9, 13, 19, 21, 22, 23, 24};
   final double[] smallSample2 = {10, 11, 12, 16, 20, 27, 28, 32, 44, 54};
   Assert.assertEquals(
       0.105577085453247, TestUtils.kolmogorovSmirnovTest(smallSample1, smallSample2, false), tol);
   final double d = TestUtils.kolmogorovSmirnovStatistic(smallSample1, smallSample2);
   Assert.assertEquals(0.5, d, tol);
   Assert.assertEquals(
       0.105577085453247,
       TestUtils.exactP(d, smallSample1.length, smallSample2.length, false),
       tol);
 }