Learn R Programming

mvnormalTest (version 1.0.0)

mvnTest: A Powerful Test for Multivariate Normality (Zhou-Shao's Test)

Description

A simple and powerful test for multivariate normality with a combination of multivariate kurtosis (MK) and Shapiro-Wilk which was proposed by Zhou and Shao (2014). The p-value of the test statistic (\(T_n\)) is computed based on a simulated null distribution of \(T_n\). Details see Zhou and Shao (2014).

Usage

mvnTest(X, B = 1000, pct = c(0.01, 0.99))

Arguments

X

an \(n*p\) data matrix or data frame, where \(n\) is number of rows (observations) and \(p\) is number of columns (variables) and \(n>p\).

B

number of Monte Carlo simulations for null distribution, default is 1000 (increase B to increase the precision of p-value).

pct

percentiles of MK to get \(c_1\) and \(c_2\) described in the reference paper, default is (0.01, 0.99).

Value

Returns a list with two objects:

mv.test

results of the Zhou-Shao's test for multivariate normality , i.e., test statistic \(T_n\), p-value (under H0, i.e. multivariate normal, that \(T_n\) is at least as extreme as the observed value), and multivariate normality summary (YES, if p-value>0.05).

uv.shapiro

a dataframe with \(p\) rows detailing univariate Shapiro-Wilk tests. Columns in the dataframe contain test statistics W, p-value,and univariate normality summary (YES, if p-value>0.05).

References

Zhou, M., & Shao, Y. (2014). A powerful test for multivariate normality. Journal of applied statistics, 41(2), 351-363.

Shapiro, S. S., & Wilk, M. B. (1965). An analysis of variance test for normality (complete samples). Biometrika, 52(3/4), 591-611.

See Also

power.mvnTest, msk, mardia, msw, faTest, mhz

Examples

Run this code
# NOT RUN {
set.seed(12345)

## Data from gamma distribution ##
X = matrix(rgamma(50*4,shape =  2),50)
mvnTest(X, B=100)

## load the ubiquitous multivariate iris data ##
## (first 50 observations of columns 1:4) ##
iris.df = iris[1:50, 1:4]
mvnTest(iris.df, B=100)

# }

Run the code above in your browser using DataLab