Learn R Programming

PEtests (version 0.1.0)

covtest.clx: Two-sample high-dimensional covariance test (Cai, Liu and Xia, 2013)

Description

This function implements the two-sample \(l_\infty\)-norm-based high-dimensional covariance test proposed in Cai, Liu and Xia (2013). Suppose \(\{\mathbf{X}_1, \ldots, \mathbf{X}_{n_1}\}\) are i.i.d. copies of \(\mathbf{X}\), and \(\{\mathbf{Y}_1, \ldots, \mathbf{Y}_{n_2}\}\) are i.i.d. copies of \(\mathbf{Y}\). The test statistic is defined as $$T_{CLX} = \max_{1\leq i,j \leq p} \frac{(\hat\sigma_{ij1}-\hat\sigma_{ij2})^2} {\hat\theta_{ij1}/n_1+\hat\theta_{ij2}/n_2},$$ where \(\hat\sigma_{ij1}\) and \(\hat\sigma_{ij2}\) are the sample covariances, and \(\hat\theta_{ij1}/n_1+\hat\theta_{ij2}/n_2\) estimates the variance of \(\hat{\sigma}_{ij1}-\hat{\sigma}_{ij2}\). The explicit formulas of \(\hat\sigma_{ij1}\), \(\hat\sigma_{ij2}\), \(\hat\theta_{ij1}\) and \(\hat\theta_{ij2}\) can be found in Section 2 of Cai, Liu and Xia (2013). With some regularity conditions, under the null hypothesis \(H_{0c}: \mathbf{\Sigma}_1 = \mathbf{\Sigma}_2\), the test statistic \(T_{CLX}-4\log p+\log\log p\) converges in distribution to a Gumbel distribution \(G_{cov}(x) = \exp(-\frac{1}{\sqrt{8\pi}}\exp(-\frac{x}{2}))\) as \(n_1, n_2, p \rightarrow \infty\). The asymptotic \(p\)-value is obtained by $$p_{CLX} = 1-G_{cov}(T_{CLX}-4\log p+\log\log p).$$

Usage

covtest.clx(dataX,dataY)

Value

stat the value of test statistic

pval the p-value for the test.

Arguments

dataX

an \(n_1\) by \(p\) data matrix

dataY

an \(n_2\) by \(p\) data matrix

References

Cai, T. T., Liu, W., and Xia, Y. (2013). Two-sample covariance matrix testing and support recovery in high-dimensional and sparse settings. Journal of the American Statistical Association, 108(501):265–277.

Examples

Run this code
n1 = 100; n2 = 100; pp = 500
set.seed(1)
X = matrix(rnorm(n1*pp), nrow=n1, ncol=pp)
Y = matrix(rnorm(n2*pp), nrow=n2, ncol=pp)
covtest.clx(X,Y)

Run the code above in your browser using DataLab