commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1067435 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java site/xdoc/changes.xml
Date Sat, 05 Feb 2011 12:54:25 GMT
Author: sebb
Date: Sat Feb  5 12:54:25 2011
New Revision: 1067435

URL: http://svn.apache.org/viewvc?rev=1067435&view=rev
Log:
MATH-506 - revert r1067433 as it is incomplete; more discussion needed

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=1067435&r1=1067434&r2=1067435&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:54:25 2011
@@ -36,6 +36,9 @@ import org.apache.commons.math.util.Fast
  */
 public class ChiSquareTestImpl implements UnknownDistributionChiSquareTest {
 
+    /** Distribution used to compute inference statistics. */
+    private ChiSquaredDistribution distribution;
+
     /**
      * Construct a ChiSquareTestImpl
      */
@@ -112,7 +115,7 @@ public class ChiSquareTestImpl implement
      */
     public double chiSquareTest(double[] expected, long[] observed)
         throws MathException {
-        ChiSquaredDistributionImpl distribution = new ChiSquaredDistributionImpl(expected.length
- 1.0);
+        distribution = new ChiSquaredDistributionImpl(expected.length - 1.0);
         return 1.0 - distribution.cumulativeProbability(
             chiSquare(expected, observed));
     }
@@ -186,7 +189,7 @@ public class ChiSquareTestImpl implement
     throws MathException {
         checkArray(counts);
         double df = ((double) counts.length -1) * ((double) counts[0].length - 1);
-        ChiSquaredDistributionImpl distribution = new ChiSquaredDistributionImpl(df);
+        distribution = new ChiSquaredDistributionImpl(df);
         return 1 - distribution.cumulativeProbability(chiSquare(counts));
     }
 
@@ -280,7 +283,7 @@ public class ChiSquareTestImpl implement
      */
     public double chiSquareTestDataSetsComparison(long[] observed1, long[] observed2)
         throws MathException {
-        ChiSquaredDistributionImpl distribution = new ChiSquaredDistributionImpl((double)
observed1.length - 1);
+        distribution = new ChiSquaredDistributionImpl((double) observed1.length - 1);
         return 1 - distribution.cumulativeProbability(
                 chiSquareDataSetsComparison(observed1, observed2));
     }
@@ -390,4 +393,14 @@ 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=1067435&r1=1067434&r2=1067435&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:54:25 2011
@@ -52,10 +52,6 @@ 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>



Mime
View raw message