Accord.Tests.Statistics.WilcoxonSignedRankTestTest.WilcoxonSignedRankTestConstructorTest2 C# (CSharp) Method

WilcoxonSignedRankTestConstructorTest2() private method

private WilcoxonSignedRankTestConstructorTest2 ( ) : void
return void
        public void WilcoxonSignedRankTestConstructorTest2()
        {
            // Example from https://onlinecourses.science.psu.edu/stat414/node/319
            double[] sample = { 5.0, 3.9, 5.2, 5.5, 2.8, 6.1, 6.4, 2.6, 1.7, 4.3 };

            double hypothesizedMedian = 3.7;

            var target = new WilcoxonSignedRankTest(sample, hypothesizedMedian);

            Assert.AreEqual(OneSampleHypothesis.ValueIsDifferentFromHypothesis, target.Hypothesis);

            // Absolute differences and original signs
            double[] delta = { +1.3, +0.2, +1.5, +1.8, +0.9, +2.4, +2.7, +1.1, +2.0, +0.6 };
            double[] signs = { +1.0, +1.0, +1.0, +1.0, -1.0, -1.0, +1.0, -1.0, -1.0, +1.0 };
            double[] ranks = { +5.0, +1.0, +6.0, +7.0, +3.0, +9.0, +10, +4.0, +8.0, +2.0 };

            Assert.AreEqual(40, target.Statistic);
            Assert.AreEqual(0.232, target.PValue, 1e-3);
            Assert.IsFalse(target.Significant);
        }