public void ShapiroWilkTest()
{
// Tested against R's shapiro.test(x)
double[] samples =
{
0.11, 7.87, 4.61, 10.14, 7.95, 3.14, 0.46, 4.43,
0.21, 4.75, 0.71, 1.52, 3.24, 0.93, 0.42, 4.97,
9.53, 4.55, 0.47, 6.66
};
/*
samples <- c(0.11, 7.87, 4.61, 10.14, 7.95, 3.14, 0.46, 4.43, 0.21,
+ 4.75, 0.71, 1.52, 3.24, 0.93, 0.42, 4.97, 9.53, 4.55, 0.47, 6.66)
shapiro.test(samples)
W = 0.90050, p-value = 0.04209
*/
var target = new ShapiroWilkTest(samples);
Assert.AreEqual(0.90050, target.Statistic, 1e-4);
Assert.AreEqual(0.04209, target.PValue, 1e-5);
}