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

StatisticToPValueTest() private method

private StatisticToPValueTest ( ) : void
return void
        public void StatisticToPValueTest()
        {
            double z = 1.96;
            {
                ZTest target = new ZTest(z, OneSampleHypothesis.ValueIsDifferentFromHypothesis);
                Assert.AreEqual(DistributionTail.TwoTail, target.Tail);
                double actual = target.StatisticToPValue(z);
                double expected = 0.05;
                Assert.AreEqual(expected, actual, 1e-5);
            }

            {
                ZTest target = new ZTest(z, OneSampleHypothesis.ValueIsSmallerThanHypothesis);
                Assert.AreEqual(DistributionTail.OneLower, target.Tail);
                double actual = target.StatisticToPValue(z);
                double expected = 0.975;
                Assert.AreEqual(expected, actual, 1e-5);
            }

            {
                ZTest target = new ZTest(z, OneSampleHypothesis.ValueIsGreaterThanHypothesis);
                Assert.AreEqual(DistributionTail.OneUpper, target.Tail);
                double actual = target.StatisticToPValue(z);
                double expected = 0.025;
                Assert.AreEqual(expected, actual, 1e-5);
            }

            z = -1.96;
            {
                ZTest target = new ZTest(z, OneSampleHypothesis.ValueIsDifferentFromHypothesis);
                Assert.AreEqual(DistributionTail.TwoTail, target.Tail);
                double actual = target.StatisticToPValue(z);
                double expected = 0.05;
                Assert.AreEqual(expected, actual, 1e-5);
            }

            {
                ZTest target = new ZTest(z, OneSampleHypothesis.ValueIsSmallerThanHypothesis);
                Assert.AreEqual(DistributionTail.OneLower, target.Tail);
                double actual = target.StatisticToPValue(z);
                double expected = 0.025;
                Assert.AreEqual(expected, actual, 1e-5);
            }

            {
                ZTest target = new ZTest(z, OneSampleHypothesis.ValueIsGreaterThanHypothesis);
                Assert.AreEqual(DistributionTail.OneUpper, target.Tail);
                double actual = target.StatisticToPValue(z);
                double expected = 0.975;
                Assert.AreEqual(expected, actual, 1e-5);
            }
        }