Package 'mvnTest'

Title: Goodness of Fit Tests for Multivariate Normality
Description: Routines for assessing multivariate normality. Implements three Wald's type chi-squared tests; non-parametric Anderson-Darling and Cramer-von Mises tests; Doornik-Hansen test, Royston test and Henze-Zirkler test.
Authors: Natalya Pya [aut, cre], Vassilly Voinov [aut], Rashid Makarov [aut], Yevgeniy Voinov [aut]
Maintainer: Natalya Pya <[email protected]>
License: GPL (>= 2)
Version: 1.1-0
Built: 2024-12-14 06:31:56 UTC
Source: CRAN

Help Index


Goodness-of-fit tests for multivariate normality

Description

mvnTest provides functions for assessing multivariate normality. It includes eight test statistics such as three Wald's type chi-squared tests (McCulloch, Nikulin-Rao-Robson and Dzhaparidze-Nikulin tests), non-parametric Anderson-Darling and Cramer-von Mises tests; Doornik-Hansen test, Royston test and Henze-Zirkler test.

Details

Package: mvnTest
Type: Package
License: GPL (>= 2)

Note

The printing method and plotting are in part adapted from R package MVN (version 4.0, Korkmaz, S. et al., 2015)

Author(s)

Vassilly Voinov, Natalya Pya, Rashid Makarov, Yevgeniy Voinov

Maintainer: Natalya Pya <[email protected]>


Class "ad"

Description

An S4 class for the Anderson-Darling test for multivariate normality.

Slots

AD:

stores the values of the test statistics

p.value:

stores the p-value of the test

data.name:

stores the name of the data

Author(s)

Natalya Pya, Vassilly Voinov, Rashid Makarov


Anderson-Darling test for multivariate normality

Description

This function implements the Anderson-Darling test for assessing multivariate normality. It calculates the value of the test and its approximate p-value.

Usage

AD.test(data, qqplot = FALSE)

Arguments

data

A numeric matrix or data frame.

qqplot

If TRUE produces a chi-squared QQ plot.

Value

AD

the value of the test statistic.

p.value

the p-value of the test.

Note

The printing method and plotting are in part adapted from R package MVN (version 4.0, Korkmaz, S. et al., 2015).

The computations are relatively expensive as Monte Carlo procedure is used to calculate empirical p-vales.

Author(s)

Rashid Makarov, Vassilly Voinov, Natalya Pya

References

Paulson, A., Roohan, P., and Sullo, P. (1987). Some empirical distribution function tests for multivariate normality. Journal of Statistical Computation and Simulation, 28, 15-30

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

Selcuk Korkmaz, Dincer Goksuluk, and Gokmen Zararsiz. MVN: Multivariate Normality Tests, 2015. R package version 4.0

See Also

S2.test, CM.test, DH.test, R.test, HZ.test

Examples

## Not run: 
## generating n bivariate normal random variables...       
dat <- rmvnorm(n=100,mean=rep(0,2),sigma=matrix(c(4,2,2,4),2,2)) 
res <- AD.test(dat)
res

## generating n bivariate t distributed with 10df random variables...   
dat <- rmvt(n=200,sigma=matrix(c(4,2,2,4),2,2),df=10,delta=rep(0,2)) 
res1 <- AD.test(dat)
res1

data(iris)
setosa <- iris[1:50, 1:4] # Iris data only for setosa
res2 <- AD.test(setosa, qqplot = TRUE)
res2

    
## End(Not run)

Class "cm"

Description

An S4 class for the Cramer-von Mises test for multivariate normality.

Slots

CM:

stores the values of the test statistics

p.value:

stores the p-value of the test

data.name:

stores the name of the data

Author(s)

Natalya Pya, Vassilly Voinov, Rashid Makarov


Cramer-von Mises test for Multivariate Normality

Description

This function implements the Cramer-von Mises test for assessing multivariate normality.

Usage

CM.test(data, qqplot = FALSE)

Arguments

data

A numeric matrix or data frame

qqplot

if TRUE creates a chi-square Q-Q plot

Details

Calculates the value of the Cramer-von Mises test and the approximate p-value.

Value

CM

the value of the test statistic

p.value

the p-value of the test

data.name

a character string giving the name of the data

Note

The printing method and plotting are in part adapted from R package MVN (version 4.0, Korkmaz, S. et al., 2015).

The computations are relatively expensive as Monte Carlo procedure is used to calculate empirical p-vales.

Author(s)

Rashid Makarov, Vassilly Voinov, Natalya Pya

References

Koziol, J. (1982). A class of invariant procedures for assessing multivariate normality. Biometrika, 69, 423-427

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

See Also

