Accord.Tests.Statistics.TDistributionTest.InverseDistributionFunctionTest C# (CSharp) Method

InverseDistributionFunctionTest() private method

private InverseDistributionFunctionTest ( ) : void
return void
        public void InverseDistributionFunctionTest()
        {
            TDistribution target;
            double[] expected;

            target = new TDistribution(1);
            expected = new double[] { 6.3138, 3.0777, 1.9626, 1.3764, 1, 0.7265, 0.5095, 0.3249, 0.1584, 0 };

            for (int i = 1; i <= 10; i++)
            {
                double percent = i / 10.0;
                double actual = target.InverseDistributionFunction(1.0 - percent / 2);
                Assert.AreEqual(expected[i - 1], actual, 1e-4);
                Assert.IsFalse(Double.IsNaN(actual));
            }

            target = new TDistribution(4.2);
            expected = new double[] { 2.103, 1.5192, 1.1814, 0.9358, 0.7373, 0.5664, 0.4127, 0.2699, 0.1334, 0 };

            for (int i = 1; i <= 10; i++)
            {
                double percent = i / 10.0;
                double actual = target.InverseDistributionFunction(1.0 - percent / 2);
                Assert.AreEqual(expected[i - 1], actual, 1e-4);
                Assert.IsFalse(Double.IsNaN(actual));
            }

        }