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

StatisticToPValueTest() private method

private StatisticToPValueTest ( ) : void
return void
        public void StatisticToPValueTest()
        {
            double df = 2.2;

            double t = 1.96;
            {
                TTest target = new TTest(t, df, OneSampleHypothesis.ValueIsDifferentFromHypothesis);
                Assert.AreEqual(DistributionTail.TwoTail, target.Tail);
                double actual = target.StatisticToPValue(t);
                double expected = 0.1773;
                Assert.AreEqual(expected, actual, 1e-4);
            }

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

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

            t = -1.96;
            {
                TTest target = new TTest(t, df, OneSampleHypothesis.ValueIsDifferentFromHypothesis);
                Assert.AreEqual(DistributionTail.TwoTail, target.Tail);
                double actual = target.StatisticToPValue(t);
                double expected = 0.1773;
                Assert.AreEqual(expected, actual, 1e-4);
            }

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

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