test_correlation: Test for Correlation Matrices

View source: R/correlation.R

test_correlationR Documentation

Test for Correlation Matrices

Description

This function conducts statistical tests for hypotheses regarding correlation matrices. Users can either select from predefined hypotheses or provide their own contrast matrix C and vector Xi for custom hypotheses. It supports both bootstrap and Monte Carlo resampling methods to obtain the p-value of the ANOVA-type statistic (ATS).

Usage

test_correlation(
  X,
  nv = NULL,
  C = NULL,
  Xi = NULL,
  hypothesis = NULL,
  method = "BT",
  repetitions = 1000
)

Arguments

X

A list or a matrix containing the observation vectors. If a list, each entry is a group, with observations as columns. If a matrix, all groups are combined, and nv must be used to indicate group sizes.

nv

(Optional) A vector indicating group sizes, needed when X is a combined matrix or for multiple groups.

C

(Optional) A user-defined contrast matrix for testing custom hypotheses. Must match dimensions with Xi.

Xi

(Optional) A numeric vector used in combination with C to specify a custom hypothesis.

hypothesis

A character string describing the null hypothesis. Must be one of "equal-correlated" or "uncorrelated". If supplied, C and Xi are ignored.

method

A character indicating the resampling method: "BT" (Bootstrap) or "MC" (Monte Carlo).

repetitions

Number of repetitions to use for the resampling method (default: 1000, should be >= 500).

Value

An object of class "CovTest".

References

Sattler, P. and Pauly, M. (2024). Testing hypotheses about correlation matrices in general MANOVA designs. TEST, 33(2), 496–516. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11749-023-00906-6")}

Examples

# Example with one group:
set.seed(31415)
X <- matrix(rnorm(5 * 100), nrow = 5)
test_correlation(X, hypothesis = "uncorrelated",
                  method = "BT", repetitions = 100)


CovCorTest documentation built on June 8, 2025, 11:50 a.m.