Learn R Programming

energy (version 1.6.2)

mvnorm.etest: E-statistic (Energy) Test of Multivariate Normality

Description

Performs the E-statistic (energy) test of multivariate or univariate normality.

Usage

mvnorm.etest(x, R = 999) mvnorm.e(x) normal.e(x)

Arguments

x
data matrix of multivariate sample, or univariate data vector
R
number of bootstrap replicates

Value

The value of the $E$-statistic for univariate normality is returned by normal.e. The value of the $E$-statistic for multivariate normality is returned by mvnorm.e.mvnorm.etest returns a list with class htest containing
method
description of test
statistic
observed value of the test statistic
p.value
approximate p-value of the test
data.name
description of data

Details

If x is a matrix, each row is a multivariate observation. The data will be standardized to zero mean and identity covariance matrix using the sample mean vector and sample covariance matrix. If x is a vector, the univariate statistic normal.e(x) is returned. If the data contains missing values or the sample covariance matrix is singular, NA is returned. The $E$-test of multivariate normality was proposed and implemented by Szekely and Rizzo (2005). The test statistic for d-variate normality is given by $$\mathcal{E} = n (\frac{2}{n} \sum_{i=1}^n E\|y_i-Z\| - E\|Z-Z'\| - \frac{1}{n^2} \sum_{i=1}^n \sum_{j=1}^n \|y_i-y_j\|), $$ where $y_1,\ldots,y_n$ is the standardized sample, $Z, Z'$ are iid standard d-variate normal, and $|| ||$ denotes Euclidean norm. The $E$-test of multivariate (univariate) normality is implemented by parametric bootstrap with R replicates.

References

Szekely, G. J. and Rizzo, M. L. (2005) A New Test for Multivariate Normality, Journal of Multivariate Analysis, 93/1, 58-80, http://dx.doi.org/10.1016/j.jmva.2003.12.002. Rizzo, M. L. (2002). A New Rotation Invariant Goodness-of-Fit Test, Ph.D. dissertation, Bowling Green State University. Szekely, G. J. (1989) Potential and Kinetic Energy in Statistics, Lecture Notes, Budapest Institute of Technology (Technical University).

Examples

Run this code
 ## compute normality test statistics for iris Setosa data
 data(iris)
 mvnorm.e(iris[1:50, 1:4])
 normal.e(iris[1:50, 1])

 ## test if the iris Setosa data has multivariate normal distribution
 mvnorm.etest(iris[1:50,1:4], R = 199)
 
 ## test a univariate sample for normality
 x <- runif(50, 0, 10)
 mvnorm.etest(x, R = 199)
 

Run the code above in your browser using DataLab