Learn R Programming

CovTools (version 0.4.0)

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\times p)\) matrix where each row is an observation from the first dataset.

Y

an \((n\times 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

cai_optimal_2013CovTools

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