This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-statistics.git
commit 7d8190c2d3b03c00fc38da3f8127454e6cd18d61 Author: Alex Herbert <[email protected]> AuthorDate: Fri Oct 22 14:14:40 2021 +0100 STATISTICS-37: Update Normal distribution with high precision erfc Commons Numbers 1.1 improved the implementation of erfc and its inverse. Update the normal normal distribution and unit tests to verify the increased precision. The increase in precision of the error function is such that the computation of sd * sqrt(2) is a source of error against reference data. This has been updated to compute exactly and verified against high precision data. It is a small additional computation cost during class initialisation. Change extended precision CDF and SF data to use matlab variable precision arithmetic. --- .../statistics/distribution/ExtendedPrecision.java | 173 +++++++ .../distribution/NormalDistribution.java | 40 +- .../distribution/ExtendedPrecisionTest.java | 169 +++++++ .../distribution/NormalDistributionTest.java | 46 +- .../commons/statistics/distribution/sqrt2xx.csv | 528 +++++++++++++++++++++ .../distribution/test.normal.1.properties | 47 +- .../distribution/test.normal.2.properties | 2 - .../distribution/test.normal.3.properties | 2 - .../distribution/test.normal.4.properties | 2 - 9 files changed, 966 insertions(+), 43 deletions(-) diff --git a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ExtendedPrecision.java b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ExtendedPrecision.java new file mode 100644 index 0000000..7fa3c93 --- /dev/null +++ b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ExtendedPrecision.java @@ -0,0 +1,173 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.statistics.distribution; + +/** + * Computes extended precision floating-point operations. + * + * <p>It is based on the 1971 paper + * <a href="https://doi.org/10.1007/BF01397083"> + * Dekker (1971) A floating-point technique for extending the available precision</a> + * Numer. Math. 18, 224-242. + * + * <p>Adapted from {@code org.apache.commons.numbers.core.ExtendedPrecion}. + */ +final class ExtendedPrecision { + /** + * The multiplier used to split the double value into high and low parts. From + * Dekker (1971): "The constant should be chosen equal to 2^(p - p/2) + 1, + * where p is the number of binary digits in the mantissa". Here p is 53 + * and the multiplier is {@code 2^27 + 1}. + */ + private static final double MULTIPLIER = 1.0 + 0x1.0p27; + /** Threshold for a big number that may overflow when squared. 2^500. */ + private static final double BIG = 0x1.0p500; + /** Threshold for a small number that may underflow when squared. 2^-500. */ + private static final double SMALL = 0x1.0p-500; + /** Scale up by 2^600. */ + private static final double SCALE_UP = 0x1.0p600; + /** Scale down by 2^600. */ + private static final double SCALE_DOWN = 0x1.0p-600; + + /** No instances. */ + private ExtendedPrecision() {} + + /** + * Compute {@code sqrt(2 * x * x)}. + * + * <p>The result is computed using a high precision computation of + * {@code sqrt(2 * x * x)} avoiding underflow or overflow of {@code x} + * squared. + * + * @param x Value (assumed to be positive) + * @return {@code sqrt(2 * x * x)} + */ + static double sqrt2xx(double x) { + // Note: Do not convert x to absolute for this use case + if (x > BIG) { + if (x == Double.POSITIVE_INFINITY) { + return Double.POSITIVE_INFINITY; + } + return computeSqrt2aa(x * SCALE_DOWN) * SCALE_UP; + } else if (x < SMALL) { + // Note: Ignore possible zero for this use case + return computeSqrt2aa(x * SCALE_UP) * SCALE_DOWN; + } else { + return computeSqrt2aa(x); + } + } + + /** + * Compute {@code sqrt(2 * a * a)}. + * + * @param a Value + * @return the result + */ + private static double computeSqrt2aa(double a) { + // Split the number + final double ha = highPartUnscaled(a); + final double la = a - ha; + + // Extended precision product + final double x = 2 * a * a; + final double xx = productLow(ha, la, 2 * ha, 2 * la, x); + + // Standard sqrt + final double c = Math.sqrt(x); + + // Edge case. + // Occurs if a has limited precision in the mantissa including + // the special cases of 0 and 1. + if (xx == 0) { + return c; + } + + // Dekker's double precision sqrt2 algorithm. + // See Dekker, 1971, pp 242. + final double hc = highPartUnscaled(c); + final double lc = c - hc; + final double u = c * c; + final double uu = productLow(hc, lc, hc, lc, u); + final double cc = (x - u - uu + xx) * 0.5 / c; + + // Extended precision result: + // y = c + cc + // yy = c - y + cc + // Return only y + return c + cc; + } + + /** + * Implement Dekker's method to split a value into two parts. Multiplying by (2^s + 1) creates + * a big value from which to derive the two split parts. + * <pre> + * c = (2^s + 1) * a + * a_big = c - a + * a_hi = c - a_big + * a_lo = a - a_hi + * a = a_hi + a_lo + * </pre> + * + * <p>The multiplicand allows a p-bit value to be split into + * (p-s)-bit value {@code a_hi} and a non-overlapping (s-1)-bit value {@code a_lo}. + * Combined they have (p-1) bits of significand but the sign bit of {@code a_lo} + * contains a bit of information. The constant is chosen so that s is ceil(p/2) where + * the precision p for a double is 53-bits (1-bit of the mantissa is assumed to be + * 1 for a non sub-normal number) and s is 27. + * + * <p>This conversion does not use scaling and the result of overflow is NaN. Overflow + * may occur when the exponent of the input value is above 996. + * + * <p>Splitting a NaN or infinite value will return NaN. + * + * @param value Value. + * @return the high part of the value. + * @see Math#getExponent(double) + */ + private static double highPartUnscaled(double value) { + final double c = MULTIPLIER * value; + return c - (c - value); + } + + /** + * Compute the low part of the double length number {@code (z,zz)} for the exact + * product of {@code x} and {@code y} using Dekker's mult12 algorithm. The standard + * precision product {@code x*y} must be provided. The numbers {@code x} and {@code y} + * should already be split into low and high parts. + * + * <p>Note: This uses the high part of the result {@code (z,zz)} as {@code x * y} and not + * {@code hx * hy + hx * ty + tx * hy} as specified in Dekker's original paper. + * See Shewchuk (1997) for working examples. + * + * @param hx High part of first factor. + * @param lx Low part of first factor. + * @param hy High part of second factor. + * @param ly Low part of second factor. + * @param xy Product of the factors. + * @return <code>lx * ly - (((xy - hx * hy) - lx * hy) - hx * ly)</code> + * @see <a href="http://www-2.cs.cmu.edu/afs/cs/project/quake/public/papers/robust-arithmetic.ps"> + * Shewchuk (1997) Theorum 18</a> + */ + private static double productLow(double hx, double lx, double hy, double ly, double xy) { + // Compute the multiply low part: + // err1 = xy - hx * hy + // err2 = err1 - lx * hy + // err3 = err2 - hx * ly + // low = lx * ly - err3 + return lx * ly - (((xy - hx * hy) - lx * hy) - hx * ly); + } +} diff --git a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/NormalDistribution.java b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/NormalDistribution.java index fdca0b0..603dd24 100644 --- a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/NormalDistribution.java +++ b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/NormalDistribution.java @@ -28,17 +28,26 @@ import org.apache.commons.rng.sampling.distribution.ZigguratSampler; * Implementation of the <a href="http://en.wikipedia.org/wiki/Normal_distribution">normal (Gaussian) distribution</a>. */ public final class NormalDistribution extends AbstractContinuousDistribution { - /** √(2). */ - private static final double SQRT2 = Math.sqrt(2.0); /** 0.5 * ln(2 * pi). Computed to 25-digits precision. */ private static final double HALF_LOG_2_PI = 0.9189385332046727417803297; + /** Mean of this distribution. */ private final double mean; /** Standard deviation of this distribution. */ private final double standardDeviation; /** The value of {@code log(sd) + 0.5*log(2*pi)} stored for faster computation. */ private final double logStandardDeviationPlusHalfLog2Pi; - /** Standard deviation multiplied by sqrt(2). */ + /** + * Standard deviation multiplied by sqrt(2). + * This is used to avoid a double division when computing the value passed to the + * error function: + * <pre> + * ((x - u) / sd) / sqrt(2) == (x - u) / (sd * sqrt(2)). + * </pre> + * <p>Note: Implementations may first normalise x and then divide by sqrt(2) resulting + * in differences due to rounding error that show increasingly large relative + * differences as the error function computes close to 0 in the extreme tail. + */ private final double sdSqrt2; /** @@ -50,7 +59,9 @@ public final class NormalDistribution extends AbstractContinuousDistribution { this.mean = mean; standardDeviation = sd; logStandardDeviationPlusHalfLog2Pi = Math.log(sd) + HALF_LOG_2_PI; - sdSqrt2 = sd * SQRT2; + // Minimise rounding error by computing sqrt(2 * sd * sd) exactly. + // Compute using extended precision with care to avoid over/underflow. + sdSqrt2 = ExtendedPrecision.sqrt2xx(sd); } /** @@ -63,10 +74,11 @@ public final class NormalDistribution extends AbstractContinuousDistribution { */ public static NormalDistribution of(double mean, double sd) { - if (sd <= 0) { - throw new DistributionException(DistributionException.NOT_STRICTLY_POSITIVE, sd); + if (sd > 0) { + return new NormalDistribution(mean, sd); } - return new NormalDistribution(mean, sd); + // zero, negative or nan + throw new DistributionException(DistributionException.NOT_STRICTLY_POSITIVE, sd); } /** @@ -105,19 +117,10 @@ public final class NormalDistribution extends AbstractContinuousDistribution { return -0.5 * x1 * x1 - logStandardDeviationPlusHalfLog2Pi; } - /** - * {@inheritDoc} - * - * <p>If {@code x} is more than 40 standard deviations from the mean, 0 or 1 - * is returned, as in these cases the actual value is within - * {@code Double.MIN_VALUE} of 0 or 1. - */ + /** {@inheritDoc} */ @Override public double cumulativeProbability(double x) { final double dev = x - mean; - if (Math.abs(dev) > 40 * standardDeviation) { - return dev < 0 ? 0.0d : 1.0d; - } return 0.5 * Erfc.value(-dev / sdSqrt2); } @@ -125,9 +128,6 @@ public final class NormalDistribution extends AbstractContinuousDistribution { @Override public double survivalProbability(double x) { final double dev = x - mean; - if (Math.abs(dev) > 40 * standardDeviation) { - return dev > 0 ? 0.0d : 1.0d; - } return 0.5 * Erfc.value(dev / sdSqrt2); } diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ExtendedPrecisionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ExtendedPrecisionTest.java new file mode 100644 index 0000000..a864f42 --- /dev/null +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ExtendedPrecisionTest.java @@ -0,0 +1,169 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.statistics.distribution; + +import java.math.BigDecimal; +import java.math.MathContext; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvFileSource; + +/** + * Test for {@link ExtendedPrecision}. + */ +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +class ExtendedPrecisionTest { + /** sqrt(2). */ + private static final double ROOT2 = Math.sqrt(2.0); + /** The sum of the squared ULP error for the first standard computation. */ + private static final RMS RMS1 = new RMS(); + /** The sum of the squared ULP error for the second standard computation. */ + private static final RMS RMS2 = new RMS(); + + /** + * Class to compute the root mean squared error (RMS). + * @see <a href="https://en.wikipedia.org/wiki/Root_mean_square">Wikipedia: RMS</a> + */ + private static class RMS { + private double ss; + private double max; + private int n; + + /** + * @param x Value (assumed to be positive) + */ + void add(double x) { + // Overflow is not supported. + // Assume the expected and actual are quite close when measuring the RMS. + ss += x * x; + n++; + // Absolute error when detecting the maximum + x = Math.abs(x); + max = max < x ? x : max; + } + + /** + * Gets the maximum error. + * + * <p>This is not used for assertions. It can be used to set maximum ULP thresholds + * for test data if the TestUtils.assertEquals method is used with a large maxUlps + * to measure the ulp (and effectively ignore failures) and the maximum reported + * as the end of testing. + * + * @return maximum error + */ + double getMax() { + return max; + } + + /** + * Gets the root mean squared error (RMS). + * + * <p> Note: If no data has been added this will return 0/0 = nan. + * This prevents using in assertions without adding data. + * + * @return root mean squared error (RMS) + */ + double getRMS() { + return Math.sqrt(ss / n); + } + } + + @Test + void testSqrt2xxUnderAndOverflow() { + final double x = 1.5; + final double e = 2.12132034355964257320253308631; + Assertions.assertEquals(e, ExtendedPrecision.sqrt2xx(x)); + for (final int i : new int[] {-1000, -600, -200, 200, 600, 1000}) { + final double scale = Math.scalb(1.0, i); + final double x1 = x * scale; + final double e1 = e * scale; + Assertions.assertEquals(e1, ExtendedPrecision.sqrt2xx(x1), () -> Double.toString(x1)); + } + } + + @Test + void testSqrt2xxExtremes() { + // Handle big numbers + Assertions.assertEquals(Double.POSITIVE_INFINITY, ExtendedPrecision.sqrt2xx(Double.MAX_VALUE)); + Assertions.assertEquals(Double.POSITIVE_INFINITY, ExtendedPrecision.sqrt2xx(Double.POSITIVE_INFINITY)); + Assertions.assertEquals(0.0, ExtendedPrecision.sqrt2xx(0)); + Assertions.assertEquals(ROOT2, ExtendedPrecision.sqrt2xx(1)); + Assertions.assertEquals(Math.sqrt(8), ExtendedPrecision.sqrt2xx(2)); + // Handle sub-normal numbers + for (int i = 2; i <= 10; i++) { + Assertions.assertEquals(i * Double.MIN_VALUE * Math.sqrt(2), ExtendedPrecision.sqrt2xx(i * Double.MIN_VALUE)); + } + // Currently the argument is assumed to be positive. + Assertions.assertEquals(Double.NaN, ExtendedPrecision.sqrt2xx(Double.NaN)); + // Big negative numbers overflow and the extended precision computation generates NaN. + Assertions.assertEquals(Double.NaN, ExtendedPrecision.sqrt2xx(-1e300)); + } + + /** + * Test the extended precision {@code sqrt(2 * x * x)}. The expected result + * is an exact computation. For comparison ulp errors are collected for + * two standard precision computations. + * + * @param x Value x + * @param expected Expected result of {@code sqrt(2 * x * x)}. + */ + @ParameterizedTest + @Order(1) + @CsvFileSource(resources = "sqrt2xx.csv") + void testSqrt2xx(double x, BigDecimal expected) { + final double e = expected.doubleValue(); + Assertions.assertEquals(e, ExtendedPrecision.sqrt2xx(x)); + // Compute error for the standard computations + addError(Math.sqrt(2 * x * x), expected, e, RMS1); + addError(x * ROOT2, expected, e, RMS2); + } + + @Test + void testSqrt2xxStandardPrecision1() { + // Typical result: max 0.7780 rms 0.2144 + assertSqrt2xxStandardPrecision(RMS1, 0.9, 0.3); + } + + @Test + void testSqrt2xxStandardPrecision2() { + // Typical result: max 1.0598 rms 0.4781 + assertSqrt2xxStandardPrecision(RMS2, 1.3, 0.6); + } + + @Test + private static void assertSqrt2xxStandardPrecision(RMS rms, double maxError, double rmsError) { + Assertions.assertTrue(rms.getMax() < maxError, () -> "max error: " + rms.getMax()); + Assertions.assertTrue(rms.getRMS() < rmsError, () -> "rms error: " + rms.getRMS()); + } + + private static void addError(double z, BigDecimal expected, double e, RMS rms) { + double error; + if (z == e) { + error = 0; + } else { + // Compute ULP error + error = expected.subtract(new BigDecimal(z)) + .divide(new BigDecimal(Math.ulp(e)), MathContext.DECIMAL64).doubleValue(); + } + rms.add(error); + } +} diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/NormalDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/NormalDistributionTest.java index f5fdb3e..9625a79 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/NormalDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/NormalDistributionTest.java @@ -18,7 +18,6 @@ package org.apache.commons.statistics.distribution; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; /** @@ -46,6 +45,23 @@ class NormalDistributionTest extends BaseContinuousDistributionTest { return new String[] {"Mean", "StandardDeviation"}; } + @Override + protected double getRelativeTolerance() { + // Tests are limited by the survival probability + // Tolerance is 3.3306690738754696E-15. + return 15 * RELATIVE_EPS; + } + + @Override + protected double getHighPrecisionRelativeTolerance() { + // Tests are limited by the survival probability. + // Tolerance is 1.6653345369377348E-14. + // This is lowest achieved with various implementations of the + // survival function against high precision reference data. + // It requires computing the factor sqrt(2 * sd * sd) exactly. + return 75 * RELATIVE_EPS; + } + //-------------------- Additional test cases ------------------------------- @Test @@ -117,27 +133,29 @@ class NormalDistributionTest extends BaseContinuousDistributionTest { @Test void testMath280() { final NormalDistribution dist = NormalDistribution.of(0, 1); - final DoubleTolerance tol = createTolerance(); - double result = dist.inverseCumulativeProbability(0.9986501019683698); - TestUtils.assertEquals(3.0, result, tol); + // Tolerance limited by precision of p close to 1. + // Lower the tolerance as the p value approaches 1. + double result; result = dist.inverseCumulativeProbability(0.841344746068543); - TestUtils.assertEquals(1.0, result, tol); - result = dist.inverseCumulativeProbability(0.9999683287581673); - TestUtils.assertEquals(4.0, result, tol); + TestUtils.assertEquals(1.0, result, createRelTolerance(1e-15)); result = dist.inverseCumulativeProbability(0.9772498680518209); - TestUtils.assertEquals(2.0, result, tol); + TestUtils.assertEquals(2.0, result, createRelTolerance(1e-14)); + result = dist.inverseCumulativeProbability(0.9986501019683698); + TestUtils.assertEquals(3.0, result, createRelTolerance(1e-13)); + result = dist.inverseCumulativeProbability(0.9999683287581673); + TestUtils.assertEquals(4.0, result, createRelTolerance(1e-12)); } /** - * Test the inverse CDF. This is currently limited by the accuracy - * of {@code InverseErfc}. Although the CDF can be computed - * to x down to -38 (CDF around 2.8854e-316) the inverse of the probability - * fails when x is around 9 and the CDF is approximately 1.12e-19. + * Test the inverse CDF is supported through the entire range of small values + * that can be computed by the CDF. Approximate limit is x down to -38 + * (CDF around 2.8854e-316). + * Verifies fix for STATISTICS-37. */ @Test - @Disabled("Limited by accuracy of InverseErfc") void testInverseCDF() { final NormalDistribution dist = NormalDistribution.of(0, 1); + Assertions.assertEquals(0.0, dist.inverseCumulativeProbability(0.5)); // Get smaller and the CDF should reduce. double x = 0; for (;;) { @@ -148,7 +166,7 @@ class NormalDistributionTest extends BaseContinuousDistributionTest { } final double x0 = dist.inverseCumulativeProbability(cdf); // Must be close - Assertions.assertEquals(x, x0, 1.0, () -> "CDF = " + cdf); + Assertions.assertEquals(x, x0, Math.abs(x) * 1e-11, () -> "CDF = " + cdf); } } } diff --git a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/sqrt2xx.csv b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/sqrt2xx.csv new file mode 100644 index 0000000..a82c187 --- /dev/null +++ b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/sqrt2xx.csv @@ -0,0 +1,528 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# High-precision sqrt test data for: sqrt(2 * x * x) +# Computed from uniform double in the range [1, 2) using: +# +# MathContext mc = new MathContext(25); +# BigDecimal two = BigDecimal.valueOf(2); +# for (int i = 0; i < 500; i++) { +# // Combine an unbiased exponent of 0 with random 52 bit mantissa +# double u = Double.longBitsToDouble( +# (1023L << 52) | (ThreadLocalRandom.current().nextLong() >>> 12)); +# System.out.printf("%s,%s%n", u, new BigDecimal(u).pow(2).multiply(two).sqrt(mc)); +# } + +1.6456952822103634,2.327364587635314061861537 +1.0726036144145072,1.516890578555397933072261 +1.3529109711890783,1.913305044138950220160089 +1.705377712332469,2.411768289749380196427472 +1.3425085426434225,1.898593788608066653880445 +1.6412040613204646,2.321013042141205762274132 +1.9487033115612693,2.755882652251309998497929 +1.1364342543389627,1.607160735231516422602927 +1.6237308862289555,2.296302240949073788834036 +1.8785896912485722,2.656727019498016065311198 +1.762371107039806,2.492369121510179309312156 +1.06861337265916,1.511247524547838448316657 +1.2558453324835233,1.776033501441147408403295 +1.1391185494804954,1.610956901826084142064481 +1.7693041768505642,2.502173962865432940141062 +1.6500523801128362,2.333526454581578375261316 +1.9275448204058916,2.725960027100023660396772 +1.353715094298951,1.914442245946749918364362 +1.344759144942162,1.901776620902452309180529 +1.461267733289702,2.066544646676487117877992 +1.720282589952283,2.432846969824832315999763 +1.3510359786147965,1.910653404211052043661412 +1.2266337877872933,1.734722138753871094704108 +1.7584407734621494,2.486810790460006981234877 +1.425530122992296,2.016004033507091381784447 +1.414795221719051,2.000822590535731859456763 +1.0347309048377473,1.463330479028126650932467 +1.0044024770429676,1.420439605115296013243790 +1.0440890096834599,1.476564837819042696312189 +1.1011194791877943,1.557218101260577658761629 +1.3467707156280317,1.904621411448081326834227 +1.5580921339857436,2.203475027309476236230317 +1.8349296879138135,2.594982450648745721428749 +1.6402714860330108,2.319694181521754568839109 +1.6806762256093346,2.376835112214744692585204 +1.152648538783705,1.630091196197446201407513 +1.4405555971633552,2.037253262860889869570742 +1.229438814746673,1.738689045922648152954397 +1.23862522841024,1.751680596715233934792806 +1.1688095449719258,1.652946310330423423707482 +1.730227519886559,2.446911224614735895335897 +1.411926055736625,1.996764977090685747704516 +1.928591319207815,2.727439999898710960936239 +1.072470899655921,1.516702891543878061810867 +1.3135369412077404,1.857621756934057332100066 +1.469237069318284,2.077814989771216270329261 +1.8354684962210843,2.595744440664407407295386 +1.6745395235923388,2.368156504994066922203281 +1.4068982086080741,1.989654527491950333224612 +1.8415401721403355,2.604331087095746546364044 +1.0571180407446124,1.494990670250304874777882 +1.8772989562415305,2.654901644545627977992524 +1.918160495216393,2.712688587143315417666454 +1.106053425625988,1.564195755229493573215166 +1.554192860331392,2.197960621624087933294844 +1.8305183974665968,2.588743943870725038369059 +1.185348749521472,1.676336277715254556988576 +1.0271286563477868,1.452579276109094137159438 +1.6738466904318436,2.367176690942032828319263 +1.9692117968295217,2.784886030261401422915702 +1.9075331846281178,2.697659300377825345920520 +1.822473024356686,2.577366068104337344179485 +1.7711187262910024,2.504740123293697209881846 +1.7696522504886765,2.502666213325155884623613 +1.1117641240598655,1.572271902405305932268530 +1.4202141435536508,2.008486103287662746169530 +1.8323100311766067,2.591277696562225862221893 +1.7754061393265599,2.510803440956077775652599 +1.0198571774356497,1.442295852013039910997415 +1.5645771245265676,2.212646188884170720018184 +1.1190315762804477,1.582549631899551783286537 +1.1503634099059523,1.626859535946757803208252 +1.4046053281957813,1.986411904915986230100889 +1.9555114230417352,2.765510775841132837788541 +1.7761459449254395,2.511849684067532927005321 +1.8371405560066438,2.598109090290244315107772 +1.5796466951768882,2.233957780076993586166590 +1.0735091092086035,1.518171141573867147196360 +1.0090615317058538,1.427028503407387266047637 +1.5321089074022922,2.166729195880946094141907 +1.680844012037307,2.377072398056765294363467 +1.656323506894671,2.342395167127810183295493 +1.4143384903425975,2.000176674828790112534439 +1.1947987968088403,1.689700662754117745065958 +1.1408589548941512,1.613418206766103776653083 +1.5493906194569997,2.191169227449740077373165 +1.4542289855422008,2.056590354149847948528001 +1.9866534331215708,2.809552228855596026508425 +1.718835397895022,2.430800331190095245906770 +1.3374405436209722,1.891426555656423917459298 +1.4545017615994094,2.056976117749442933268282 +1.5752780000688158,2.227779512205284657086299 +1.5718836653710593,2.222979198040483808770843 +1.3023137404308838,1.841749754182190360528818 +1.2953067694473577,1.831840400786133012000654 +1.0829929408001622,1.531583304833911782068277 +1.3025390180125833,1.842068344793528470865507 +1.8175540346602164,2.570409566162416458766202 +1.3929447398648196,1.969921342753090699609183 +1.841978735670856,2.604951309588570734591059 +1.2689698629504267,1.794594390427221125689365 +1.4471396343649108,2.046564497566498709267563 +1.051389990624227,1.486889984084103068924613 +1.9838373687613302,2.805569712444828225450294 +1.5629655520566212,2.210367081240425463286486 +1.6392235157243458,2.318212127698276219021708 +1.4593581637185924,2.063844107490729020202688 +1.4728123030836082,2.082871133850792143828341 +1.9274761226875512,2.725862873855042588827091 +1.4132568900389793,1.998647061010346315330497 +1.5837284083827718,2.239730194250471659810320 +1.463036973332372,2.069046729939924719529418 +1.729785241884217,2.446285749065484433380360 +1.7892284198642425,2.530351097555394242692465 +1.3177454362525693,1.863573467703634325063231 +1.6588375185475264,2.345950516503242396752458 +1.5188696186824697,2.148006014217199990252748 +1.9044577079354306,2.693309919528264668203946 +1.0499765879463228,1.484891130847916440321657 +1.0802307067885082,1.527676916032182473702054 +1.4136541438759678,1.999208862774320231484611 +1.5309990246192124,2.165159584596470281610063 +1.4430502007496997,2.040781165085442763070906 +1.9229044024597743,2.719397485105545146223224 +1.155594926427539,1.634258017563364489979393 +1.2794742993201922,1.809449906806428698407341 +1.3792314906668917,1.950527879753179046635928 +1.3963358495206093,1.974717096019802856455641 +1.5467178107371178,2.187389305108453941150946 +1.8570098162411903,2.626208467588260389098527 +1.7802080682939314,2.517594394027286820663391 +1.355616814252339,1.917131684096666684686763 +1.6971765855622587,2.400170145044207829015490 +1.656645571488247,2.342850635244005822689332 +1.1168130106184437,1.579412106251330542871177 +1.5190249818975636,2.148225730983079681321536 +1.3508216575711813,1.910350308484469494342992 +1.9144299732284669,2.707412832353259107243462 +1.0328034313307448,1.460604619853408870745033 +1.7737614439833134,2.508477490495686679761164 +1.267923240214942,1.793114242360010755166454 +1.861829955387775,2.633025173741886012081747 +1.3665165328224143,1.932546213924516927808474 +1.284899423480027,1.817122190970825115550801 +1.7489354016832108,2.473368164774833510998627 +1.6251803700055185,2.298352120564329048697081 +1.0697791392107672,1.512896167415682210538096 +1.9225827002694265,2.718942529504910038543874 +1.492677749836065,2.110965118070717146482046 +1.9243000912528598,2.721371287125578785706918 +1.5884222864785862,2.246368340313698299137229 +1.0483689781582404,1.482617627282606591442826 +1.9534850833127857,2.762645098714477033576103 +1.4278469197304497,2.019280478875450034804938 +1.306462799284642,1.847617409484259473310778 +1.2350432586041276,1.746614926435418907167851 +1.1261810492485111,1.592660513534806944053903 +1.6256506749868493,2.299017232247378729334786 +1.8779330071246563,2.655798327903779032492420 +1.8282686164913506,2.585562273103162899362951 +1.251182440928932,1.769439176964769556038449 +1.8047737999602909,2.552335584919470562859686 +1.9929317164263365,2.818431062253616188307083 +1.671092247647476,2.363281320599599544140862 +1.2335682808553534,1.744528992898903979459337 +1.0120506281165103,1.431255724090578395186928 +1.7670789083461373,2.499026957966550814826845 +1.7941525761738664,2.537314906191709325876757 +1.351840358158052,1.911790968670419472674284 +1.840723630302912,2.603176322555017152751757 +1.7368506367660475,2.456277726330890499391548 +1.8657989170681148,2.638638133178761634264915 +1.2609512444046305,1.783254351328259687940174 +1.0365184684020885,1.465858475664421934034258 +1.4781984866777678,2.090488347739084032994641 +1.9658720785029873,2.780162955309510416061011 +1.1475068275369704,1.622819718418507739612668 +1.6776818138078753,2.372600374433790873522454 +1.345228828015867,1.902440853075302981092454 +1.5866142694852428,2.243811418160710993230178 +1.864065837732803,2.636187188878095052904309 +1.2405565024010214,1.754411830585655577081432 +1.2653218489390294,1.789435319536576057286982 +1.4727210937657118,2.082742144396408238355174 +1.6910713988863897,2.391536107246374359058995 +1.8672713208895086,2.640720426632266714766741 +1.757430434826903,2.485381955859451905385330 +1.1837714469997023,1.674105635097002426515071 +1.931859727159037,2.732062226750697122673530 +1.718542254353618,2.430385763618119668481360 +1.7862794535379969,2.526180629381836098846288 +1.8412808450888083,2.603964343262386549696369 +1.5296568355427245,2.163261442601231966166366 +1.7493573122416453,2.473964836408679895409753 +1.5266294632982773,2.158980091714782919444865 +1.6194395892063713,2.290233430499564032373429 +1.840751743495669,2.603216080613495830502329 +1.3457240728582383,1.903141235048079627514041 +1.0515889755582701,1.487171391276534784498035 +1.368105829081475,1.934793818248709364869017 +1.4519508061063582,2.053368521894159813330197 +1.2370816609592123,1.749497662691553074132964 +1.0474245705216192,1.481282033194488196087626 +1.0719753081729821,1.516002019347309470268164 +1.9894321587822918,2.813481940371101825893351 +1.3918235499292264,1.968335740740178606224114 +1.9288342698081316,2.727783583932665294497705 +1.4959417520382303,2.115581114252634923808746 +1.2218964944857378,1.728022594317872120547870 +1.654910240548976,2.340396506694482934387885 +1.2585659009653656,1.779880966285533602376926 +1.703253816777485,2.408764647850458141725763 +1.9749103179180798,2.792944956070309326828424 +1.9973129988535312,2.824627131282741860141634 +1.5557152184033067,2.200113561056178011573190 +1.1959754165021885,1.691364654282206123072567 +1.6962921700999678,2.398919392702663568306016 +1.4174088556955924,2.004518827152435920041213 +1.563150307580082,2.210628365007427161457624 +1.9176280065807239,2.711935534492942436742597 +1.8145798338538175,2.566203411044786174444559 +1.486713683850971,2.102530655067708966341208 +1.4846846951817398,2.099661231773781051109221 +1.0125009810576566,1.431892619327802204282401 +1.3311331945999374,1.882506617128255835571619 +1.4121889161030126,1.997136717785841242894748 +1.0179256387196558,1.439564243764632565476716 +1.8825569346323408,2.662337548896576444516302 +1.1632345203813024,1.645062034943800266741238 +1.986064712563319,2.808719652257668520470307 +1.1035685861387443,1.560681661526313394974440 +1.4293744571344789,2.021440742989260193950499 +1.0485713164190926,1.482903776795290832456603 +1.2244254293345003,1.731599048279349982244266 +1.6426413763070413,2.323045712488624679822899 +1.6568824777602047,2.343185671306819515501528 +1.8565735966421748,2.625591559915159688453029 +1.6035516448028935,2.267764484045935944364618 +1.3822402907495694,1.954782965636571262986970 +1.388664507643101,1.963868180295029955326633 +1.7468888672746647,2.470473928058404451740247 +1.223293749810238,1.729998611747878467063829 +1.7571593336411278,2.484998560885753155113766 +1.0324426123294892,1.460094344728271259624268 +1.2532100419449148,1.772306637820653842818003 +1.420267024571095,2.008560888339724525088534 +1.8900713843621608,2.672964585618258829957701 +1.104639721371836,1.562196475500087284050855 +1.6134621919610865,2.281780114247590707476431 +1.0498939170990538,1.484774216614495768255290 +1.5177513777634934,2.146424582743583186674342 +1.5768402096266985,2.229988810149311199402904 +1.8245170456061406,2.580256750677094803574486 +1.3064511519969078,1.847600937731980786568706 +1.261077215209351,1.783432500948758532876715 +1.834445105136053,2.594297147112344504082475 +1.9460083423589292,2.752071390255182776152190 +1.7098495744150355,2.418092457755607815861402 +1.3172978520916034,1.862940488112892955317720 +1.7127702311916724,2.422222890180164589335030 +1.122969872785387,1.588119224229483450569889 +1.6701263940731514,2.361915397375523079929158 +1.8847824671768052,2.665484927204460770130425 +1.5683571881134226,2.217992006075333761972759 +1.4907971289518671,2.108305518510602342703389 +1.341856533977194,1.897671709109501518688172 +1.5192870482339114,2.148596348750184074087734 +1.4528010257422528,2.054570914034237871594822 +1.0702959266838667,1.513627015269004154861899 +1.8983296079619345,2.684643477434168336539890 +1.532535697418668,2.167332768110390028582794 +1.6075744099596703,2.273453533088891621313695 +1.681440443962366,2.377915880174216157500992 +1.3495734687873933,1.908585102978034422140017 +1.9064410485110574,2.696114786669121062532461 +1.0932261220538473,1.546055208549095374327988 +1.7784176953681048,2.515062424353877212343407 +1.040074683421555,1.470887723175666455719131 +1.1844258494423094,1.675031099906587569411929 +1.6987441661637208,2.402387038790908525917812 +1.6698760718753276,2.361561388328397567496137 +1.5774468962482748,2.230846794597654813864348 +1.8250633923993167,2.581029401721763508419418 +1.54983887745029,2.191803159983293354481204 +1.8138897894446995,2.565227540882771744764457 +1.3055733524405777,1.846359541694373744208759 +1.2753128020851183,1.803564660976809104891392 +1.1715645252441644,1.656842440795493627881713 +1.4591216102380233,2.063509570350281699060322 +1.9409476150587202,2.744914441071755414491911 +1.7923395249976966,2.534750864629093487628017 +1.1754238923618998,1.662300410115571762972866 +1.4089365920476147,1.992537236997465293416353 +1.7283838182541393,2.444303836761198457902264 +1.9699785639170797,2.785970402675807211824282 +1.2604800866874535,1.782588033694611249788689 +1.5164634094574618,2.144603120497286572687097 +1.4622077377312763,2.067874013706452557179790 +1.054983191971923,1.491971538162352076146674 +1.468780424945466,2.077169197105995692113454 +1.1872132495670087,1.678973078966697699973902 +1.681932028544324,2.378611085757074628613386 +1.4131583093695073,1.998507646890591204026587 +1.3290009968027061,1.879491234085749316192195 +1.5805755476460415,2.235271375836313930300351 +1.6400353551851086,2.319360242074156627636504 +1.5245395328373097,2.156024483712465863914373 +1.7194413424773383,2.431657266236453501777262 +1.1357061121321048,1.606130986647241695047234 +1.1348121969018194,1.604866799604960257400795 +1.3395563636887649,1.894418777091837445701432 +1.9713778855482802,2.787949342304772986658090 +1.6256006467962438,2.298946481701723429255731 +1.6842935751696673,2.381950817022811494333583 +1.5920387445144488,2.251482784315768402873138 +1.5712191542263756,2.222039437367324066878779 +1.7385237395982291,2.458643851047406687916448 +1.6816708537684275,2.378241728846852060353141 +1.966354419954078,2.780845089131337470748326 +1.1480525899964498,1.623591543090537531203084 +1.956146699454677,2.766409192360170876022043 +1.2392095936318872,1.752507013937066688122339 +1.5607089111984365,2.207175709133375290793772 +1.1299470318613047,1.597986417221480909847993 +1.656110718027215,2.342094238225532032671740 +1.92940390274535,2.728589166558054056888803 +1.0767629722030165,1.522772798750669931801658 +1.167405600330632,1.650960832777884564296702 +1.8804486216979224,2.659355944150995357946932 +1.725428742529614,2.440124728593735196727932 +1.104523908322112,1.562032691114467702809133 +1.8971584234002303,2.682987172342964303327518 +1.5703937210057008,2.220872098511812541794051 +1.9657280502109744,2.779959268545580373464906 +1.6313646296152458,2.307097984377641453042263 +1.1560974735526874,1.634968726523481139622950 +1.063953284960734,1.504657165322876429523901 +1.0449698543312609,1.477810540266306660640338 +1.952216561985754,2.760851138649629441456289 +1.0506053650253855,1.485780355920836286755724 +1.6563648482287805,2.342453632603194579023954 +1.9058521965730915,2.695282024272219887512624 +1.8092683284903288,2.558691808123123050392040 +1.3442561017520926,1.901065210400596679098597 +1.2105731554374004,1.712008974664364546033429 +1.8375697575993368,2.598716073003622883084651 +1.24714121149275,1.763724015487459574984674 +1.326307426777787,1.875681950825307088244326 +1.3262904542135308,1.875657947994747641030877 +1.4990277947258757,2.119945437675565281608028 +1.5424435534917322,2.181344592542958231985027 +1.5770488668013514,2.230283895955591788168528 +1.113521110571732,1.574756656559294146989360 +1.4033707509390843,1.984665949015767868002378 +1.8894495256946573,2.672085144656796080174838 +1.4437399980339793,2.041756685760159169735507 +1.5974559817694578,2.259143914712394895782435 +1.1417487677660054,1.614676592197454124702900 +1.014076524155463,1.434120773744823316108888 +1.1652920387772867,1.647971805364233452158105 +1.5494332131104518,2.191229463972122985949000 +1.628189624050465,2.302607848447318416762710 +1.1241249198643217,1.589752707473692426007045 +1.9411670029138508,2.745224702351901121108661 +1.9808704551023468,2.801373862909903940818230 +1.0482403695263869,1.482435747211201139600167 +1.239227694403312,1.752532612293505103446674 +1.648213551164587,2.330925957744080158445396 +1.381684080484767,1.953996365536556494689753 +1.6452470770546954,2.326730729825442813111885 +1.3545303346936288,1.915595169969497558616156 +1.1517597919775242,1.628834318410629406346252 +1.810091458403308,2.559855889609653335507207 +1.5918598961481791,2.251229854530581535816712 +1.4605039395076846,2.065464479151102017257638 +1.7466506978664156,2.470137105651116105278376 +1.1566106509273786,1.635694468926672373232307 +1.2316812328451758,1.741860304010061678887917 +1.9348135537098383,2.736239568319738120149353 +1.3855364738072171,1.959444472420761018830902 +1.3696543227468438,1.936983718991522903510721 +1.562988914829022,2.210400121190009126909332 +1.0388359597612105,1.469135903375174665767967 +1.5935281202990548,2.253589079749828208008878 +1.0331936988895565,1.461156541528034564490803 +1.323240906472221,1.871345236219883193916112 +1.7705074565178045,2.503875657290171985617925 +1.0359719174943183,1.465085535958125952595669 +1.565371018980697,2.213768925188293406378137 +1.1078056494769801,1.566673773963880303079152 +1.979052867512513,2.798803405889559872832443 +1.0561597090294679,1.493635384541495284206691 +1.0263647598416192,1.451498963309822503118764 +1.1194305877447503,1.583113919323910948252299 +1.7720475423186408,2.506053667516932925292289 +1.3627278368945177,1.927188188759577914676267 +1.4347067142830174,2.028981693366784337105277 +1.302500601480674,1.842014015613082871364417 +1.076266910040191,1.522071260912221829688113 +1.6327255422917895,2.309022605542015025264473 +1.3011545473298742,1.840110407577333348382527 +1.686105497078037,2.384513261559588795732150 +1.0302051111514443,1.456930040216454402833414 +1.1720763390955062,1.657566254885471612034203 +1.5905381920331674,2.249360682645687580020846 +1.7089056486099148,2.416757545080132172532524 +1.1362313222126115,1.606873745866189271765930 +1.8469499999898433,2.611981739010624196162090 +1.8000618676059974,2.545671906279044167432038 +1.377678963447933,1.948332274704174254843357 +1.25505892915067,1.774921359182330880134382 +1.0987698908275232,1.553895281535488301290428 +1.163171137010168,1.644972397320713187004790 +1.5145019713263403,2.141829228090498832078028 +1.477127142064092,2.088973237656448264941452 +1.6357168983105128,2.313253021793579982452967 +1.1456637600469093,1.620213227377694343850222 +1.5859140850223992,2.242821207797194668698519 +1.4532219449259076,2.055166183652425548243052 +1.9130130929116176,2.705409060992911369748619 +1.7604839634734915,2.489700297484552091014481 +1.0444642544805964,1.477095514100363182507576 +1.4553278872895985,2.058144435904733247321680 +1.9830713000890041,2.804486327738715515167890 +1.2632360015393425,1.786485485854898076643968 +1.7989163538832018,2.544051905236382152756974 +1.5649560840729382,2.213182118614238738667376 +1.9091488937653602,2.699944258152563687200336 +1.6726888799592767,2.365539299669071099929768 +1.6410978331774175,2.320862812860602900560396 +1.8538773835597524,2.621778538806950155604860 +1.9059667534361724,2.695444032141651853507043 +1.7875986995399427,2.528046324969894293586879 +1.773633969052809,2.508297213720104693963553 +1.6893515310153784,2.389103846777700431149378 +1.017728138457035,1.439284936214661859609732 +1.0719041286802835,1.515901356343372221923249 +1.2076469577113067,1.707870706153937518059370 +1.587149567616321,2.244568444037594784441351 +1.5353476664847245,2.171309492900580920161457 +1.9772229605977132,2.796215526712769710950352 +1.7774948514803146,2.513757326011811223355524 +1.830300198003903,2.588435363231281019619731 +1.5737828811639463,2.225665094772657758259694 +1.7918221214152947,2.534019145465640407365608 +1.503107006925884,2.125714314892614947684374 +1.8936640358547858,2.678045362084009046456701 +1.745008814306506,2.467815131652854410884017 +1.1156524601442528,1.577770840030911179432535 +1.9946783885960349,2.820901229725023264954444 +1.4572764282861026,2.060900089008829331219843 +1.1692971116046218,1.653635833674942690396638 +1.4787474179041449,2.091264653724236643264004 +1.7758738453833383,2.511464877204777790119554 +1.1082352111910592,1.567281265965807116363791 +1.4969376342784224,2.116989504423241080430929 +1.1848977146793274,1.675698418124390708376509 +1.3897514673603426,1.965405373468906247596515 +1.5296900656158576,2.163308437021335532822312 +1.9521632070317976,2.760775683350124324225131 +1.2449338480346797,1.760602332147969672892912 +1.6775864348122493,2.372465488164611131106898 +1.7380786312508496,2.458014372785817065567403 +1.7977641510365974,2.542422444344109260836289 +1.3193494289401597,1.865841855916371900057085 +1.0546847427349662,1.491549467203767759189408 +1.6338757074626928,2.310649184725675758687871 +1.3672997533544846,1.933653855023299904160312 +1.143755207229907,1.617514126099384462586203 +1.5956081815174887,2.256530730535503818511633 +1.999209915751683,2.827309776886802762246492 +1.9795593740716657,2.799519714334944610585849 +1.331912819081764,1.883609172644013049632237 +1.7874803007889595,2.527878883850485839829680 +1.4815942977029244,2.095290749746116616036371 +1.6332722779643398,2.309795806545168932809910 +1.6475532171934013,2.329992104486333656435592 +1.4096898023888944,1.993602437277422756276291 +1.0131532535232535,1.432815071895011804987929 +1.479810496905364,2.092768074465634820857732 +1.3539033301276304,1.914708451608592763021763 +1.1937767144185678,1.688255219975931720350111 +1.290007556902311,1.824346182535030441003916 +1.118947155183542,1.582430242439357240795577 +1.993967130682093,2.819895359136781452234992 +1.0833186061736924,1.532043865221953465078760 +1.5555349749019145,2.199858658251979506226395 +1.3872933776725496,1.961929109694899881538533 +1.3815866759828714,1.953858614768939614468966 +1.8523060864825325,2.619556389169828534418190 +1.7833974537926043,2.522104866255146070075537 +1.5601677612870666,2.206410407589438998256729 +1.4764047973575412,2.087951687975735783322810 +1.5449273800867642,2.184857253800235458088541 +1.767056979312259,2.498995945629430354648550 +1.9295344657617477,2.728773810546588009429267 +1.9165639659912395,2.710430753860378143797790 +1.2674048713747328,1.792381158115875176356084 +1.1868164336748377,1.678411896550224294153861 +1.1528910917225264,1.630434217853120664684873 + diff --git a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.1.properties b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.1.properties index d21ad8a..39424da 100644 --- a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.1.properties +++ b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.1.properties @@ -16,6 +16,7 @@ parameters = 2.1 1.4 mean = 2.1 variance = 1.96 + # Quantiles computed using R cdf.points = \ -Inf, -2.226325228634938, -1.156887023657177, -0.643949578356075, -0.2027950777320613, 0.305827808237559,\ @@ -30,8 +31,48 @@ pdf.values = \ 0.0417464784321681450785 0.0736683145538366834781 0.1253559513803476632710 \ 0.0024050643407599906973 0.0190372444310413987956 0.0417464784321682005896 \ 0.0736683145538367945004 0.1253559513803478020488 0.0000000000000000000000 -# Computed using WolframAlpha +sf.values = \ + 1.00000000000000000000000 0.99899999999999999911182 \ + 0.98999999999999999111822 0.97499999999999997779554 \ + 0.94999999999999995559108 0.90000000000000002220446 \ + 0.00099999999999999806925 0.00999999999999996204425 \ + 0.02500000000000006383782 0.05000000000000011379786 \ + 0.10000000000000008881784 0.00000000000000000000000 + +# High-precision computation. +# This is a reference for which computation using the error function is the most accurate: +# dev = x - u +# cdf = 0.5 * erfc(-dev / (sd * sqrt(2))) +# = 0.5 * erfc(-dev / sd / sqrt(2)) +# = 0.5 * erfc(sqrt(0.5) * -dev / sd) +# +# Compute to high precision using Matlab's VPA. +# Values must use Matlab's vpa with the same double values (if not machine representable). +# Compute the exact representation using BigDecimal, e.g.: +# jshell> new BigDecimal(2.1) +# $1 ==> 2.100000000000000088817841970012523233890533447265625 +# +# E.g. +# u = sym('2.100000000000000088817841970012523233890533447265625'); +# s = sym('1.399999999999999911182158029987476766109466552734375'); +# x = sym('-10.300000000000000710542735760100185871124267578125'); +# vpa(erfc(((u - x)/s)/sqrt(sym(2)))/sym(2)) +# +# Values can vary in the extreme tail, e.g. +# Mathematica: 2.741222634611109e-18 4.1045652533919113e-19 +# matlab (standard precision): 2.7412226346111088e-18 4.1045652533919113e-19 +# scipy: 2.7412226346110703e-18 4.1045652533918685e-19 cdf.hp.points = -10, -10.3 -cdf.hp.values = 2.741222634611109e-18, 4.1045652533919113e-19 +cdf.hp.values = 2.74122263461107252124815886312e-18, 4.10456525339188007632261800065e-19 + +# E.g. +# x = sym(14.5) +# x = sym('13.9000000000000003552713678800500929355621337890625') +# vpa(erfc(((x - u)/s)/sqrt(sym(2)))/sym(2)) +# +# Values can vary in the extreme tail, e.g. +# Mathematica: 4.1045652533919576e-19 1.749552800697539e-17 +# matlab (standard precision): 4.1045652533919113e-19 1.7495528006975397e-17 +# scipy: 4.1045652533918685e-19 1.7495528006975224e-17 sf.hp.points = 14.5, 13.9 -sf.hp.values = 4.1045652533919576e-19, 1.749552800697539e-17 +sf.hp.values = 4.10456525339190342717686865166e-19, 1.74955280069751640746342569694e-17 diff --git a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.2.properties b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.2.properties index 236ec52..cc5c781 100644 --- a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.2.properties +++ b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.2.properties @@ -14,8 +14,6 @@ # limitations under the License. parameters = 2.1 1.4 -# Limited by the probability(x0, x1) test -tolerance.relative = 1e-11 mean = 2.1 variance = 1.96 # Quantiles computed using R diff --git a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.3.properties b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.3.properties index 11dbbc3..6d4eadb 100644 --- a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.3.properties +++ b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.3.properties @@ -14,8 +14,6 @@ # limitations under the License. parameters = 0.0 1.0 -# Limited by the probability(x0, x1) test -tolerance.relative = 1e-11 mean = 0 variance = 1 # Quantiles computed using R diff --git a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.4.properties b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.4.properties index 192d05d..95be72c 100644 --- a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.4.properties +++ b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.normal.4.properties @@ -14,8 +14,6 @@ # limitations under the License. parameters = -1.0 0.1 -# Limited by the probability(x0, x1) test -tolerance.relative = 1e-11 mean = -1 variance = 0.01 # Quantiles computed using R
