[
https://issues.apache.org/jira/browse/MATH-1065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13830953#comment-13830953
]
Thomas Neidhart commented on MATH-1065:
---------------------------------------
For the other failing tests: I am not sure what the enumerated distribution
tries to achieve:
* a discrete probability distribution
* a distribution with continuous and discrete parts
in case of a discrete probability distribution the inverseCumulativeProbability
method is clearly wrong, and would have to fixed like this:
{noformat}
public double inverseCumulativeProbability(final double p) throws
OutOfRangeException {
double probability = 0;
double x = getSupportLowerBound();
for (final Pair<Double, Double> sample : innerDistribution.getPmf()) {
if (sample.getValue() == 0.0) {
continue;
}
probability += sample.getValue();
if (probability <= p) {
x = sample.getKey();
}
if (probability >= p) {
break;
}
}
return x;
}
{noformat}
But then your other test cases are wrong imho:
{noformat}
inverseCumulativeProbability(0.5) = 14 instead of 18
inverseCumulativeProbability(0.5624) = 14 instead of 18
inverseCumulativeProbability(0.5626) = 18 instead of 28
inverseCumulativeProbability(0.7600) = 28 instead of 31
{noformat}
> EnumeratedRealDistribution.inverseCumulativeProbability returns values not in
> the samples set
> ---------------------------------------------------------------------------------------------
>
> Key: MATH-1065
> URL: https://issues.apache.org/jira/browse/MATH-1065
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.2
> Reporter: matteodg
> Fix For: 4.0, 3.3
>
> Attachments: EnumeratedRealDistributionTest.java
>
>
> The method EnumeratedRealDistribution.inverseCumulativeProbability()
> sometimes returns values that are not in the initial samples domain...
> I will attach a test to exploit this bug.
--
This message was sent by Atlassian JIRA
(v6.1#6144)