MATH-506 - revert r1067433 as it is incomplete; more discussion needed
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1067435 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2a8db688b1
commit
80e44be308
|
@ -36,6 +36,9 @@ import org.apache.commons.math.util.FastMath;
|
|||
*/
|
||||
public class ChiSquareTestImpl implements UnknownDistributionChiSquareTest {
|
||||
|
||||
/** Distribution used to compute inference statistics. */
|
||||
private ChiSquaredDistribution distribution;
|
||||
|
||||
/**
|
||||
* Construct a ChiSquareTestImpl
|
||||
*/
|
||||
|
@ -112,7 +115,7 @@ public class ChiSquareTestImpl implements UnknownDistributionChiSquareTest {
|
|||
*/
|
||||
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 implements UnknownDistributionChiSquareTest {
|
|||
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 implements UnknownDistributionChiSquareTest {
|
|||
*/
|
||||
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 implements UnknownDistributionChiSquareTest {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the distribution used to compute inference statistics.
|
||||
*
|
||||
* @param value
|
||||
* the new distribution
|
||||
* @since 1.2
|
||||
*/
|
||||
public void setDistribution(ChiSquaredDistribution value) {
|
||||
distribution = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,10 +52,6 @@ The <action> type attribute can be add,update,fix,remove.
|
|||
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>
|
||||
|
|
Loading…
Reference in New Issue