Learn R Programming

PEtests (version 0.1.0)

meantest.cq: Two-sample high-dimensional mean test (Chen and Qin, 2010)

Description

This function implements the two-sample \(l_2\)-norm-based high-dimensional mean test proposed by Chen and Qin (2010). 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 \(M_{CQ}\) is defined as $$M_{CQ} = \frac{1}{n_1(n_1-1)}\sum_{u\neq v}^{n_1} \mathbf{X}_{u}'\mathbf{X}_{v} +\frac{1}{n_2(n_2-1)}\sum_{u\neq v}^{n_2} \mathbf{Y}_{u}'\mathbf{Y}_{v} -\frac{2}{n_1n_2}\sum_u^{n_1}\sum_v^{n_2} \mathbf{X}_{u}'\mathbf{Y}_{v}.$$ Under the null hypothesis \(H_{0m}: \boldsymbol{\mu}_1 = \boldsymbol{\mu}_2\), the leading variance of \(M_{CQ}\) is \(\sigma^2_{M_{CQ}}=\frac{2}{n_1(n_1-1)}\text{tr}(\mathbf{\Sigma}_1^2)+ \frac{2}{n_2(n_2-1)}\text{tr}(\mathbf{\Sigma}_2^2)+ \frac{4}{n_1n_2}\text{tr}(\mathbf{\Sigma}_1\mathbf{\Sigma}_2)\), which can be consistently estimated by \(\widehat\sigma^2_{M_{CQ}}= \frac{2}{n_1(n_1-1)}\widehat{\text{tr}(\mathbf{\Sigma}_1^2)}+ \frac{2}{n_2(n_2-1)}\widehat{\text{tr}(\mathbf{\Sigma}_2^2)}+ \frac{4}{n_1n_2}\widehat{\text{tr}(\mathbf{\Sigma}_1\mathbf{\Sigma}_2)}.\) The explicit formulas of \(\widehat{\text{tr}(\mathbf{\Sigma}_1^2)}\), \(\widehat{\text{tr}(\mathbf{\Sigma}_2^2)}\), and \(\widehat{\text{tr}(\mathbf{\Sigma}_1\mathbf{\Sigma}_2)}\) can be found in Section 3 of Chen and Qin (2010). With some regularity conditions, under the null hypothesis \(H_{0m}: \boldsymbol{\mu}_1 = \boldsymbol{\mu}_2\), the test statistic \(M_{CQ}\) converges in distribution to a standard normal distribution as \(n_1, n_2, p \rightarrow \infty\). The asymptotic \(p\)-value is obtained by $$p_{CQ} = 1-\Phi(M_{CQ}/\hat\sigma_{M_{CQ}}),$$ where \(\Phi(\cdot)\) is the cdf of the standard normal distribution.

Usage

meantest.cq(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

Chen, S. X. and Qin, Y. L. (2010). A two-sample test for high-dimensional data with applications to gene-set testing. Annals of Statistics, 38(2):808–835.

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)
meantest.cq(X,Y)

Run the code above in your browser using DataLab