public void CumulativeFunctionTest()
{
double shape = 0.4;
double scale = 4.2;
double[] cdf =
{
0, 0.251017, 0.328997, 0.38435, 0.428371, 0.465289,
0.497226, 0.525426, 0.55069, 0.573571, 0.594469
};
GammaDistribution target = new GammaDistribution(scale, shape);
for (int i = 0; i < 11; i++)
{
double x = i / 10.0;
double actual = target.DistributionFunction(x);
double expected = cdf[i];
Assert.AreEqual(expected, actual, 1e-5);
Assert.IsFalse(double.IsNaN(actual));
}
}