Adapt to "Commons Statistics" API change.
This commit is contained in:
parent
f49e77a806
commit
8e63d421bf
|
@ -202,17 +202,6 @@ public abstract class AbstractRealDistribution
|
|||
return SOLVER_DEFAULT_ABSOLUTE_ACCURACY;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return zero.
|
||||
* @since 3.1
|
||||
*/
|
||||
@Override
|
||||
public double probability(double x) {
|
||||
return 0d;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>
|
||||
|
|
|
@ -303,15 +303,6 @@ public final class EmpiricalDistribution extends AbstractRealDistribution
|
|||
|
||||
// Distribution methods.
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @since 3.1
|
||||
*/
|
||||
@Override
|
||||
public double probability(double x) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
|
|
|
@ -122,14 +122,6 @@ public class EnumeratedRealDistribution
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public double probability(final double x) {
|
||||
return innerDistribution.probability(x);
|
||||
}
|
||||
|
||||
/**
|
||||
* For a random variable {@code X} whose values are distributed according to
|
||||
* this distribution, this method returns {@code P(X = x)}. In other words,
|
||||
|
@ -141,7 +133,7 @@ public class EnumeratedRealDistribution
|
|||
*/
|
||||
@Override
|
||||
public double density(final double x) {
|
||||
return probability(x);
|
||||
return innerDistribution.probability(x);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,11 +96,6 @@ public class AbstractRealDistributionTest {
|
|||
public boolean isSupportConnected() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double probability(final double x) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
};
|
||||
final double expected = x1;
|
||||
final double actual = distribution.inverseCumulativeProbability(p12);
|
||||
|
@ -196,11 +191,6 @@ public class AbstractRealDistributionTest {
|
|||
public boolean isSupportConnected() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double probability(final double x) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
};
|
||||
final double expected = x2;
|
||||
final double actual = distribution.inverseCumulativeProbability(p23);
|
||||
|
|
|
@ -99,7 +99,7 @@ public class EnumeratedRealDistributionTest {
|
|||
double[] points = new double[]{-2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
|
||||
double[] results = new double[]{0, 0.2, 0, 0, 0, 0.5, 0, 0, 0, 0.3, 0};
|
||||
for (int p = 0; p < points.length; p++) {
|
||||
double density = testDistribution.probability(points[p]);
|
||||
double density = testDistribution.density(points[p]);
|
||||
Assert.assertEquals(results[p], density, 0.0);
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ public class EnumeratedRealDistributionTest {
|
|||
public void testCreateFromDoubles() {
|
||||
final double[] data = new double[] {0, 1, 1, 2, 2, 2};
|
||||
EnumeratedRealDistribution distribution = new EnumeratedRealDistribution(data);
|
||||
assertEquals(0.5, distribution.probability(2), 0);
|
||||
assertEquals(0.5, distribution.density(2), 0);
|
||||
assertEquals(0.5, distribution.cumulativeProbability(1), 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue