test_covariance_structure: Test for structure of data's covariance matrix

View source: R/covariance.R

test_covariance_structureR Documentation

Test for structure of data's covariance matrix

Description

This function conducts the test for the covariance matrix of data regarding structures. Depending on the chosen method a bootstrap or Monte-Carlo-technique is used to calculate p-value of the Anova-type-statistic(ATS) based on a specified number of runs.

Usage

test_covariance_structure(X, structure, method = "BT", repetitions = 1000)

Arguments

X

a matrix containing the observation vectors as columns (one group only)

structure

a character specifying the structure regarding the covariance matrix should be checked. Options are "autoregressive" ("ar"), "FO-autoregressive" ("FO-ar"), "diagonal" ("diag"), "sphericity" ("spher"), "compoundsymmetry" ("cs") and "toeplitz" ("toep").

method

a character, to chose whether bootstrap("BT") or Monte-Carlo-technique("MC") is used, while bootstrap is the predefined method.

repetitions

a scalar, indicate the number of runs for the chosen method. The predefined value is 1,000, and the number should not be below 500.

Value

an object of the class CovTest

References

Sattler, P. and Dobler, D. (2025). Testing for patterns and structures in covariance and correlation matrices. arXiv preprint https://arxiv.org/abs/2310.11799

Examples

# Load the data
data("EEGwide", package = "MANOVA.RM")

# Select only the males with the diagnosis AD
X <- as.matrix(EEGwide[EEGwide$sex == "W" & EEGwide$diagnosis == "AD",
                          c("brainrate_temporal", "brainrate_frontal",
                          "brainrate_central","complexity_temporal",
                          "complexity_frontal", "complexity_central")])

test_covariance_structure(X = X, structure = "diagonal", method = "MC")


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