cov1.2015WL: One-sample Test for Covariance Matrix by Wu and Li (2015)

View source: R/cov1_2015WL.R

cov1.2015WLR Documentation

One-sample Test for Covariance Matrix by Wu and Li (2015)

Description

Given a multivariate sample X and hypothesized covariance matrix Σ_0, it tests

H_0 : Σ_x = Σ_0\quad vs\quad H_1 : Σ_x \neq Σ_0

using the procedure by Wu and Li (2015). They proposed to use m number of multiple random projections since only a single operation might attenuate the efficacy of the test.

Usage

cov1.2015WL(X, Sigma0 = diag(ncol(X)), m = 25)

Arguments

X

an (n\times p) data matrix where each row is an observation.

Sigma0

a (p\times p) given covariance matrix.

m

the number of random projections to be applied.

Value

a (list) object of S3 class htest containing:

statistic

a test statistic.

p.value

p-value under H_0.

alternative

alternative hypothesis.

method

name of the test.

data.name

name(s) of provided sample data.

References

\insertRef

wu_tests_2015SHT

Examples

## CRAN-purpose small example
smallX = matrix(rnorm(10*3),ncol=3)
cov1.2015WL(smallX) # run the test


## empirical Type 1 error 
##   compare effects of m=5, 10, 50
niter = 1000
rec1  = rep(0,niter) # for m=5
rec2  = rep(0,niter) #     m=10
rec3  = rep(0,niter) #     m=50
for (i in 1:niter){
  X = matrix(rnorm(50*10), ncol=50) # (n,p) = (10,50)
  rec1[i] = ifelse(cov1.2015WL(X, m=5)$p.value < 0.05, 1, 0)
  rec2[i] = ifelse(cov1.2015WL(X, m=10)$p.value < 0.05, 1, 0)
  rec3[i] = ifelse(cov1.2015WL(X, m=50)$p.value < 0.05, 1, 0)
}

## print the result
cat(paste("\n* Example for 'cov1.2015WL'\n","*\n",
"* Type 1 error with m=5   : ",round(sum(rec1/niter),5),"\n",
"* Type 1 error with m=10  : ",round(sum(rec2/niter),5),"\n",
"* Type 1 error with m=50  : ",round(sum(rec3/niter),5),"\n",sep=""))



SHT documentation built on Nov. 3, 2022, 9:06 a.m.

Related to cov1.2015WL in SHT...