You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2011/02/05 13:46:36 UTC

svn commit: r1067433 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java site/xdoc/changes.xml

Author: sebb
Date: Sat Feb  5 12:46:36 2011
New Revision: 1067433

URL: http://svn.apache.org/viewvc?rev=1067433&view=rev
Log:
MATH-506 The static field ChiSquareTestImpl.distribution serves no purpose.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
    commons/proper/math/trunk/src/site/xdoc/changes.xml

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java?rev=1067433&r1=1067432&r2=1067433&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java Sat Feb  5 12:46:36 2011
@@ -36,9 +36,6 @@ import org.apache.commons.math.util.Fast
  */
 public class ChiSquareTestImpl implements UnknownDistributionChiSquareTest {
 
-    /** Distribution used to compute inference statistics. */
-    private ChiSquaredDistribution distribution;
-
     /**
      * Construct a ChiSquareTestImpl
      */
@@ -115,7 +112,7 @@ public class ChiSquareTestImpl implement
      */
     public double chiSquareTest(double[] expected, long[] observed)
         throws MathException {
-        distribution = new ChiSquaredDistributionImpl(expected.length - 1.0);
+        ChiSquaredDistributionImpl distribution = new ChiSquaredDistributionImpl(expected.length - 1.0);
         return 1.0 - distribution.cumulativeProbability(
             chiSquare(expected, observed));
     }
@@ -189,7 +186,7 @@ public class ChiSquareTestImpl implement
     throws MathException {
         checkArray(counts);
         double df = ((double) counts.length -1) * ((double) counts[0].length - 1);
-        distribution = new ChiSquaredDistributionImpl(df);
+        ChiSquaredDistributionImpl distribution = new ChiSquaredDistributionImpl(df);
         return 1 - distribution.cumulativeProbability(chiSquare(counts));
     }
 
@@ -283,7 +280,7 @@ public class ChiSquareTestImpl implement
      */
     public double chiSquareTestDataSetsComparison(long[] observed1, long[] observed2)
         throws MathException {
-        distribution = new ChiSquaredDistributionImpl((double) observed1.length - 1);
+        ChiSquaredDistributionImpl distribution = new ChiSquaredDistributionImpl((double) observed1.length - 1);
         return 1 - distribution.cumulativeProbability(
                 chiSquareDataSetsComparison(observed1, observed2));
     }
@@ -393,14 +390,4 @@ public class ChiSquareTestImpl implement
         }
     }
 
-    /**
-     * Modify the distribution used to compute inference statistics.
-     *
-     * @param value
-     *            the new distribution
-     * @since 1.2
-     */
-    public void setDistribution(ChiSquaredDistribution value) {
-        distribution = value;
-    }
 }

Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=1067433&r1=1067432&r2=1067433&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Sat Feb  5 12:46:36 2011
@@ -52,6 +52,10 @@ The <action> type attribute can be add,u
     If the output is not quite correct, check for invisible trailing spaces!
      -->
     <release version="3.0" date="TBD" description="TBD">
+      <action dev="sebb" type="fix" issue="MATH-506">
+          The static field ChiSquareTestImpl.distribution serves no purpose.
+          Removed setter and static field, and made other instances local variables. 
+      </action>
       <action dev="sebb" type="fix" issue="MATH-505">
           TestUtils is thread-hostile. Remove getters and setters, and make static variables final.
       </action>