cov1.2015WL | R Documentation |
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.
cov1.2015WL(X, Sigma0 = diag(ncol(X)), m = 25)
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. |
a (list) object of S3
class htest
containing:
a test statistic.
p-value under H_0.
alternative hypothesis.
name of the test.
name(s) of provided sample data.
wu_tests_2015SHT
## 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=""))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.