Type: Package
Title: Powerful Tests for Multivariate Normality
Version: 1.0.1
Date: 2025-06-02
Author: Yian Zhang [aut, cre], Ming Zhou [aut], Yongzhao Shao [aut]
Maintainer: Yian Zhang <yz2777@nyu.edu>
Description: A simple informative powerful test (mvnTest()) for multivariate normality proposed by Zhou and Shao (2014) <doi:10.1080/02664763.2013.839637>, which combines kurtosis with Shapiro-Wilk test that is easy for biomedical researchers to understand and easy to implement in all dimensions. This package also contains some other multivariate normality tests including Fattorini's FA test (faTest()), Mardia's skewness and kurtosis test (mardia()), Henze-Zirkler's test (mhz()), Bowman and Shenton's test (msk()), Royston’s H test (msw()), and Villasenor-Alva and Gonzalez-Estrada's test (msw()). Empirical power calculation functions for these tests are also provided. In addition, this package includes some functions to generate several types of multivariate distributions mentioned in Zhou and Shao (2014).
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
Encoding: UTF-8
Imports: stats, nortest, moments, copula
Suggests: knitr
Depends: R (≥ 3.5.0)
Language: en-US
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-06-03 02:17:20 UTC; leons
Repository: CRAN
Date/Publication: 2025-06-04 05:30:02 UTC

Random Generation for Distribution with Independent Marginals

Description

Generate univariate or multivariate random sample for distribution with independent marginals such that D_1 \otimes D_2. D_1 \otimes D_2 denotes the distribution having independent marginal distributions D_1 and D_2. This function can generate multivariate random samples only from distribution D_1 or from both D_1 and D_2.

Usage

IMMV(n, p, q = NULL, D1, D2 = NULL, D1.args = list(), D2.args = list())

Arguments

n

number of rows (observations).

p

total number of columns (variables).

q

number of columns from distribution D1 if generate multivariate samples from independent marginal distribution D_1 and D_2. Default is NULL, i.e., generating samples only from one distribution.

D1

random generation function for 1st distribution (e.g., rnorm, rbeta).

D2

random generation function for 2nd distribution (e.g., rnorm, rbeta).

D1.args

a list of optional arguments passed to D1.

D2.args

a list of optional arguments passed to D2.

Value

Returns univariate (p=1) or multivariate (p>1) random sample matrix.

References

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

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

Examples

set.seed(12345)

## Generate 5X2 random sample matrix from IMMV(N(0,1),Beta(1,2)) ##
IMMV(n=5, p=2, q=1, D1=rbeta, D1.args=list(shape1=1,shape2=2), D2=rnorm)


## Power calculation against bivariate (p=2) IMMV(Gamma(5,1)) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

# Zhou-Shao's test #
power.mvnTest(a=0.05, n=50, p=2, B=100, FUN=IMMV, D1=rgamma, D1.args=list(shape=5, rate=1))

## Power calculation against bivariate (p=2) IMMV(N(0,1),Beta(1,2)) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

# Zhou-Shao's test #
power.mvnTest(a=0.05, n=50, p=2, B=100, FUN=IMMV, q=1, D1=rbeta, D1.args=list(shape1=1,shape2=2),
D2=rnorm)


Random Generation for the Normal Mixture Distribution

Description

Generate univariate or multivariate random sample for the normal mixture distribution with density \lambda N(0,\sum_1)+(1-\lambda)N(bl, \sum_2), where l is the column vector with all elements being 1, \sum_i=(1-\rho_i)I+\rho_ill^T for i=1,2. \rho has to satisfy \rho > -1/(p-1) in order to make the covariance matrix meaningful.

Usage

MVNMIX(n, p, lambda, mu2, rho1 = 0, rho2 = 0)

Arguments

n

number of rows (observations).

p

total number of columns (variables).

lambda

weight parameter to allocate the proportions of the mixture, 0<\lambda<1.

mu2

is bl of N(bl, \sum_2).

rho1

parameter in \sum_1.

rho2

parameter in \sum_2.

Value

Returns univariate (p=1) or multivariate (p>1) random sample matrix.

References

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

