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/05/04 16:40:38 UTC
[commons-statistics] branch master updated (026ecd1 -> 0b63a90)
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-statistics.git
from 026ecd1 Fix malformed format string
new f38bc57 Remove incomplete test method
new 349bbfe Sonar fix: rename variable to avoid restricted identifier
new 4e30b73 Sonar fix: Compute the value 2^-53 for the assertion
new 0b63a90 Correct user guide table
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../statistics/distribution/TruncatedNormalDistribution.java | 8 ++++----
.../apache/commons/statistics/distribution/FDistributionTest.java | 5 -----
.../org/apache/commons/statistics/distribution/UserGuideTest.java | 7 ++++---
src/site/xdoc/userguide/index.xml | 2 +-
4 files changed, 9 insertions(+), 13 deletions(-)
[commons-statistics] 01/04: Remove incomplete test method
Posted by ah...@apache.org.
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 f38bc5706c62860733b281e64ae63e973490f48a
Author: aherbert <ah...@apache.org>
AuthorDate: Wed May 4 17:26:56 2022 +0100
Remove incomplete test method
---
.../apache/commons/statistics/distribution/FDistributionTest.java | 5 -----
1 file changed, 5 deletions(-)
diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/FDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/FDistributionTest.java
index 0681dbf..a0371e9 100644
--- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/FDistributionTest.java
+++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/FDistributionTest.java
@@ -102,11 +102,6 @@ class FDistributionTest extends BaseContinuousDistributionTest {
Assertions.assertTrue(result < 1.0, "Failing to calculate inverse cumulative probability");
}
- @Test
- void test() {
- FDistribution.of(1e-100, 1).logDensity(1e-300);
- }
-
@Test
void testAdditionalLogDensity() {
// Computed using Boost multiprecision to 100 digits (output 25 digits).
[commons-statistics] 03/04: Sonar fix: Compute the value 2^-53 for the assertion
Posted by ah...@apache.org.
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 4e30b73aae692cc8c1167f265fc2f761fb180dad
Author: aherbert <ah...@apache.org>
AuthorDate: Wed May 4 17:37:41 2022 +0100
Sonar fix: Compute the value 2^-53 for the assertion
---
.../org/apache/commons/statistics/distribution/UserGuideTest.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/UserGuideTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/UserGuideTest.java
index b010210..6e0ac77 100644
--- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/UserGuideTest.java
+++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/UserGuideTest.java
@@ -116,9 +116,10 @@ class UserGuideTest {
Assertions.assertNotEquals(0, q2);
// For the table
- Assertions.assertEquals(0x1.0p-53, 1.110223e-16, 1e-3);
- Assertions.assertEquals(0x1.0p-53, 1 - chi2.cumulativeProbability(166));
- Assertions.assertEquals(0x1.0p-53, 1 - chi2.cumulativeProbability(167));
+ final double eps = Math.pow(2, -53);
+ Assertions.assertEquals(1.110223e-16, eps, 1e-3);
+ Assertions.assertEquals(eps, 1 - chi2.cumulativeProbability(166));
+ Assertions.assertEquals(eps, 1 - chi2.cumulativeProbability(167));
Assertions.assertEquals(0, 1 - chi2.cumulativeProbability(168));
Assertions.assertEquals(0, 1 - chi2.cumulativeProbability(200));
Assertions.assertEquals(1.16583e-16, chi2.survivalProbability(166), 1e-3);
[commons-statistics] 02/04: Sonar fix: rename variable to avoid restricted identifier
Posted by ah...@apache.org.
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 349bbfe9da41444cd191fcc30ad1ae7040db6b57
Author: aherbert <ah...@apache.org>
AuthorDate: Wed May 4 17:30:36 2022 +0100
Sonar fix: rename variable to avoid restricted identifier
---
.../statistics/distribution/TruncatedNormalDistribution.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TruncatedNormalDistribution.java b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TruncatedNormalDistribution.java
index fa24538..8eb439c 100644
--- a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TruncatedNormalDistribution.java
+++ b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TruncatedNormalDistribution.java
@@ -482,21 +482,21 @@ public final class TruncatedNormalDistribution extends AbstractContinuousDistrib
// variance = m2 - m1*m1
// rearrange x^2 - y^2 as (x-y)(x+y)
m2 = Math.sqrt(m2);
- final double var = (m2 - m1) * (m2 + m1);
+ final double variance = (m2 - m1) * (m2 + m1);
// Detect floating-point error.
- if (var >= 1) {
+ if (variance >= 1) {
// Note:
// Extreme truncations in the tails can compute a variance above 1,
// for example if m2 is infinite: m2 - m1*m1 > 1
// Detect no truncation as the terms a and b lie far either side of zero;
// otherwise return 0 to indicate very small unknown variance.
return a < -1 && b > 1 ? 1 : 0;
- } else if (var <= 0) {
+ } else if (variance <= 0) {
// Floating-point error can create negative variance so return 0.
return 0;
}
- return var;
+ return variance;
}
}
[commons-statistics] 04/04: Correct user guide table
Posted by ah...@apache.org.
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 0b63a9057b86f2171b206ae492b2799eaa92f6ea
Author: aherbert <ah...@apache.org>
AuthorDate: Wed May 4 17:38:21 2022 +0100
Correct user guide table
---
src/site/xdoc/userguide/index.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/site/xdoc/userguide/index.xml b/src/site/xdoc/userguide/index.xml
index 51ff115..06218b2 100644
--- a/src/site/xdoc/userguide/index.xml
+++ b/src/site/xdoc/userguide/index.xml
@@ -293,7 +293,7 @@ double q2 = chi2.survivalProbability(168);
<tr><td>166</td><td>1.11e-16</td><td>1.16e-16</td></tr>
<tr><td>167</td><td>1.11e-16</td><td>7.96e-17</td></tr>
<tr><td>168</td><td>0</td><td>5.43e-17</td></tr>
- <tr><td>200</td><td>0</td><td>1.91e-22</td></tr>
+ <tr><td>200</td><td>0</td><td>1.19e-22</td></tr>
</table>
<p>
Probability computations should use the appropriate cumulative or survival function