Author: psteitz
Date: Sat Aug 20 21:08:34 2011
New Revision: 1159916
URL: http://svn.apache.org/viewvc?rev=1159916&view=rev
Log:
Eliminated pluggability of ChiSquaredDistribution used by
ChiSquaredDistributionTest. JIRA: MATH-506.
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=1159916&r1=1159915&r2=1159916&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 Aug 20 21:08:34 2011
@@ -35,26 +35,13 @@ import org.apache.commons.math.util.Math
*/
public class ChiSquareTestImpl implements UnknownDistributionChiSquareTest {
- /** Distribution used to compute inference statistics. */
- private ChiSquaredDistribution distribution;
-
/**
* Construct a ChiSquareTestImpl
*/
public ChiSquareTestImpl() {
- this(new ChiSquaredDistributionImpl(1.0));
- }
-
- /**
- * Create a test instance using the given distribution for computing
- * inference statistics.
- * @param x distribution used to compute inference statistics.
- * @since 1.2
- */
- public ChiSquareTestImpl(ChiSquaredDistribution x) {
super();
- setDistribution(x);
}
+
/**
* {@inheritDoc}
* <p><strong>Note: </strong>This implementation rescales the
@@ -114,7 +101,8 @@ public class ChiSquareTestImpl implement
*/
public double chiSquareTest(double[] expected, long[] observed)
throws MathException {
- distribution = new ChiSquaredDistributionImpl(expected.length - 1.0);
+ ChiSquaredDistribution distribution =
+ new ChiSquaredDistributionImpl(expected.length - 1.0);
return 1.0 - distribution.cumulativeProbability(
chiSquare(expected, observed));
}
@@ -188,7 +176,7 @@ public class ChiSquareTestImpl implement
throws MathException {
checkArray(counts);
double df = ((double) counts.length -1) * ((double) counts[0].length -
1);
- distribution = new ChiSquaredDistributionImpl(df);
+ ChiSquaredDistribution distribution = new
ChiSquaredDistributionImpl(df);
return 1 - distribution.cumulativeProbability(chiSquare(counts));
}
@@ -282,7 +270,8 @@ public class ChiSquareTestImpl implement
*/
public double chiSquareTestDataSetsComparison(long[] observed1, long[]
observed2)
throws MathException {
- distribution = new ChiSquaredDistributionImpl((double)
observed1.length - 1);
+ ChiSquaredDistribution distribution =
+ new ChiSquaredDistributionImpl((double) observed1.length - 1);
return 1 - distribution.cumulativeProbability(
chiSquareDataSetsComparison(observed1, observed2));
}
@@ -401,15 +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=1159916&r1=1159915&r2=1159916&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Sat Aug 20 21:08:34 2011
@@ -52,6 +52,9 @@ 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="psteitz" type="update" issue="MATH-506">
+ Eliminated pluggability of ChiSquaredDistribution used by
ChiSquaredDistributionTest.
+ </action>
<action dev="luc" type="add" issue="MATH-593">
Added a 3D SubLine class.
</action>