You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2022/11/29 16:26:40 UTC
[commons-statistics] 02/14: Additional gamma distribution test data
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 5888cd9278e288faf11cbf5130167bf624ed85ba
Author: aherbert <ah...@apache.org>
AuthorDate: Tue Nov 29 13:22:32 2022 +0000
Additional gamma distribution test data
---
.../distribution/GammaDistributionTest.java | 6 ++-
.../distribution/test.gamma.1.properties | 1 -
.../distribution/test.gamma.2.properties | 53 +++++++++++++++++++
.../distribution/test.gamma.3.properties | 60 ++++++++++++++++++++++
4 files changed, 118 insertions(+), 2 deletions(-)
diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GammaDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GammaDistributionTest.java
index 67b2895..92825d6 100644
--- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GammaDistributionTest.java
+++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/GammaDistributionTest.java
@@ -77,7 +77,11 @@ class GammaDistributionTest extends BaseContinuousDistributionTest {
static Stream<Arguments> testAdditionalMoments() {
return Stream.of(
Arguments.of(1, 2, 2, 4),
- Arguments.of(1.1, 4.2, 1.1 * 4.2, 1.1 * 4.2 * 4.2)
+ Arguments.of(1.1, 4.2, 1.1 * 4.2, 1.1 * 4.2 * 4.2),
+ // scipy.stats.gamma(shape, scale=scale).stats()
+ Arguments.of(0.5, 10, 5, 50),
+ Arguments.of(0.5, 7.5, 3.75, 28.125),
+ Arguments.of(0.25, 10, 2.5, 25)
);
}
diff --git a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.gamma.1.properties b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.gamma.1.properties
index 1ef2a72..2689bad 100644
--- a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.gamma.1.properties
+++ b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.gamma.1.properties
@@ -43,6 +43,5 @@ sf.values = \
# Computed using WolframAlpha
cdf.hp.points = 1e-4, 9e-5
cdf.hp.values = 2.6040625021701086e-19, 1.7085322417782863e-19
-# These were created using WolframAlpha. NOTE lambda parameter is 1/mean
sf.hp.points = 99, 103
sf.hp.values = 6.833817088979342e-18, 1.0390567840208212e-18
diff --git a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.gamma.2.properties b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.gamma.2.properties
new file mode 100644
index 0000000..593640f
--- /dev/null
+++ b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.gamma.2.properties
@@ -0,0 +1,53 @@
+# 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.
+
+parameters = 2.0 1.5
+# Computed using scipy.stats 1.9.1 gamma(2, scale=1.5)
+mean = 3
+variance = 4.5
+lower = 0
+# x = gamma(2, scale=1.5).ppf([0, 0.001, 0.01, 0.025, 0.05, 0.1, 0.999, 0.990, 0.975, 0.950, 0.900, 1])
+cdf.points = \
+ 0. , 0.06810302665423432, 0.22283211037989892, \
+ 0.36331391781594746, 0.533042266047993 , 0.797717412584418 , \
+ 13.850120214677377 , 9.957528101990716 , 8.357465086408347 , \
+ 7.1157967775858655 , 5.834580254801144 , inf
+cdf.values = \
+ 0. , 0.001 , 0.01 , \
+ 0.025 , 0.05000000000000001, 0.1 , \
+ 0.999 , 0.99 , 0.975 , \
+ 0.95 , 0.9 , 1.
+pdf.values = \
+ 0. , 0.028924512599465293 , \
+ 0.08536478509116208 , 0.126738733780924 , \
+ 0.1660533284534083 , 0.20830692448480803 , \
+ 0.0006015205970584422, 0.005793878058950972 , \
+ 0.014130517689129795 , 0.027530039535819964 , \
+ 0.053032621291739995 , 0
+sf.values = \
+ 1. , 0.999 , 0.99 , \
+ 0.975 , 0.95 , 0.9 , \
+ 0.001000000000000001, 0.010000000000000012, 0.02500000000000001 , \
+ 0.05000000000000006 , 0.09999999999999999 , 0.
+
+cdf.hp.points = 1e-8, 5e-9, 1e-10
+cdf.hp.values = 2.222222212345673e-17, 5.555555543209882e-18, 2.222222222123466e-21
+sf.hp.points = 65, 70, 75
+sf.hp.values = 6.718972090508574e-18, 2.577145630750119e-19, 9.836624224615988e-21
+
+# Overridden tolerances
+cdf.hp.relative = 5e-15
+sf.hp.relative = 2e-15
+sf.mapping.relative 2e-15
diff --git a/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.gamma.3.properties b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.gamma.3.properties
new file mode 100644
index 0000000..86ec3ec
--- /dev/null
+++ b/commons-statistics-distribution/src/test/resources/org/apache/commons/statistics/distribution/test.gamma.3.properties
@@ -0,0 +1,60 @@
+# 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.
+
+parameters = 0.75 1.5
+# Computed using scipy.stats 1.9.1 gamma(0.75, scale=1.5)
+mean = 1.125
+variance = 1.6875
+lower = 0
+# x = gamma(0.75, scale=1.5).ppf([0, 0.001, 0.01, 0.025, 0.05, 0.1, 0.999, 0.990, 0.975, 0.950, 0.900, 1])
+cdf.points = \
+ 0.0000000000000000e+00, 1.3404177822132625e-04, \
+ 2.8908764040751168e-03, 9.8347658722642041e-03, \
+ 2.4924582234367790e-02, 6.3735729590895684e-02, \
+ 9.3196251832156101e+00, 6.0066774608458475e+00, \
+ 4.7068559800002063e+00, 3.7351464632314886e+00, \
+ 2.7781949308648706e+00, inf
+cdf.values = \
+ 0. , 0.0010000000000000002, \
+ 0.009999999999999997 , 0.024999999999999984 , \
+ 0.05000000000000002 , 0.10000000000000002 , \
+ 0.999 , 0.99 , \
+ 0.975 , 0.9500000000000001 , \
+ 0.8999999999999999 , 1.
+pdf.values = \
+ inf, 5.5949847354448776e+00, \
+ 2.5915129578177165e+00, 1.8993687899363925e+00, \
+ 1.4903023373949169e+00, 1.1484144173543773e+00, \
+ 6.9022436893298672e-04, 7.0125816604846708e-03, \
+ 1.7729261533838563e-02, 3.5903367611615174e-02, \
+ 7.3170708934526971e-02, 0.0000000000000000e+00
+sf.values = \
+ 1. , 0.999 , \
+ 0.99 , 0.975 , \
+ 0.95 , 0.9 , \
+ 0.0010000000000000026, 0.009999999999999985 , \
+ 0.025000000000000053 , 0.04999999999999996 , \
+ 0.10000000000000007 , 0. \
+
+cdf.hp.points = 1e-25, 5e-25, 1e-26
+cdf.hp.values = 1.4275341185711014e-19, 4.7732480090874236e-19, 2.5385545301830522e-20
+sf.hp.points = 60, 65, 70
+sf.hp.values = 1.3701874121884675e-18, 4.7933539955510597e-20, 1.6792512418401358e-21
+
+# Overridden tolerances
+cdf.relative = 2e-15
+sf.relative = 2e-15
+cdf.hp.relative = 5e-15
+sf.hp.relative = 4e-15