This project has moved and is read-only. For the latest updates, please go here.

Gamma distribution (CDF)

Dec 26, 2013 at 4:31 PM
Hi,

I'm trying to use the library. However I found that there is lot of difference in the output between Gamma distribution(CDF) and what is there in excel inbuilt formula. I could the values not matching. As I'm not very good mathemetician would require your help if I'm missing something here in the usage part.

Ex:Gamma.CDF(2,3,4) has different value then that of Excel inbuilt formula GammaDistrib(4,2,3, true).

As this is critical for our project can some one shed lights on the same.
Dec 27, 2013 at 8:34 AM
Hi,

There are two common ways to parametrize the gamma distribution: shape (k) and scale (theta), or shape (alpha) and rate (beta). We use the latter, apparently Excel uses the former. Converting between them is easy though: beta = 1/theta. See also wikipedia.

Hence: Excel GAMMA.DIST(4,2,3,true) <-> Math.NET Gamma.CDF(2, 1.0/3, 4)

Thanks,
Christoph
Marked as answer by krishnaprasadj on 12/27/2013 at 3:33 AM
Dec 27, 2013 at 8:39 AM
PS: Because there are two ways, Math.NET Numerics also has a way to use the other way, but only when creating an actual instance instead of using the static CDF method shortcut:
var d = Gamma.WithShapeScale(2, 3);
d.CumulativeDistribution(4);
Thanks,
Christoph
Marked as answer by krishnaprasadj on 12/27/2013 at 3:33 AM
Dec 27, 2013 at 11:25 AM
Thanks for your reply. It works perfectly fine. Also can you let me know about InverseGamma. It is also behaving the same way. There is some difference between excel and the Math.Numeric version for the same example as above. Thanks in advance.