You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Marzieh Ayati <ms...@gmail.com> on 2011/08/11 19:20:51 UTC

[MATH]: question about HypergeometricDistributionImpl class

Hi,

I am using the commons-Math library. I have used the
HypergeometricDistributionImpl. I used upperCumulativeProbability method. I
have got some probability greater that 1 which is impossible.
I would appreciate if you can help me to know why it happens.

Thanks, in advance, for your kind help.


//********************************************************
//My method to compute pvalue
   public static double HyperDist(int allgenes, int numberOfgenesinpathway,
int numberofxoy , int commongene){
       HypergeometricDistributionImpl hyper = new
HypergeometricDistributionImpl(allgenes, numberOfgenesinpathway,
numberofxoy) ;
       return hyper.upperCumulativeProbability(commongene);
    }


-- 

Regards,
Marzieh Ayati

Re: [MATH]: question about HypergeometricDistributionImpl class

Posted by Marzieh Ayati <ms...@gmail.com>.
Thanks for consideration. So can I suppose that this value is 1 or can I
trust on other result?

I was wondering to open JIRA ticket for this.

Thanks


On Thu, Aug 11, 2011 at 6:39 PM, Phil Steitz <ph...@gmail.com> wrote:

> On 8/11/11 3:21 PM, Marzieh Ayati wrote:
> > HypergeometricDistributionImpl u = new
> > HypergeometricDistributionImpl(14761461, 1035 ,1841 );
> >         System.out.println(u.upperCumulativeProbability(0));
>
> Thanks for reporting this.  The value reported should obviously be
> exactly 1.  Due to limited precision in the approximation used to
> compute the distribution, what is returned by the code now in trunk
> (looks unchanged since 2.1) is 1.0000000000666514.  Would you mind
> opening a JIRA ticket for this?  Thanks again for reporting the problem.
>
> Phil
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>


-- 

Regards,
Marzieh Ayati

Re: [MATH]: question about HypergeometricDistributionImpl class

Posted by Phil Steitz <ph...@gmail.com>.
On 8/11/11 3:21 PM, Marzieh Ayati wrote:
> HypergeometricDistributionImpl u = new
> HypergeometricDistributionImpl(14761461, 1035 ,1841 );
>         System.out.println(u.upperCumulativeProbability(0));

Thanks for reporting this.  The value reported should obviously be
exactly 1.  Due to limited precision in the approximation used to
compute the distribution, what is returned by the code now in trunk
(looks unchanged since 2.1) is 1.0000000000666514.  Would you mind
opening a JIRA ticket for this?  Thanks again for reporting the problem.

Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [MATH]: question about HypergeometricDistributionImpl class

Posted by Marzieh Ayati <ms...@gmail.com>.
Thanks for your reply.

here is the code and sample of number that the result is greater than 1:

import org.apache.commons.math.distribution.HypergeometricDistributionImpl;


public class Main {
    public static void main(String[] args) {
         HypergeometricDistributionImpl u = new
HypergeometricDistributionImpl(14761461, 1035 ,1841 );
        System.out.println(u.upperCumulativeProbability(0));

    }
}

Thanks for your help.




On Thu, Aug 11, 2011 at 4:45 PM, Gilles Sadowski <
gilles@harfang.homelinux.org> wrote:

> Hello.
>
> > I am using the commons-Math library. I have used the
> > HypergeometricDistributionImpl. I used upperCumulativeProbability method.
> I
> > have got some probability greater that 1 which is impossible.
> > I would appreciate if you can help me to know why it happens.
> >
> > Thanks, in advance, for your kind help.
> >
> >
> > //********************************************************
> > //My method to compute pvalue
> >    public static double HyperDist(int allgenes, int
> numberOfgenesinpathway,
> > int numberofxoy , int commongene){
> >        HypergeometricDistributionImpl hyper = new
> > HypergeometricDistributionImpl(allgenes, numberOfgenesinpathway,
> > numberofxoy) ;
> >        return hyper.upperCumulativeProbability(commongene);
> >     }
> >
>
> Could you please provide a minimal, but working, unit test whose failure
> would show the problem you encounter?
> Also please specify which version of Commons Math you use.
>
>
> Thanks,
> Gilles
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>


-- 

Regards,
Marzieh Ayati

Re: [MATH]: question about HypergeometricDistributionImpl class

Posted by Gilles Sadowski <gi...@harfang.homelinux.org>.
Hello.

> I am using the commons-Math library. I have used the
> HypergeometricDistributionImpl. I used upperCumulativeProbability method. I
> have got some probability greater that 1 which is impossible.
> I would appreciate if you can help me to know why it happens.
> 
> Thanks, in advance, for your kind help.
> 
> 
> //********************************************************
> //My method to compute pvalue
>    public static double HyperDist(int allgenes, int numberOfgenesinpathway,
> int numberofxoy , int commongene){
>        HypergeometricDistributionImpl hyper = new
> HypergeometricDistributionImpl(allgenes, numberOfgenesinpathway,
> numberofxoy) ;
>        return hyper.upperCumulativeProbability(commongene);
>     }
> 

Could you please provide a minimal, but working, unit test whose failure
would show the problem you encounter?
Also please specify which version of Commons Math you use.


Thanks,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org