Accord.Tests.Statistics.TTestTest.PValueToStatisticTest C# (CSharp) Method

PValueToStatisticTest() private method

private PValueToStatisticTest ( ) : void
return void
        public void PValueToStatisticTest()
        {
            double df = 2.6;
            double p = 0.05;
            double t = 0;
            {
                TTest target = new TTest(t, df, OneSampleHypothesis.ValueIsDifferentFromHypothesis);
                Assert.AreEqual(DistributionTail.TwoTail, target.Tail);
                double actual = target.PValueToStatistic(p);
                double expected = 3.4782;
                Assert.AreEqual(expected, actual, 1e-4);
            }

            {
                TTest target = new TTest(t, df, OneSampleHypothesis.ValueIsSmallerThanHypothesis);
                Assert.AreEqual(DistributionTail.OneLower, target.Tail);
                double actual = target.PValueToStatistic(p);
                double expected = -2.5086;
                Assert.AreEqual(expected, actual, 1e-4);
            }

            {
                TTest target = new TTest(t, df, OneSampleHypothesis.ValueIsGreaterThanHypothesis);
                Assert.AreEqual(DistributionTail.OneUpper, target.Tail);
                double actual = target.PValueToStatistic(p);
                double expected = 2.5086;
                Assert.AreEqual(expected, actual, 1e-4);
            }

            p = 0.95;
            {
                TTest target = new TTest(t, df, OneSampleHypothesis.ValueIsDifferentFromHypothesis);
                Assert.AreEqual(DistributionTail.TwoTail, target.Tail);
                double actual = target.PValueToStatistic(p);
                double expected = 0.0689;
                Assert.AreEqual(expected, actual, 1e-4);
            }

            {
                TTest target = new TTest(t, df, OneSampleHypothesis.ValueIsSmallerThanHypothesis);
                Assert.AreEqual(DistributionTail.OneLower, target.Tail);
                double actual = target.PValueToStatistic(p);
                double expected = 2.5086;
                Assert.AreEqual(expected, actual, 1e-4);
            }

            {
                TTest target = new TTest(t, df, OneSampleHypothesis.ValueIsGreaterThanHypothesis);
                Assert.AreEqual(DistributionTail.OneUpper, target.Tail);
                double actual = target.PValueToStatistic(p);
                double expected = -2.5086;
                Assert.AreEqual(expected, actual, 1e-4);
            }
        }