SNET: Two-Sample Covariance Test

View source: R/SNET.R

SNETR Documentation

Two-Sample Covariance Test

Description

Given two sets of data matrices X and Y, where X is an n_1 \times p matrix and Y is an n_2 \times p matrix, we conduct hypothesis testing of the covariance matrix between two samples. The null hypothesis is

H_0 : \Sigma_1 = \Sigma_2,

where \Sigma_1 and \Sigma_2 are the sample covariance matrices of X and Y respectively. The test is based on the method proposed by Cai, Liu and Xia (2013). When the p-value is less than the significance level (generally 0.05), the null hypothesis is rejected.

Usage

SNET(X, Y, B = 200, mc.cores = 1L, alpha = 0.05, k = 3)

Arguments

X

A numeric matrix of dimension n_1 \times p.

Y

A numeric matrix of dimension n_2 \times p.

B

Integer, number of bootstrap replicates. Default is 200.

mc.cores

Integer, number of cores for parallel computing. Default is 1 (serial execution).

alpha

Numeric, significance level. Default is 0.05.

k

Numeric, tuning parameter. Default is 3.

Value

A list with components:

stat

the test statistic.

pval

the p-value.

z

the standardized test statistic.

References

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

Examples

## Not run: 
## generate data from multivariate normal with trivial covariance
p  <- 500
n1 <- 100
n2 <- 150
B  <- 300
X <- matrix(rnorm(n1 * p), ncol = p)
Y <- matrix(rnorm(n2 * p), ncol = p)
## run test
SNET(X, Y, B, alpha = 0.05)

## End(Not run)


Docovt documentation built on Oct. 19, 2026, 5:06 p.m.

Related to SNET in Docovt...