Learn R Programming

mvnormalTest (version 1.0.0)

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

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

# }

Run the code above in your browser using DataLab