Examples

set.seed(12345)

## Generate 5X2 random sample matrix from MVNMIX(0.5,4,0,0) ##
MVNMIX(n=5, p=2, lambda=0.5, mu2=4, rho1=0, rho2=0)


## Power calculation against bivariate (p=2) MVNMIX(0.5,4,0,0) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

# Zhou-Shao's test #
power.mvnTest(a=0.05, n=50, p=2, B=100, FUN=MVNMIX, lambda=0.5, mu2=4, rho1=0, rho2=0)


Random Generation for the Spherically Symmetric Pearson Type II Distribution

Description

Generate univariate or multivariate random sample for the spherically symmetric Pearson type II distribution.

Usage

PSII(n, p, s)

Arguments

n

number of rows (observations).

p

number of columns (variables).

s

shape parameter, s>-1.

Value

Returns univariate (p=1) or multivariate (p>1) random sample matrix.

References

Kotz, S. (1975). Multivariate distributions at a cross road. In A Modern Course on Statistical Distributions in Scientific Work (pp. 247-270). Springer, Dordrecht.

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

Examples

set.seed(12345)

## Generate 5X2 random sample matrix from PSII(s=1) ##
PSII(n=5, p=2, s=1)


## Power calculation against bivariate (p=2) PSII(s=1) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

# Zhou-Shao's test #
power.mvnTest(a = 0.05, n = 50, p = 2,  B = 100, FUN = PSII, s = 1)


Random Generation for the Spherically Symmetric Pearson Type VII Distribution

Description

Generate univariate or multivariate random sample for the spherically symmetric Pearson type VII distribution.

Usage

PSVII(n, p, s)

Arguments

n

number of rows (observations).

p

number of columns (variables).

s

shape parameter, s > p/2.

Value

Returns univariate (p=1) or multivariate (p>1) random sample matrix.

References

Kotz, S. (1975). Multivariate distributions at a cross road. In A Modern Course on Statistical Distributions in Scientific Work (pp. 247-270). Springer, Dordrecht.

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

Examples

set.seed(12345)

## Generate 5X2 random sample matrix from PSVII(s=3) ##
PSVII(n=5, p=2, s=3)


## Power calculation against bivariate (p=2) PSVII(s=3) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

# Zhou-Shao's test #
power.mvnTest(a = 0.05, n = 50, p = 2,  B = 100, FUN = PSVII, s = 3)


Random Generation for General Spherically Symmetric Distributions

Description

Generate univariate or multivariate random sample for general spherically symmetric distributions.

Usage

SPH(n, p, D, ...)

Arguments

n

number of rows (observations).

p

number of columns (variables).

D

random generation functions for some distributions (e.g., rgamma, rbeta).

...

optional arguments passed to D.

Value

Returns univariate (p=1) or multivariate (p>1) random sample matrix.

References

Chmielewski, M. A. (1981). Elliptically symmetric distributions: A review and bibliography. International Statistical Review/Revue Internationale de Statistique, 67-74.

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

Examples

set.seed(12345)

## Generate 5X2 random sample matrix from SPH(Beta(1,1)) ##
SPH(n=5, p=2, D=rbeta, shape1=1, shape2=1)


## Power calculation against bivariate (p=2) SPH(Beta(1,1)) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

# Zhou-Shao's test #
power.mvnTest(a=0.05, n=50, p=2, B=100, FUN=SPH, D=rbeta, shape1=1, shape2=1)


Random Generation for the Copula Generated Distributions

Description

Generate univariate or multivariate random sample for the Copula Generated Distributions.

Usage

copulas(n, p, c = "clayton", param, invF, ...)

Arguments

n

number of rows (observations).

p

total number of columns (variables).

c

name of an Archimedean copula, choosing from "clayton" (default), "frank", or "gumbel".

param

number (numeric) specifying the copula parameter.

invF

inverse function (quantile function, e.g. qnorm).

...

optional arguments passed to invF.

Value

univariate (p=1) or multivariate (p>1) random sample.

References

Yan, J. (2007). Enjoy the joy of copulas: with a package copula. Journal of Statistical Software, 21(4), 1-21.

