Learn R Programming

TestIndVars (version 0.1.0)

schottTest: Schott's Test for testing independency

Description

Performs Schott's test for the correlation matrix to assess if the correlation matrix is significantly different from an identity matrix.

Usage

schottTest(X, alpha = 0.05)

Value

A data frame containing the test statistic, alpha value, p-value, and test result.

Arguments

X

A numeric matrix or data frame containing the variables.

alpha

The significance level for the test (default is 0.05).

References

Schott, J. R. (2005). Testing for complete independence in high dimensions, Biometrika, 92(4), 951–956.

Examples

Run this code
library(MASS)

n = 50 # Sample Size
p = 5
rho = 0.1
# Building a Covariance structure with Autoregressive structure
cov_mat <- covMatAR(p = p, rho = rho)
# Simulated data
data <- mvrnorm(n = n, mu = rep(0,p), Sigma = cov_mat)
# Performing the test
schottTest(data)

# Building a Covariance structure with Compound Symmetry structure
cov_mat <- covMatCS(p = p, rho = rho)
# Simulated data
data <- mvrnorm(n = n, mu = rep(0,p), Sigma = cov_mat)
# Performing the test
schottTest(data)

# Building a Covariance structure with Circular structure
cov_mat <- covMatC(p = p, rho = rho)
# Simulated data
data <- mvrnorm(n = n, mu = rep(0,p), Sigma = cov_mat)
# Performing the test
schottTest(data)


Run the code above in your browser using DataLab