Learn R Programming

Domean (version 0.1)

CQ2: Two-Sample CQ Test for High-Dimensional Covariance Matrices

Description

Performs a two-sample test to compare the covariance matrices of two high-dimensional samples. This test is designed for situations where the number of variables \( p \) is large relative to the sample sizes \( n_1 \) and \( n_2 \).

Usage

CQ2(X, Y)

Value

A list containing the following components:

statistics

The test statistic \( Q_n \).

p.value

The p-value of the test.

alternative

The alternative hypothesis ("two.sided").

method

The method used ("Two-Sample CQ test").

Arguments

X

A numeric matrix representing the first sample, where rows are variables and columns are observations.

Y

A numeric matrix representing the second sample, where rows are variables and columns are observations.

Details

The test statistic is based on the difference between the sample covariance matrices, normalized by their variances. The p-value is computed using a normal approximation.

Examples

Run this code
  # Example usage:
  set.seed(123)
  p <- 50
  n1 <- 30
  n2 <- 30
  X <- matrix(rnorm(n1 * p), nrow = p, ncol = n1)
  Y <- matrix(rnorm(n2 * p), nrow = p, ncol = n2)
  result <- CQ2(X, Y)
  print(result)

Run the code above in your browser using DataLab