Examples

set.seed(12345)

## Generate 5X2 random sample matrix from Clayton(0.5, qnorm) ##
copulas(n=50, p=2, c="clayton", param=0.5, invF=qnorm)


## Power calculation against bivariate (p=2) Clayton(0.5, qnorm) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

# Zhou-Shao's test #
power.mvnTest(a=0.05, n=50, p=2, B=100, FUN=copulas, c="clayton", param=0.5, invF=qnorm)


Rotational Robust Shapiro-Wilk Type (SWT) Test for Multivariate Normality (FA Test of Fattorini)

Description

It computes FA Test proposed by Fattorini (1986). This test would be more rotationally robust than other SWT tests such as Royston (1982) H test and the test proposed by Villasenor-Alva and Gonzalez-Estrada (2009). The p-value of the test statistic is computed based on a simulated null distribution of the statistic.

Usage

faTest(X, B = 1000)

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).

Value

Returns a list with two objects:

mv.test

results of the FA test for multivariate normality, 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

Fattorini, L. (1986). Remarks on the use of Shapiro-Wilk statistic for testing multivariate normality. Statistica, 46(2), 209-217.

Lee, R., Qian, M., & Shao, Y. (2014). On rotational robustness of Shapiro-Wilk type tests for multivariate normality. Open Journal of Statistics, 4(11), 964.

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

Royston, J. P. (1982). An extension of Shapiro and Wilk's W test for normality to large samples. Journal of the Royal Statistical Society: Series C (Applied Statistics), 31(2), 115-124.

Villasenor Alva, J. A., & Estrada, E. G. (2009). A generalization of Shapiro–Wilk's test for multivariate normality. Communications in Statistics—Theory and Methods, 38(11), 1870-1883.

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

See Also

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

Examples

set.seed(12345)

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

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


Mardia Test (Skewness and Kurtosis) for Multivariate Normality

Description

It computes Mardia (1970)'s multivariate skewness and kurtosis statistics and their corresponding p-value. Both p-values of skewness and kurtosis statistics should be greater than 0.05 to conclude multivariate normality. The skewness statistic will be adjusted for sample size n < 20.

Usage

mardia(X, std = TRUE)

Arguments

X

an n*p numeric matrix or data frame.

std

if TRUE, the data matrix or data frame will be standardized via normalizing the covariance matrix by n.

Value

Returns a list with two objects:

mv.test

results of the Mardia test, i.e., test statistic, p-value, and multivariate normality summary (YES, if both skewness and kurtosis 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

Mardia, K. V. (1970). Measures of multivariate skewness and kurtosis with applications. Biometrika, 57(3), 519-530.

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

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

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

See Also

mvnTest, faTest, msw, msk, mhz, mvn

Examples

set.seed(12345)

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

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

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


Henze-Zirkler Test for Multivariate Normality

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

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

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)

Bowman and Shenton Test for Multivariate Normality

Description

It computes Bowman and Shenton (1975)'s test statistic (MSK) and its corresponding p-value for multivariate normality. The statistic is calculated based on a combination of multivariate skewness (MS) and kurtosis (MK) such that MSK=MS+|MK|^2. For formulas of MS and MK, please refer to Mardia (1970). The corresponding p-value of the statistic is computed based on a simulated null distribution of MSK. The skewness statistic (MS) will be adjusted for sample size n < 20.

Usage

msk(X, B = 1000)

Arguments

X

an n*p numeric matrix or data frame.

B

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

Value

Returns a list with two objects:

mv.test

results of the Bowman and Shenton 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

Bowman, K. O., & Shenton, L. R. (1975). Omnibus test contours for departures from normality based on \sqrt b_1 and b_2. Biometrika, 62(2), 243-250.

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

Mardia, K. V. (1970). Measures of multivariate skewness and kurtosis with applications. Biometrika, 57(3), 519-530.

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

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

See Also

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

Examples

set.seed(12345)

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

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


Shapiro-Wilk Type (SWT) Tests for Multivariate Normality

Description

The SWT-based tests for multivariate normality including Royston's H test and the test proposed by Villasenor-Alva and Gonzalez-Estrada (2009).

