'What are the differences between mvShapiro.Test and mshapiro.test in R?

This question concerns the "mvShapiro.Test" function in the package mvShapiroTest and the "mshapiro.test" function in the package mvnormtest, both used for testing multivariate normality. I’ve tried using both with my own dataset, and one test indicates a normal distribution while the other does not. I’ve included a reproducible example below; the test statistics here both point in the same direction, but to very different degrees.

Let’s say the dataset consists of 15 samples and 3 variables ;

example <- data.frame(Var1 = c(rep(8, 10), rep(2, 5)), 
                      Var2 = c(rep(5, 5), rep(13, 10)), 
                      Var3 = c(rep(1, 6), rep(8, 9)))

If I use the function mvShapiro.Test (first converting the data frame into a matrix), I return the following test statistic and p value: MVW = 0.8043, p-value = 1.953e-05.

example_matrix <- data.matrix(example)
mvShapiro.Test(example_matrix)

If, however, I use the function mshapiro.test (first transposing the dataframe and then converting it into a matrix), I return the following test statistic and p value: W = 0.28413, p-value = 9.834e-08.

example_t <- t(example)
example_t_matrix <- data.matrix(example_t)
mshapiro.test(example_t_matrix)

Does anyone know why and how these functions perform differently? I did not find the documentation for either helpful, but I may have missed something.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source