
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.
Thanks.


Coordinator
Apr 22, 2014 at 8:55 AM
Edited Apr 22, 2014 at 8:58 AM

There was a fix on the hypergeometric 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.0beta01:
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 prerelease? 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:
Hypergeometric.CDF(30,15,10,3);
Hypergeometric.PMF(30,15,10,3);
Thanks,
Christoph



Thanks for your fast response.
It fixed the position :)

