View source: R/john_nagao_tests.R
john.nagao.statistic | R Documentation |
This function computes the test statistic for testing equality of covariance matrices as described by John (1972) and Nagao (1973)
john.nagao.statistic(x, test = "identity")
x |
data matrix with rows representing samples and columns representing variables |
test |
The type of test being performed - "identity"(default) or "sphericity". If |
A list with two values
The test statistic value
The p-value
S. John. The Distribution of a Statistic Used for Testing Sphericity of Normal Distributions. Biometrika, 59(1):169–173, 1972. H. Nagao. On some test criteria for covariance matrix. The Annals of Statistics, 1(4):700–709, 1973.
library(mvtnorm)
# Nagao's test for identity
x = rmvnorm(n = 20, mean = numeric(100), sigma = diag(100))
john.nagao.statistic(x, test = "identity")
# John's test for sphericity
y = rmvnorm(n = 10, mean = runif(100, 1, 3), sigma = diag(rgamma(100, 10, 3)))
john.nagao.statistic(y, test = "sphericity")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.