mhz: Henze-Zirkler Test for Multivariate Normality

Description Usage Arguments Value References See Also Examples

View source: R/function.R

Description

It computes a multiviariate normality test based on a non-negative functional distance which was proposed by Henze and Zirkler (1990). Under the null hypothesis the test statistic is approximately log-normally distributed.

Usage

1
mhz(X)

Arguments

X

an n*p numeric matrix or data frame.

Value

Returns a list with two objects:

mv.test

results of the Henze-Zirkler test, i.e., test statistic, p-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

Henze, N., & Zirkler, B. (1990). A class of invariant consistent tests for multivariate normality. Communications in statistics-Theory and Methods, 19(10), 3595-3617.

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

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

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
set.seed(12345)

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

## Data from normal distribution
X = matrix(rnorm(50*4,mean = 2 , sd = 1),50)
mhz(X)

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

Example output

$mv.test
Statistic   p-value    Result 
    1.194     5e-04        NO 

$uv.shapiro
   W      p-value UV.Normality
V1 0.9226 0.0029  No          
V2 0.9056 7e-04   No          
V3 0.9106 0.0011  No          
V4 0.959  0.0808  Yes         

$mv.test
Statistic   p-value    Result 
   0.7224    0.6299       YES 

$uv.shapiro
   W      p-value UV.Normality
V1 0.9812 0.6023  Yes         
V2 0.9552 0.0561  Yes         
V3 0.9799 0.5489  Yes         
V4 0.9847 0.7595  Yes         

$mv.test
Statistic   p-value    Result 
   0.9488      0.05        NO 

$uv.shapiro
             W      p-value UV.Normality
Sepal.Length 0.9777 0.4595  Yes         
Sepal.Width  0.9717 0.2715  Yes         
Petal.Length 0.955  0.0548  Yes         
Petal.Width  0.7998 0       No          

mvnormalTest documentation built on April 28, 2020, 5:06 p.m.