Repository: commons-math Updated Branches: refs/heads/master ce98d0085 -> 941b13f8e
Remove trailing spaces. Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/941b13f8 Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/941b13f8 Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/941b13f8 Branch: refs/heads/master Commit: 941b13f8ede6dbaa4fa64ebb9b9156c2709cd281 Parents: ce98d00 Author: Phil Steitz <[email protected]> Authored: Tue Sep 8 18:12:14 2015 -0700 Committer: Phil Steitz <[email protected]> Committed: Tue Sep 8 18:12:14 2015 -0700 ---------------------------------------------------------------------- .../commons/math4/stat/inference/GTestTest.java | 14 ++++---- .../stat/inference/MannWhitneyUTestTest.java | 14 ++++---- .../math4/stat/inference/TestUtilsTest.java | 6 ++-- .../inference/WilcoxonSignedRankTestTest.java | 36 ++++++++++---------- 4 files changed, 35 insertions(+), 35 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/941b13f8/src/test/java/org/apache/commons/math4/stat/inference/GTestTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/stat/inference/GTestTest.java b/src/test/java/org/apache/commons/math4/stat/inference/GTestTest.java index f1aba28..3d11e8b 100644 --- a/src/test/java/org/apache/commons/math4/stat/inference/GTestTest.java +++ b/src/test/java/org/apache/commons/math4/stat/inference/GTestTest.java @@ -181,7 +181,7 @@ public class GTestTest { // expected } } - + @Test public void testUnmatchedArrays() { final long[] observed = { 0, 1, 2, 3 }; @@ -200,7 +200,7 @@ public class GTestTest { // expected } } - + @Test public void testNegativeObservedCounts() { final long[] observed = { 0, 1, 2, -3 }; @@ -217,9 +217,9 @@ public class GTestTest { Assert.fail("negative observed count, NotPositiveException expected"); } catch (NotPositiveException ex) { // expected - } + } } - + @Test public void testZeroExpectedCounts() { final long[] observed = { 0, 1, 2, -3 }; @@ -231,7 +231,7 @@ public class GTestTest { // expected } } - + @Test public void testBadAlpha() { final long[] observed = { 0, 1, 2, 3 }; @@ -248,9 +248,9 @@ public class GTestTest { Assert.fail("zero expected count, NotStrictlyPositiveException expected"); } catch (OutOfRangeException ex) { // expected - } + } } - + @Test public void testScaling() { final long[] observed = {9, 11, 10, 8, 12}; http://git-wip-us.apache.org/repos/asf/commons-math/blob/941b13f8/src/test/java/org/apache/commons/math4/stat/inference/MannWhitneyUTestTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/stat/inference/MannWhitneyUTestTest.java b/src/test/java/org/apache/commons/math4/stat/inference/MannWhitneyUTestTest.java index d8c48e2..0873743 100644 --- a/src/test/java/org/apache/commons/math4/stat/inference/MannWhitneyUTestTest.java +++ b/src/test/java/org/apache/commons/math4/stat/inference/MannWhitneyUTestTest.java @@ -38,11 +38,11 @@ public class MannWhitneyUTestTest { * x <- c(19, 22, 16, 29, 24) * y <- c(20, 11, 17, 12) * wilcox.test(x, y, alternative = "two.sided", mu = 0, paired = FALSE, exact = FALSE, correct = FALSE) - * W = 17, p-value = 0.08641 + * W = 17, p-value = 0.08641 */ final double x[] = {19, 22, 16, 29, 24}; final double y[] = {20, 11, 17, 12}; - + Assert.assertEquals(17, testStatistic.mannWhitneyU(x, y), 1e-10); Assert.assertEquals(0.08641, testStatistic.mannWhitneyUTest(x, y), 1e-5); } @@ -75,14 +75,14 @@ public class MannWhitneyUTestTest { } catch (NullArgumentException ex) { // expected } - + try { testStatistic.mannWhitneyUTest(null, null); Assert.fail("x and y is null (asymptotic), NullArgumentException expected"); } catch (NullArgumentException ex) { // expected } - + /* * x or y is null */ @@ -92,7 +92,7 @@ public class MannWhitneyUTestTest { } catch (NullArgumentException ex) { // expected } - + try { testStatistic.mannWhitneyUTest(new double[] { 1.0 }, null); Assert.fail("y is null (exact), NullArgumentException expected"); @@ -100,7 +100,7 @@ public class MannWhitneyUTestTest { // expected } } - + @Test public void testBigDataSet() { double[] d1 = new double[1500]; @@ -112,7 +112,7 @@ public class MannWhitneyUTestTest { double result = testStatistic.mannWhitneyUTest(d1, d2); Assert.assertTrue(result > 0.1); } - + @Test public void testBigDataSetOverflow() { // MATH-1145 http://git-wip-us.apache.org/repos/asf/commons-math/blob/941b13f8/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java b/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java index 5fa151f..b22131e 100644 --- a/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java +++ b/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java @@ -530,7 +530,7 @@ public class TestUtilsTest { Assert.assertEquals(FastMath.sqrt(5734.343), TestUtils.rootLogLikelihoodRatio(1000, 1000, 1000, 100000), 0.001); Assert.assertEquals(FastMath.sqrt(5714.932), TestUtils.rootLogLikelihoodRatio(1000, 1000, 1000, 99000), 0.001); } - + @Test public void testKSOneSample() throws Exception { final NormalDistribution unitNormal = new NormalDistribution(0d, 1d); @@ -539,7 +539,7 @@ public class TestUtilsTest { Assert.assertEquals(0.3172069207622391, TestUtils.kolmogorovSmirnovTest(unitNormal, sample), tol); Assert.assertEquals(0.0932947561266756, TestUtils.kolmogorovSmirnovStatistic(unitNormal, sample), tol); } - + @Test public void testKSTwoSample() throws Exception { final double tol = KolmogorovSmirnovTestTest.TOLERANCE; @@ -554,6 +554,6 @@ public class TestUtilsTest { 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); + .assertEquals(0.105577085453247, TestUtils.exactP(d, smallSample1.length,smallSample2.length, false), tol); } } http://git-wip-us.apache.org/repos/asf/commons-math/blob/941b13f8/src/test/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTestTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTestTest.java b/src/test/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTestTest.java index c435fbd..335f5ce 100644 --- a/src/test/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTestTest.java +++ b/src/test/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTestTest.java @@ -42,28 +42,28 @@ public class WilcoxonSignedRankTestTest { */ final double x[] = {1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30}; final double y[] = {0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29}; - + /* EXACT: * wilcox.test(x, y, alternative = "two.sided", mu = 0, paired = TRUE, exact = TRUE, correct = FALSE) * V = 40, p-value = 0.03906 - * + * * Corresponds to the value obtained in R. */ Assert.assertEquals(40, testStatistic.wilcoxonSignedRank(x, y), 1e-10); - Assert.assertEquals(0.03906, testStatistic.wilcoxonSignedRankTest(x, y, true), 1e-5); - + Assert.assertEquals(0.03906, testStatistic.wilcoxonSignedRankTest(x, y, true), 1e-5); + /* ASYMPTOTIC: * wilcox.test(x, y, alternative = "two.sided", mu = 0, paired = TRUE, exact = FALSE, correct = FALSE) * V = 40, p-value = 0.03815 - * - * This is not entirely the same due to different corrects, + * + * This is not entirely the same due to different corrects, * e.g. http://mlsc.lboro.ac.uk/resources/statistics/wsrt.pdf * and src/library/stats/R/wilcox.test.R in the R source */ Assert.assertEquals(40, testStatistic.wilcoxonSignedRank(x, y), 1e-10); Assert.assertEquals(0.0329693812, testStatistic.wilcoxonSignedRankTest(x, y, false), 1e-10); } - + @Test public void testWilcoxonSignedRankInputValidation() { /* @@ -74,19 +74,19 @@ public class WilcoxonSignedRankTestTest { final double[] y1 = new double[30]; final double[] y2 = new double[31]; for (int i = 0; i < 30; ++i) { - x1[i] = x2[i] = y1[i] = y2[i] = i; + x1[i] = x2[i] = y1[i] = y2[i] = i; } - + // Exactly 30 is okay - //testStatistic.wilcoxonSignedRankTest(x1, y1, true); - + //testStatistic.wilcoxonSignedRankTest(x1, y1, true); + try { testStatistic.wilcoxonSignedRankTest(x2, y2, true); Assert.fail("More than 30 samples and exact chosen, NumberIsTooLargeException expected"); } catch (NumberIsTooLargeException ex) { // expected } - + /* Samples must be present, i.e. length > 0 */ try { @@ -132,7 +132,7 @@ public class WilcoxonSignedRankTestTest { } catch (DimensionMismatchException ex) { // expected } - + /* * x and y is null */ @@ -142,14 +142,14 @@ public class WilcoxonSignedRankTestTest { } catch (NullArgumentException ex) { // expected } - + try { testStatistic.wilcoxonSignedRankTest(null, null, false); Assert.fail("x and y is null (asymptotic), NullArgumentException expected"); } catch (NullArgumentException ex) { // expected } - + /* * x or y is null */ @@ -159,21 +159,21 @@ public class WilcoxonSignedRankTestTest { } catch (NullArgumentException ex) { // expected } - + try { testStatistic.wilcoxonSignedRankTest(null, new double[] { 1.0 }, false); Assert.fail("x is null (asymptotic), NullArgumentException expected"); } catch (NullArgumentException ex) { // expected } - + try { testStatistic.wilcoxonSignedRankTest(new double[] { 1.0 }, null, true); Assert.fail("y is null (exact), NullArgumentException expected"); } catch (NullArgumentException ex) { // expected } - + try { testStatistic.wilcoxonSignedRankTest(new double[] { 1.0 }, null, false); Assert.fail("y is null (asymptotic), NullArgumentException expected");
