Learn R Programming

mvnormalTest (version 1.0.0)

IMMV: 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

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab