Learn R Programming

CovCorTest (version 1.1.0)

get_hypothesis: Construct hypothesis matrix and vector from linear covariance model structure

Description

Computes a hypothesis matrix C and hypothesis vector zeta based on a given parameter vector v0 and a matrix V representing the model structure (e.g., vectorised components of a linear covariance structure model).

Usage

get_hypothesis(v0, V)

Value

A list with two elements:

Hypothesenmatrix

A numeric matrix C such that the hypothesis can be written as C %*% theta = zeta

Hypothesenvector

The numeric vector zeta, computed as C %*% v0

Arguments

v0

A numeric vector of length p (number of parameters). Represents the parameter vector at which the hypothesis is to be evaluated.

V

A numeric matrix of size p x q, representing the structured design or constraint matrix for the model. Here, the vectorised matrices from the linear covariance structure model build the columns of V.

Details

The function extends V to full rank using get_extended_matrix, constructs a contrast matrix E for the complement of the model-implied space, and computes the corresponding hypothesis matrix C.

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

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

X <- t(as.matrix(EEGwide[EEGwide$sex == "W" & EEGwide$diagnosis == "AD",
                         c("brainrate_temporal", "brainrate_frontal","brainrate_central",
                            "complexity_temporal","complexity_frontal", "complexity_central")]))
v0 <- rep(0,21)
v_auxiliary <- c(1, rep(0,5), 1, rep(0,4), 1, rep(0,3), 1, rep(0,2), 1, 0, 1)
V <- cbind(v_auxiliary, 1-v_auxiliary)
h <- get_hypothesis(v0,V)
set.seed(123)
test_covariance(X = X,C = h$hypothesis_matrix, Xi = h$hypothesis_vector,
                method = "MC", repetitions = 1000)

Run the code above in your browser using DataLab