Changed Poisson consistency test to use a fixed seed.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@949613 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
aa0d77a177
commit
c98ff85082
|
@ -196,7 +196,7 @@ public class RandomDataTest extends RetryTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure that empirical distribution of random Poisson(4)'s has P(X <=
|
* Make sure that empirical distribution of random Poisson(4)'s has P(X <=
|
||||||
* 5) close to actual cumulative Poisson probablity and that nextPoisson
|
* 5) close to actual cumulative Poisson probability and that nextPoisson
|
||||||
* fails when mean is non-positive TODO: replace with statistical test,
|
* fails when mean is non-positive TODO: replace with statistical test,
|
||||||
* adding test stat to TestStatistic
|
* adding test stat to TestStatistic
|
||||||
*/
|
*/
|
||||||
|
@ -260,14 +260,15 @@ public class RandomDataTest extends RetryTestCase {
|
||||||
* to the corresponding expected distribution computed using PoissonDistributionImpl.
|
* to the corresponding expected distribution computed using PoissonDistributionImpl.
|
||||||
* Uses ChiSquare test of goodness of fit to evaluate the null hypothesis that the
|
* Uses ChiSquare test of goodness of fit to evaluate the null hypothesis that the
|
||||||
* distributions are the same. If the null hypothesis can be rejected with confidence
|
* distributions are the same. If the null hypothesis can be rejected with confidence
|
||||||
* 1 - alpha, the check fails. This check will fail randomly with probability alpha.
|
* 1 - alpha, the check fails.
|
||||||
*/
|
*/
|
||||||
public void checkNextPoissonConsistency(double mean) throws Exception {
|
public void checkNextPoissonConsistency(double mean) throws Exception {
|
||||||
// Generate sample values
|
// Generate sample values
|
||||||
int sampleSize = 1000; // Number of deviates to generate
|
final int sampleSize = 1000; // Number of deviates to generate
|
||||||
int minExpectedCount = 7; // Minimum size of expected bin count
|
final int minExpectedCount = 7; // Minimum size of expected bin count
|
||||||
long maxObservedValue = 0;
|
long maxObservedValue = 0;
|
||||||
double alpha = 0.001; // Probability of false failure
|
final double alpha = 0.001; // Probability of false failure
|
||||||
|
randomData.reSeed(1000); // Reseed randomGenerator to get fixed sequence
|
||||||
Frequency frequency = new Frequency();
|
Frequency frequency = new Frequency();
|
||||||
for (int i = 0; i < sampleSize; i++) {
|
for (int i = 0; i < sampleSize; i++) {
|
||||||
long value = randomData.nextPoisson(mean);
|
long value = randomData.nextPoisson(mean);
|
||||||
|
|
Loading…
Reference in New Issue