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 |
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.
Package: | mvnTest |
Type: | Package |
License: | GPL (>= 2) |
The printing method and plotting are in part adapted from R package MVN
(version 4.0, Korkmaz, S. et al., 2015)
Vassilly Voinov, Natalya Pya, Rashid Makarov, Yevgeniy Voinov
Maintainer: Natalya Pya <[email protected]>
"ad"
An S4 class for the Anderson-Darling test for multivariate normality.
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
Natalya Pya, Vassilly Voinov, Rashid Makarov
This function implements the Anderson-Darling test for assessing multivariate normality. It calculates the value of the test and its approximate p-value.
AD.test(data, qqplot = FALSE)
AD.test(data, qqplot = FALSE)
data |
A numeric matrix or data frame. |
qqplot |
If |
AD |
the value of the test statistic. |
p.value |
the p-value of the test. |
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.
Rashid Makarov, Vassilly Voinov, Natalya Pya
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
S2.test
,
CM.test
,
DH.test
,
R.test
,
HZ.test
## 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)
## 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)
"cm"
An S4 class for the Cramer-von Mises test for multivariate normality.
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
Natalya Pya, Vassilly Voinov, Rashid Makarov
This function implements the Cramer-von Mises test for assessing multivariate normality.
CM.test(data, qqplot = FALSE)
CM.test(data, qqplot = FALSE)
data |
A numeric matrix or data frame |
qqplot |
if |
Calculates the value of the Cramer-von Mises test and the approximate p-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 |
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.
Rashid Makarov, Vassilly Voinov, Natalya Pya
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
S2.test
,
AD.test
,
DH.test
,
R.test
,
HZ.test
## 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)
## 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)
"dh"
An S4 class for the Doornik-Hansen test for multivariate normality.
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
Natalya Pya, Vassilly Voinov, Rashid Makarov
This function implements the Doornik-Hansen test for assessing multivariate normality.
DH.test(data, qqplot = FALSE)
DH.test(data, qqplot = FALSE)
data |
A numeric matrix or data frame |
qqplot |
if |
Calculates the value of the Doornik-Hansen test and the approximate p-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 |
The printing method and plotting are in part adapted from R package MVN
(version 4.0, Korkmaz, S. et al., 2015).
Rashid Makarov, Vassilly Voinov, Natalya Pya
Doornik, J. and Hansen, H. (2008). An omnibus test for univariate and multivariate normality. Oxford Bulletin of Economics and Statistics, 70, 915-925.
S2.test
,
AD.test
, CM.test
,
R.test
, HZ.test
## 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
## 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
"hz"
An S4 class for the Henze-Zirkler test for multivariate normality.
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
Natalya Pya, Vassilly Voinov, Rashid Makarov
This function implements the Henze-Zirkler test for assessing multivariate normality.
HZ.test(data, qqplot = FALSE)
HZ.test(data, qqplot = FALSE)
data |
A numeric matrix or data frame |
qqplot |
if |
Calculates the value of the Henze-Zirkler test and the approximate p-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 |
The printing method and plotting are in part adapted from R package MVN
(Korkmaz, S. et al., 2015, version 4.0).
Rashid Makarov, Vassilly Voinov, Natalya Pya
Henze, N. and Zirkler, B. (1990). A class of invariant consistent tests for multivariate normality. Communications in Statistics-Theory and Methods, 19, 3595-3617
S2.test
, DH.test
,
AD.test
, CM.test
,
R.test
## 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
## 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
"r"
An S4 class for the Royston test for multivariate normality.
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
Natalya Pya, Vassilly Voinov, Rashid Makarov
This function implements the Royston test for assessing multivariate normality.
R.test(data, qqplot = FALSE)
R.test(data, qqplot = FALSE)
data |
A numeric matrix or data frame |
qqplot |
if |
Calculates the value of the Royston test and the approximate p-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 |
The printing method and plotting are in part adapted from R package MVN
(Korkmaz, S. et al., 2015, version 4.0).
Rashid Makarov, Vassilly Voinov, Natalya Pya
Royston, P. (1992). Approximating the Shapiro-Wilk W-test for non-normality. Statistics and Computing, 2, 117-119.
S2.test
, DH.test
,
AD.test
, CM.test
,
HZ.test
## 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
## 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
"S2"
An S4 class for Chi-squared type tests for multivariate normality.
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
Natalya Pya, Vassilly Voinov, Rashid Makarov
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.
S2.test(data, M=5, qqplot = FALSE)
S2.test(data, M=5, qqplot = FALSE)
data |
A numeric matrix or data frame |
M |
A number of equiprobable intervals |
qqplot |
if |
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.
s2 |
the value of the McCulloch test |
p.value.s2 |
the p-value of |
y2 |
the value of the Nikulin-Rao-Robson test |
p.value.y2 |
the p-value of |
u2 |
the value of the Dzhaparidze-Nikulin test |
p.value.u2 |
the p-value of |
data.name |
a character string giving the name of the data |
The displayed result about multivariate normality is based on the McCulloch S2
test.
Vassilly Voinov, Natalya Pya, Rashid Makarov, Yevgeniy Voinov
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
AD.test
,
DH.test
,
R.test
, CM.test
,
HZ.test
## 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
## 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