S2.test, AD.test, DH.test, R.test, HZ.test

Examples

## Not run: 
## generating n bivariate normal random variables...       
dat <- rmvnorm(n=100,mean=rep(0,2),sigma=matrix(c(4,2,2,4),2,2)) 
res <- CM.test(dat)
res

## generating n bivariate t distributed with 10df random variables...       
dat <- rmvt(n=200,sigma=matrix(c(4,2,2,4),2,2),df=10,delta=rep(0,2)) 
res1 <- CM.test(dat)
res1

data(iris)
setosa <- iris[1:50, 1:4] # Iris data only for setosa
res2 <- CM.test(setosa, qqplot = TRUE)
res2

## End(Not run)

Class "dh"

Description

An S4 class for the Doornik-Hansen test for multivariate normality.

Slots

DH:

stores the values of the test statistics

p.value:

stores the p-value of the test

data.name:

stores the name of the data

Author(s)

Natalya Pya, Vassilly Voinov, Rashid Makarov


Doornik-Hansen test for Multivariate Normality

Description

This function implements the Doornik-Hansen test for assessing multivariate normality.

Usage

DH.test(data, qqplot = FALSE)

Arguments

data

A numeric matrix or data frame

qqplot

if TRUE creates a chi-square Q-Q plot

Details

Calculates the value of the Doornik-Hansen test and the approximate p-value.

Value

DH

the value of the test statistic

p.value

the p-value of the test

data.name

a character string giving the name of the data

Note

The printing method and plotting are in part adapted from R package MVN (version 4.0, Korkmaz, S. et al., 2015).

Author(s)

Rashid Makarov, Vassilly Voinov, Natalya Pya

References

Doornik, J. and Hansen, H. (2008). An omnibus test for univariate and multivariate normality. Oxford Bulletin of Economics and Statistics, 70, 915-925.

See Also

S2.test, AD.test, CM.test, R.test, HZ.test

Examples

## generating n bivariate normal random variables...       
dat <- rmvnorm(n=200,mean=rep(0,2),sigma=matrix(c(4,2,2,4),2,2)) 
res <- DH.test(dat)
res
## generating n bivariate t distributed with 10df random variables...       
dat <- rmvt(n=200,sigma=matrix(c(4,2,2,4),2,2)*.8,df=10,delta=rep(0,2)) 
res1 <- DH.test(dat)
res1

data(iris)
setosa <- iris[1:50, 1:4] # Iris data only for setosa
res2 <- DH.test(setosa, qqplot = TRUE)
res2

Class "hz"

Description

An S4 class for the Henze-Zirkler test for multivariate normality.

Slots

HZ:

stores the values of the test statistics

p.value:

stores the p-value of the test

data.name:

stores the name of the data

Author(s)

Natalya Pya, Vassilly Voinov, Rashid Makarov


Henze-Zirkler test for Multivariate Normality

Description

This function implements the Henze-Zirkler test for assessing multivariate normality.

Usage

HZ.test(data, qqplot = FALSE)

Arguments

data

A numeric matrix or data frame

qqplot

if TRUE creates a chi-square Q-Q plot

Details

Calculates the value of the Henze-Zirkler test and the approximate p-value.

Value

HZ

the value of the test statistic

p.value

the p-value of the test

data.name

a character string giving the name of the data

Note

The printing method and plotting are in part adapted from R package MVN (Korkmaz, S. et al., 2015, version 4.0).

Author(s)

Rashid Makarov, Vassilly Voinov, Natalya Pya

References

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

See Also

S2.test, DH.test, AD.test, CM.test, R.test

Examples

## generating n bivariate normal random variables...       
dat <- rmvnorm(n=200,mean=rep(0,2),sigma=matrix(c(4,2,2,4),2,2)) 
res <- HZ.test(dat)
res
## generating n bivariate t distributed with 10df random variables...       
dat <- rmvt(n=200,sigma=matrix(c(4,2,2,4),2,2)*.8,df=10,delta=rep(0,2)) 
res1 <- HZ.test(dat)
res1

data(iris)
setosa = iris[1:50, 1:4] # Iris data only for setosa
res2 <- HZ.test(setosa, qqplot = TRUE)
res2

Class "r"

Description

An S4 class for the Royston test for multivariate normality.

Slots

R:

stores the values of the test statistics

p.value:

stores the p-value of the test

data.name:

stores the name of the data

Author(s)

Natalya Pya, Vassilly Voinov, Rashid Makarov


Royston test for Multivariate Normality

Description

This function implements the Royston test for assessing multivariate normality.

Usage

R.test(data, qqplot = FALSE)

Arguments

data

A numeric matrix or data frame

