public void DistributionFunctionTest()
{
double[,] table =
{
// x d df expected
{ 3.00, 0.0, 1, 0.8975836176504333 },
{ 3.00, 0.0, 2, 0.9522670169 },
{ 3.00, 0.0, 3, 0.9711655571887813 },
{ 3.00, 0.5, 1, 0.8231218863999999 },
{ 3.00, 0.5, 2, 0.904902151 },
{ 3.00, 0.5, 3, 0.9363471834 },
{ 3.00, 1.0, 1, 0.7301025986 },
{ 3.00, 1.0, 2, 0.8335594263 },
{ 3.00, 1.0, 3, 0.8774010255 },
{ 3.00, 2.0, 1, 0.5248571617 },
{ 3.00, 2.0, 2, 0.6293856597 },
{ 3.00, 2.0, 3, 0.6800271741 },
{ 3.00, 4.0, 1, 0.20590131975 },
{ 3.00, 4.0, 2, 0.2112148916 },
{ 3.00, 4.0, 3, 0.2074730718 },
{ 15.00, 7.0, 15, 0.9981130072 },
{ 15.00, 7.0, 20, 0.999487385 },
{ 15.00, 7.0, 25, 0.9998391562 },
{ 0.05, 1.0, 1, 0.168610566972 },
{ 0.05, 1.0, 2, 0.16967950985 },
{ 0.05, 1.0, 3, 0.1701041003 },
{ 4.00, 2.0, 10, 0.9247683363 },
{ 4.00, 3.0, 10, 0.7483139269 },
{ 4.00, 4.0, 10, 0.4659802096 },
{ 5.00, 2.0, 10, 0.9761872541 },
{ 5.00, 3.0, 10, 0.8979689357 },
{ 5.00, 4.0, 10, 0.7181904627 },
{ 6.00, 2.0, 10, 0.9923658945 },
{ 6.00, 3.0, 10, 0.9610341649 },
{ 6.00, 4.0, 10, 0.868800735 },
};
for (int i = 0; i < table.GetLength(0); i++)
{
double x = table[i, 0];
double delta = table[i, 1];
double df = table[i, 2];
var target = new NoncentralTDistribution(df, delta);
double expected = table[i, 3];
double actual = target.DistributionFunction(x);
Assert.AreEqual(expected, actual, 1e-10);
}
}