Corrected the fix for MATH-1208.
This commit is contained in:
parent
d41364faa4
commit
13abd04b46
|
@ -637,7 +637,11 @@ public class EmpiricalDistribution extends AbstractRealDistribution {
|
|||
final double pB = pB(binIndex);
|
||||
final RealDistribution kernel = k(x);
|
||||
if (kernel instanceof ConstantRealDistribution) {
|
||||
return pBminus + pB;
|
||||
if (x < kernel.getNumericalMean()) {
|
||||
return pBminus;
|
||||
} else {
|
||||
return pBminus + pB;
|
||||
}
|
||||
}
|
||||
final double[] binBounds = getUpperBounds();
|
||||
final double kB = kB(binIndex);
|
||||
|
|
|
@ -448,7 +448,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
|
|||
Assert.assertEquals(0.5, dist.cumulativeProbability(0), Double.MIN_VALUE);
|
||||
Assert.assertEquals(1.0, dist.cumulativeProbability(1), Double.MIN_VALUE);
|
||||
Assert.assertEquals(0.5, dist.cumulativeProbability(0.5), Double.MIN_VALUE);
|
||||
Assert.assertEquals(1.0, dist.cumulativeProbability(0.7), Double.MIN_VALUE);
|
||||
Assert.assertEquals(0.5, dist.cumulativeProbability(0.7), Double.MIN_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -488,11 +488,11 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
|
|||
Assert.assertTrue(Arrays.binarySearch(values, dist.sample()) >= 0);
|
||||
}
|
||||
final double tol = 10E-12;
|
||||
Assert.assertEquals(0.2, dist.cumulativeProbability(1), tol);
|
||||
Assert.assertEquals(0.0, dist.cumulativeProbability(1), tol);
|
||||
Assert.assertEquals(0.2, dist.cumulativeProbability(2), tol);
|
||||
Assert.assertEquals(0.8, dist.cumulativeProbability(10), tol);
|
||||
Assert.assertEquals(0.6, dist.cumulativeProbability(10), tol);
|
||||
Assert.assertEquals(0.8, dist.cumulativeProbability(12), tol);
|
||||
Assert.assertEquals(1.0, dist.cumulativeProbability(13), tol);
|
||||
Assert.assertEquals(0.8, dist.cumulativeProbability(13), tol);
|
||||
Assert.assertEquals(1.0, dist.cumulativeProbability(15), tol);
|
||||
|
||||
Assert.assertEquals(2.0, dist.inverseCumulativeProbability(0.1), tol);
|
||||
|
|
Loading…
Reference in New Issue