Learn R Programming

CovTools (version 0.2.1)

CovTest2: Two-Sample Tests for Covariance Matrices

Description

Given two sets of data, CovTest2 performs 2-sample test for Covariance where the null hypothesis is $$H_0 : \Sigma_1 = \Sigma_2$$ where \(\Sigma_1\) and \(\Sigma_2\) represent true (unknown) covariance for each dataset.

Usage

CovTest2(X, Y, alpha = 0.05, method = c("Cai13"))

Arguments

X

an (m-by-p) matrix where each row is an observation from the first dataset.

Y

an (n-by-p) matrix where each row is an observation from the second dataset.

alpha

level of significance.

method

a name of test.

Value

a named list containing

statistic

a test statistic value.

threshold

rejection criterion to be compared against test statistic.

reject

a logical; TRUE to reject null hypothesis, FALSE otherwise.

References

[Cai13] Cai, T., Liu, W., and Xia, Y. (2013) Two-Sample Covariance Matrix Testing and Support Recovery in High-Dimensional and Sparse Settings. Journal of American Statistical Association, Vol.108(501):265-277.

Examples

Run this code
# NOT RUN {
## generate 2 datasets from multivariate normal with identical covariance.
data1 = mvtnorm::rmvnorm(100, sigma=diag(5))
data2 = mvtnorm::rmvnorm(200, sigma=diag(5))

## run test
CovTest2(data1, data2)


# }

Run the code above in your browser using DataLab