It is well known that many multivariate statistical procedures call upon the assumption of multivariate normality (MVN). At least 50 different procedures have been proposed for this problem. Unfortunately, different conclusions about the MVN of a data set can be reached by different procedures (Mecklin and Mundfrom, 2005).
The Shapiro-Wilk test (Shapiro and Wilk, 1965), is generally considered to be an excellent test of univariate normality. It is only natural to extend it to the multivariate case, as done by Royston (1982). Simulation results have show Royston’s test to have very good Type I error control and power against many different alternative distributions. Further, Royston’s test involves a rather ingenious correction for the correlation between the variables in the sample.
Royston’s (1983) marginal method first tests each of the p variates for univariate normality with a Shapiro-Wilk statistic, then combines the p dependent tests into one omnibus test statistic for multivariate normality. Royston transforms the p-Shapiro-Wilk statistics into what he claims is an approximately Chi-squared random variable, with e (1< e <p) degrees of freedom. The degrees of freedom are estimated by taking into account possible correlation structures between the original p test statistics. This test has been found to behave well when the sample size is small and the variates are relatively uncorrelated (Mecklin and Mundfrom, 2005).
This m-file has a function to generate the Shapiro-Wilk's W statistic needed to feed the Royston's test for multivariate normality. It was taken from the Fortran Algorithm AS R94 (Royston, 1995) [URL address http://lib.stat.cmu.edu/apstat/181]. Here, we present both the options for the sample kurtosis type: 1) Shapiro-Francia for leptokurtic, and 2) Shapiro-Wilk for the platykurtic ones.
Syntax: function Roystest(X,alpha)
X - data matrix (Size of matrix must be n-by-p; data=rows,
alpha - significance level (default = 0.05)
- Royston's Multivariate Normality Test