Hypergeometric function not working correctly

Apr 22, 2014 at 8:35 AM
I tried to use Hypergeometric cummulative distribution in Math.Net like below:

var hyper = new MathNet.Numerics.Distributions.Hypergeometric(30,15,10);
Console.WriteLine ("{0},", hyper.CumulativeDistribution(3)); -->0.025087456
Console.WriteLine("{0},", hyper.Probability(3)); -->0.097451274

However, the result is different from excel Hypergeometric distribution function for the cummulative distribution. The Math.Net hyper.CumulativeDistribution (3) = Excel HYPEGEOM.DIST(2,10,15,30,1). Off by 1 position.

Excel: HYPEGEOM.DIST(3,10,15,30,1) = 0.122538731
     HYPEGEOM.DIST(3,10,15,30,0) = 0.097451274
Please let me know whether it is intended to be like this or there is a mistakes in the calc.

Apr 22, 2014 at 8:55 AM
Edited Apr 22, 2014 at 8:58 AM
There was a fix on the hyper-geometric CDF semantics in the v3 branch, so if it had been originally intended (or simply was a bug), it is no more.

With the current v3.0.0-beta01:
var hyper = new MathNet.Numerics.Distributions.Hypergeometric(30,15,10);
hyper.CumulativeDistribution(3); // returns 0.122538730634683
hyper.Probability(3).Dump(); // returns 0.0974512743628186
Can you upgrade to a v3 pre-release? There are plans to backport most fixes from v3 back to a v2 update, but I can't give any date on that.

Btw, with v3 you can also do:
Marked as answer by cdrnet on 5/2/2014 at 10:32 AM
Apr 23, 2014 at 3:01 AM
Thanks for your fast response.

It fixed the position :)