test_covariance | R Documentation |
This function conducts statistical tests for hypotheses
regarding covariance matrices. Users can either select from predefined
hypotheses (e.g., equal covariance, equal trace, etc.) 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).
test_covariance(
X,
nv = NULL,
C = NULL,
Xi = NULL,
hypothesis = NULL,
A = NULL,
method = "MC",
repetitions = 1000
)
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 |
(Optional) A vector indicating group sizes, needed when |
C |
(Optional) A user-defined contrast matrix for testing custom
hypotheses. Must match dimensions with |
Xi |
(Optional) A numeric vector used in combination with |
hypothesis |
A character specifying one of the predefined hypotheses:
If |
A |
Optional scalar or matrix to define the hypothesis value when
|
method |
A character indicating the resampling method:
|
repetitions |
Number of repetitions to use for the resampling method (default: 1000, should be >= 500). |
An object of class CovTest
.
Sattler, P., Bathke, A. C., and Pauly, M. (2022). "Testing hypotheses about covariance matrices in general MANOVA designs." Journal of Statistical Planning and Inference, 219, 134–146. doi:10.1016/j.jspi.2021.12.001
# Load the data
data("EEGwide", package = "MANOVA.RM")
vars <- colnames(EEGwide)[1:6]
X <- t(EEGwide[EEGwide$sex == "M" & EEGwide$diagnosis == "AD",vars])
# Testing the trace
C <- matrix(c(1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,1),
nrow = 1, ncol = 21)
Xi <- 2
set.seed(31415)
test_covariance(X = X, nv = NULL, C = C, Xi = Xi, method = "BT",
repetitions = 1000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.