Given univariate samples \(X_1~,\ldots,~X_k\), it tests $$H_0 : \Sigma_1 = \cdots \Sigma_k\quad vs\quad H_1 : \textrm{at least one equality does not hold}$$ using the procedure by Schott (2007).
covk.2007Schott(dlist)
a list of length \(k\) where each element is a sample matrix of same dimension.
a (list) object of S3
class htest
containing:
a test statistic.
\(p\)-value under \(H_0\).
alternative hypothesis.
name of the test.
name(s) of provided sample data.
Schott JR (2007). “A test for the equality of covariance matrices when the dimension is large relative to the sample sizes.” Computational Statistics & Data Analysis, 51(12), 6535--6542. ISSN 01679473.
## CRAN-purpose small example
tinylist = list()
for (i in 1:3){ # consider 3-sample case
tinylist[[i]] = matrix(rnorm(10*3),ncol=3)
}
covk.2007Schott(tinylist) # run the test
#>
#> Test for Homogeneity of Covariances by Schott (2007)
#>
#> data: tinylist
#> statistic = -0.84481, p-value = 0.8009
#> alternative hypothesis: at least one of equalities does not hold.
#>
# \donttest{
## test when k=4 samples with (n,p) = (100,20)
## empirical Type 1 error
niter = 1234
counter = rep(0,niter) # record p-values
for (i in 1:niter){
mylist = list()
for (j in 1:4){
mylist[[j]] = matrix(rnorm(100*20),ncol=20)
}
counter[i] = ifelse(covk.2007Schott(mylist)$p.value < 0.05, 1, 0)
}
## print the result
cat(paste("\n* Example for 'covk.2007Schott'\n","*\n",
"* number of rejections : ", sum(counter),"\n",
"* total number of trials : ", niter,"\n",
"* empirical Type 1 error : ",round(sum(counter/niter),5),"\n",sep=""))
#>
#> * Example for 'covk.2007Schott'
#> *
#> * number of rejections : 48
#> * total number of trials : 1234
#> * empirical Type 1 error : 0.0389
# }