qqplot

if TRUE creates a chi-square Q-Q plot

Details

Calculates the value of the Royston test and the approximate p-value.

Value

R

the value of the test statistic

p.value

the p-value of the test

data.name

a character string giving the name of the data

Note

The printing method and plotting are in part adapted from R package MVN (Korkmaz, S. et al., 2015, version 4.0).

Author(s)

Rashid Makarov, Vassilly Voinov, Natalya Pya

References

Royston, P. (1992). Approximating the Shapiro-Wilk W-test for non-normality. Statistics and Computing, 2, 117-119.

See Also

S2.test, DH.test, AD.test, CM.test, HZ.test

Examples

## generating n bivariate normal random variables...       
dat <- rmvnorm(n=200,mean=rep(0,2),sigma=matrix(c(4,2,2,4),2,2)) 
res <- R.test(dat)
res
## generating n bivariate t distributed with 10df random variables...       
dat <- rmvt(n=200,sigma=matrix(c(4,2,2,4),2,2)*.8,df=10,delta=rep(0,2)) 
res1 <- R.test(dat)
res1

data(iris)
setosa = iris[1:50, 1:4] # Iris data only for setosa
res2 <- R.test(setosa, qqplot = TRUE)
res2

Class "S2"

Description

An S4 class for Chi-squared type tests for multivariate normality.

Slots

s2:

stores the values of the McCulloch test statistics

y2:

stores the values of the Nikulin-Rao-Robson test statistics

u2:

stores the values of the Dzhaparidze-Nikulin test statistics

p.value.s2:

stores the p-value for S2 test

p.value.y2:

stores the p-value for Y2 test

p.value.u2:

stores the p-value for U2 test

data.name:

stores the data set name

Author(s)

Natalya Pya, Vassilly Voinov, Rashid Makarov


Chi-squared type tests for Multivariate Normality

Description

This function implements three chi-squared type goodness-of-fit tests for multivariate normality, namely, the McCulloch S2 test, Nikulin-Rao-Robson Y2 and Dzhaparidze-Nikulin U2 tests.

Usage

S2.test(data, M=5, qqplot = FALSE)

Arguments

data

A numeric matrix or data frame

M

A number of equiprobable intervals

qqplot

if TRUE it creates a chi-square Q-Q plot

Details

Calculates the values of the three chi-squared type test statistics, the McCulloch S2, Nikulin-Rao-Robson Y2 and Dzhaparidze-Nikulin U2 tests, and the corresponding p-values. The construction of all three tests is based on the Wald's type chi-squared goodness-of-fit tests. The vector of unknown parameters is estimated by the maximum likelihood method.The Karhunen-Loeve transformation is applied to a multi-dimensional sample data in order to diagonalize a sample covariance matrix. The null asymptotic distributions of the S2, Y2 and U2 tests are chi-squared distributions with 1, M-1 and M-2 degrees of freedom correspondingly.

Value

s2

the value of the McCulloch test S2

p.value.s2

the p-value of S2 test

y2

the value of the Nikulin-Rao-Robson test Y2

p.value.y2

the p-value of Y2 test

u2

the value of the Dzhaparidze-Nikulin test U2

p.value.u2

the p-value of U2 test

data.name

a character string giving the name of the data

Note

The displayed result about multivariate normality is based on the McCulloch S2 test.

Author(s)

Vassilly Voinov, Natalya Pya, Rashid Makarov, Yevgeniy Voinov

References

Voinov, V., Pya, N., Makarov, R., and Voinov, Y. (2015) New invariant and consistent chi-squared type goodness-of-fit tests for multivariate normality and a related comparative simulation study. Communications in Statistics - Theory and Methods. doi link: http://www.tandfonline.com/doi/full/10.1080/03610926.2014.901370

Voinov, V., Nikulin, M. and Balakrishnan, N., Chi-squared goodness of fit tests with applications. New York: Academic Press, Elsevier, 2013

See Also

AD.test, DH.test, R.test, CM.test, HZ.test

Examples

## generating n bivariate normal random variables...       
dat <- rmvnorm(n=200,mean=rep(0,2),sigma=matrix(c(4,2,2,4),2,2)) 
res <- S2.test(dat, qqplot = FALSE)
res
## generating n bivariate t distributed with 10df random variables...       
dat <- rmvt(n=200,sigma=matrix(c(4,2,2,4),2,2)*.8,df=10,delta=rep(0,2)) 
res1 <- S2.test(dat, qqplot = TRUE)
res1

data(iris)
setosa = iris[1:50, 1:4] # Iris data only for setosa
res2 <- S2.test(setosa, qqplot = TRUE)
res2