Usage

msw(X)

Arguments

X

an n*p numeric matrix or data frame, the number of n must be between 3 and 5000, n>p.

Value

Returns a list with two objects:

mv.test

a result table of multivariate normality tests, including the name of the test, test statistic, p-value, and multivariate normality summary (Yes, if p-value>0.05). Note that the test results of Royston will not be reported if n > 2000 or n < 3 and the test results of Villasenor-Alva and Gonzalez-Estrada (VAGE) will not be reported if n > 5000 or n < 12.

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).

If the number of variable is p=1, only univariate Shapiro-wilk's test result will be produced.

References

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

Royston, J. P. (1982). An extension of Shapiro and Wilk's W test for normality to large samples. Journal of the Royal Statistical Society: Series C (Applied Statistics), 31(2), 115-124.

Villasenor Alva, J. A., & Estrada, E. G. (2009). A generalization of Shapiro–Wilk's test for multivariate normality. Communications in Statistics—Theory and Methods, 38(11), 1870-1883.

Lee, R., Qian, M., & Shao, Y. (2014). On rotational robustness of Shapiro-Wilk type tests for multivariate normality. Open Journal of Statistics, 4(11), 964.

See Also

power.mswR, power.mswV, mvnTest, faTest, msk, mardia, mhz, mvn, shapiro.test

Examples

set.seed(12345)

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

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

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


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

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)


Power Calculation using the Fattorini's FA Test Statistic

Description

Empirical power calculation using the Fattorini's FA Test Statistic.

Usage

power.faTest(a, n, p, B = 1000, FUN, ...)

Arguments

a

significance level (\alpha).

n

number of rows (observations).

p

number of columns (variables), n>p.

B

number of Monte Carlo simulations, default is 1000 (can increase B to increase the precision).

FUN

self-defined function for generate multivariate distribution. See example.

...

optional arguments passed to FUN.

Value

Returns a numeric value of the estimated empirical power (value between 0 and 1).

References

Fattorini, L. (1986). Remarks on the use of Shapiro-Wilk statistic for testing multivariate normality. Statistica, 46(2), 209-217.

Examples

set.seed(12345)

## Power calculation against bivariate (p=2) independent Beta(1, 1) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

power.faTest(a = 0.05, n = 50, p = 2,  B = 100, FUN=IMMV, D1=runif)


Power Calculation using the Henze-Zirkler Test Statistic

Description

Empirical power calculation using the Henze-Zirkler Test Statistic.

Usage

power.mhz(a, n, p, B = 1000, FUN, ...)

Arguments

a

significance level (\alpha).

n

number of rows (observations).

p

number of columns (variables), n>p.

B

number of Monte Carlo simulations, default is 1000 (can increase B to increase the precision).

FUN

self-defined function for generate multivariate distribution. See example.

...

optional arguments passed to FUN.

Value

Returns a numeric value of the estimated empirical power (value between 0 and 1).

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.

Examples

set.seed(12345)

## Power calculation against bivariate (p=2) independent Beta(1, 1) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

power.mhz(a = 0.05, n = 50, p = 2,  B = 100, FUN=IMMV, D1=runif)


Power Calculation using the Bowman and Shenton Test Statistic

Description

Empirical power calculation using Bowman and Shenton Test Statistic.

Usage

power.msk(a, n, p, B = 1000, FUN, ...)

Arguments

a

significance level (\alpha).

n

number of rows (observations).

p

number of columns (variables), n>p.

B

number of Monte Carlo simulations, default is 1000 (can increase B to increase the precision).

FUN

self-defined function for generate multivariate distribution. See example.

...

optional arguments passed to FUN.

Value

Returns a numeric value of the estimated empirical power (value between 0 and 1).

References

Bowman, K. O., & Shenton, L. R. (1975). Omnibus test contours for departures from normality based on \sqrt b_1 and b_2. Biometrika, 62(2), 243-250.

Examples

set.seed(12345)

## Power calculation against bivariate (p=2) independent Beta(1, 1) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

