Degrees of freedom of chi-square statistics (unit tests).

Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/3e102d6f
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/3e102d6f
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/3e102d6f

Branch: refs/heads/RNG-30__sampling
Commit: 3e102d6fd4320a932308cf8a258183e6bf621236
Parents: fc5d7b5
Author: Gilles <er...@apache.org>
Authored: Fri Nov 11 05:35:47 2016 +0100
Committer: Gilles <er...@apache.org>
Committed: Fri Nov 11 05:35:47 2016 +0100

----------------------------------------------------------------------
 .../commons/rng/ProvidersCommonParametricTest.java       | 11 +++++------
 .../test/java/org/apache/commons/rng/ProvidersList.java  |  2 +-
 .../distribution/ContinuousSamplerParametricTest.java    |  8 ++++----
 .../sampling/distribution/ContinuousSamplersList.java    |  3 +--
 .../rng/simple/ProvidersCommonParametricTest.java        | 11 +++++------
 5 files changed, 16 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rng/blob/3e102d6f/commons-rng-core/src/test/java/org/apache/commons/rng/ProvidersCommonParametricTest.java
----------------------------------------------------------------------
diff --git 
a/commons-rng-core/src/test/java/org/apache/commons/rng/ProvidersCommonParametricTest.java
 
b/commons-rng-core/src/test/java/org/apache/commons/rng/ProvidersCommonParametricTest.java
index 6adc820..471682c 100644
--- 
a/commons-rng-core/src/test/java/org/apache/commons/rng/ProvidersCommonParametricTest.java
+++ 
b/commons-rng-core/src/test/java/org/apache/commons/rng/ProvidersCommonParametricTest.java
@@ -479,8 +479,7 @@ public class ProvidersCommonParametricTest {
      * It performs a chi-square test of homogeneity of the observed
      * distribution with the expected uniform distribution.
      * Tests are performed at the 1% level and an average failure rate
-     * higher than 2% (i.e. more than 20 null hypothesis rejections)
-     * causes the test case to fail.
+     * higher than 2% causes the test case to fail.
      *
      * @param max Upper bound.
      * @param nextMethod method to call.
@@ -491,8 +490,8 @@ public class ProvidersCommonParametricTest {
                                                      Callable<T> nextMethod) {
         final int numTests = 500;
 
-        // Do not change (statistical test assumes that dof = 10).
-        final int numBins = 10;
+        // Do not change (statistical test assumes that dof = 9).
+        final int numBins = 10; // dof = numBins - 1
 
         // Set up bins.
         final long n = max.longValue();
@@ -514,9 +513,9 @@ public class ProvidersCommonParametricTest {
         }
 
         final int[] observed = new int[numBins];
-        // Chi-square critical value with 10 degrees of freedom
+        // Chi-square critical value with 9 degrees of freedom
         // and 1% significance level.
-        final double chi2CriticalValue = 23.209;
+        final double chi2CriticalValue = 21.67;
 
         try {
             for (int i = 0; i < numTests; i++) {

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/3e102d6f/commons-rng-core/src/test/java/org/apache/commons/rng/ProvidersList.java
----------------------------------------------------------------------
diff --git 
a/commons-rng-core/src/test/java/org/apache/commons/rng/ProvidersList.java 
b/commons-rng-core/src/test/java/org/apache/commons/rng/ProvidersList.java
index e5e364f..c9b520e 100644
--- a/commons-rng-core/src/test/java/org/apache/commons/rng/ProvidersList.java
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/ProvidersList.java
@@ -74,7 +74,7 @@ public class ProvidersList {
             // ... add more here.
 
             // "long"-based RNGs.
-            add(LIST64, new SplitMix64(-988777666655555L));
+            add(LIST64, new SplitMix64(-98877766544333L));
             add(LIST64, new XorShift1024Star(new long[] { 123456L, 234567L, 
-345678L }));
             add(LIST64, new TwoCmres(55443322));
             add(LIST64, new TwoCmres(-987654321, 5, 8));

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/3e102d6f/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplerParametricTest.java
----------------------------------------------------------------------
diff --git 
a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplerParametricTest.java
 
b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplerParametricTest.java
index 175e2e9..476106a 100644
--- 
a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplerParametricTest.java
+++ 
b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplerParametricTest.java
@@ -83,8 +83,8 @@ public class ContinuousSamplerParametricTest {
                        double[] deciles) {
         final int numTests = 500;
 
-        // Do not change (statistical test assumes that dof = 10).
-        final int numBins = 10;
+        // Do not change (statistical test assumes that dof = 9).
+        final int numBins = 10; // dof = numBins - 1
 
         // Run the tests.
         int numFailures = 0;
@@ -95,9 +95,9 @@ public class ContinuousSamplerParametricTest {
         }
 
         final long[] observed = new long[numBins];
-        // Chi-square critical value with 10 degrees of freedom
+        // Chi-square critical value with 9 degrees of freedom
         // and 1% significance level.
-        final double chi2CriticalValue = 23.209;
+        final double chi2CriticalValue = 21.67;
 
         try {
             final int lastDecileIndex = numBins - 1;

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/3e102d6f/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
----------------------------------------------------------------------
diff --git 
a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
 
b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
index ddc1eac..25d3708 100644
--- 
a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
+++ 
b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
@@ -26,8 +26,7 @@ import org.apache.commons.rng.sampling.ContinuousSampler;
 import org.apache.commons.rng.simple.RandomSource;
 
 /**
- * The purpose of this class is to provide a list of samplers
- * that use the "inverse method" to sample from distributions.
+ * List of samplers.
  */
 public class ContinuousSamplersList {
     /** List of all RNGs implemented in the library. */

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/3e102d6f/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java
----------------------------------------------------------------------
diff --git 
a/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java
 
b/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java
index a6be9c9..6d9d668 100644
--- 
a/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java
+++ 
b/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java
@@ -279,8 +279,7 @@ public class ProvidersCommonParametricTest {
      * It performs a chi-square test of homogeneity of the observed
      * distribution with the expected uniform distribution.
      * Tests are performed at the 1% level and an average failure rate
-     * higher than 2% (i.e. more than 20 null hypothesis rejections)
-     * causes the test case to fail.
+     * higher than 2% causes the test case to fail.
      *
      * @param max Upper bound.
      * @param nextMethod method to call.
@@ -291,8 +290,8 @@ public class ProvidersCommonParametricTest {
                                                      Callable<T> nextMethod) {
         final int numTests = 500;
 
-        // Do not change (statistical test assumes that dof = 10).
-        final int numBins = 10;
+        // Do not change (statistical test assumes that dof = 9).
+        final int numBins = 10; // dof = numBins - 1
 
         // Set up bins.
         final long n = max.longValue();
@@ -314,9 +313,9 @@ public class ProvidersCommonParametricTest {
         }
 
         final int[] observed = new int[numBins];
-        // Chi-square critical value with 10 degrees of freedom
+        // Chi-square critical value with 9 degrees of freedom
         // and 1% significance level.
-        final double chi2CriticalValue = 23.209;
+        final double chi2CriticalValue = 21.67;
 
         try {
             for (int i = 0; i < numTests; i++) {

Reply via email to