# commons-issues mailing list archives

##### Site index · List index
Message view
Top
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (MATH-644) for the class of hyper-geometric distribution, for some number the method "upperCumulativeProbability" return a probability greater than 1 which is impossible.
Date Thu, 31 May 2012 23:47:23 GMT
```
[ https://issues.apache.org/jira/browse/MATH-644?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Thomas Neidhart resolved MATH-644.
----------------------------------

Resolution: Fixed

Finally, I found the problem for the described behavior:

In the upperCumulativeProbability function there was a sanity check like this:

{noformat}
if (x < domain[0]) {
ret = 1.0;
} else if (x > domain[1]) {
ret = 0.0;
{noformat}

In fact to be correct, it has to be like this

{noformat}
if (x <= domain[0]) {
ret = 1.0;
} else if (x > domain[1]) {
ret = 0.0;
{noformat}

which is also symmetric to the case of the cumulativeProbability function.
It means that for values of x that are at the lower bound, the probability must be 1.0 as
the upperCumulativeProbability is defined as P(X >= x).

Additionally, the duplicate probability mass functions have been cleaned up. After looking
through the version history it became clear that initially there existed two methods, whereas
the public one called only the private one (which contained the actual computation). Later
on the public one got improved, whereas the private one was still called by the cumulativeProbability
methods.

This has been fixed in the sense that only the public method (which also behaves better for
large values of N, m, k) is used in the class.

> for the class of hyper-geometric distribution, for some number the method "upperCumulativeProbability"
return a probability greater than 1 which is impossible.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MATH-644
>                 URL: https://issues.apache.org/jira/browse/MATH-644
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.2
>            Reporter: marzieh
>            Priority: Minor
>              Labels: hypergeometric, probability
>             Fix For: 3.1
>
>
> In windows 7, I used common.Math library. I used class "HypergeometricDistributionImpl"
and method "upperCumulativeProbability" of zero for distribution and the return value is larget
than 1. the following code is working error.
> HypergeometricDistributionImpl u = new HypergeometricDistributionImpl(14761461, 1035
,1841 );
> System.out.println(u.upperCumulativeProbability(0))
> Thanks

--
This message is automatically generated by JIRA.