Accord.Tests.Statistics.ShapiroWilkTestTest.ShapiroWilkTest2 C# (CSharp) Method

ShapiroWilkTest2() private method

private ShapiroWilkTest2 ( ) : void
return void
        public void ShapiroWilkTest2()
        {
            // Tested against R's shapiro.test(x)

            double[] samples =
            {
                1.36, 1.14, 2.92, 2.55, 1.46, 1.06, 5.27, 1.11, 3.48,
                1.10, 0.88, 0.51, 1.46, 0.52, 6.20, 1.69, 0.08, 3.67,
                2.81, 3.49
            };

            /* 
                samples <- c(1.36, 1.14, 2.92, 2.55, 1.46, 1.06, 5.27, 1.11, 3.48, +
                  1.10, 0.88, 0.51, 1.46, 0.52, 6.20, 1.69, 0.08, 3.67, 2.81, 3.49)
             
                W = 0.89090000, p-value = 0.02798
             */

            var target = new ShapiroWilkTest(samples);

            Assert.AreEqual(0.89090, target.Statistic, 1e-4);
            Assert.AreEqual(0.02798, target.PValue, 1e-5);
        }