power.msk(a = 0.05, n = 50, p = 2,  B = 100, FUN=IMMV, D1=runif)


Power Calculation using the SWT-based Royston Test Statistic

Description

Empirical power calculation using Royston test statistic.

Usage

power.mswR(a, n, p, B = 1000, FUN, ...)

Arguments

a

significance level (\alpha).

n

number of rows (observations).

p

number of columns (variables), n>p.

B

number of Monte Carlo simulations, default is 1000 (can increase B to increase the precision).

FUN

self-defined function for generate multivariate distribution. See example.

...

optional arguments passed to FUN.

Value

Returns a numeric value of the estimated empirical power (value between 0 and 1).

References

Royston, J. P. (1982). An extension of Shapiro and Wilk's W test for normality to large samples. Journal of the Royal Statistical Society: Series C (Applied Statistics), 31(2), 115-124.

Examples

set.seed(12345)

## Power calculation against bivariate (p=2) independent Beta(1, 1) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

power.mswR(a = 0.05, n = 50, p = 2,  B = 100, FUN=IMMV, D1=runif)


Power Calculation using the SWT-based Villasenor-Alva and Gonzalez-Estrada (VAGE) Test Statistic

Description

Empirical power calculation using VAGE test statistic.

Usage

power.mswV(a, n, p, B = 1000, FUN, ...)

Arguments

a

significance level (\alpha).

n

number of rows (observations).

p

number of columns (variables), n>p.

B

number of Monte Carlo simulations, default is 1000 (can increase B to increase the precision).

FUN

self-defined function for generate multivariate distribution. See example.

...

optional arguments passed to FUN.

Value

Returns a numeric value of the estimated empirical power (value between 0 and 1).

References

Villasenor Alva, J. A., & Estrada, E. G. (2009). A generalization of Shapiro–Wilk's test for multivariate normality. Communications in Statistics—Theory and Methods, 38(11), 1870-1883.

Examples

set.seed(12345)

## Power calculation against bivariate (p=2) independent Beta(1, 1) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

power.mswV(a = 0.05, n = 50, p = 2,  B = 100, FUN=IMMV, D1=runif)


Power Calculation using the Zhou-Shao's Multivariate Normality Test Statistic (T_n)

Description

Empirical power calculation using the Zhou-Shao's multivariate normality test Statistic T_n.

Usage

power.mvnTest(a, n, p, B = 1000, pct = c(0.01, 0.99), FUN, ...)

Arguments

a

significance level (\alpha).

n

number of rows (observations).

p

number of columns (variables), n>p.

B

number of Monte Carlo simulations, default is 1000 (can increase B to increase the precision).

pct

percentiles of MK to get c1 and c2 described in the reference paper,default is (0.01, 0.99).

FUN

self-defined function for generate multivariate distribution. See example.

...

optional arguments passed to FUN.

Value

Returns a numeric value of the estimated empirical power (value between 0 and 1).

References

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

Examples

set.seed(12345)

## Power calculation against bivariate (p=2) independent Beta(1, 1) distribution ##
## at sample size n=50 for Tn at one-sided alpha = 0.05 ##

power.mvnTest(a = 0.05, n = 50, p = 2,  B = 100, pct = c(0.01, 0.99), FUN=IMMV, D1=runif)


Power Calculation using the Univariate Shapiro-Wilk Test Statistic

Description

Empirical power calculation using univariate Shapiro-Wilk test statistic.

Usage

power.usw(a, n, p = 1, B = 1000, FUN, ...)

Arguments

a

significance level (\alpha).

n

number of rows (observations).

p

p=1 for univariate.

B

number of Monte Carlo simulations, default is 1000 (can increase B to increase the precision).

FUN

self-defined function for generate multivariate distribution. See example.

...

optional arguments passed to FUN.

Value

Returns a numeric value of the estimated empirical power (value between 0 and 1).

References

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

Examples

set.seed(12345)

## Power calculation against univariate (p=1) independent Beta(1, 1) distribution ##
## at sample size n=50 at one-sided alpha = 0.05 ##

power.usw(a = 0.05, n = 50, p = 1,  B = 100, FUN=IMMV, D1=runif)