Log-likelihood ratio test for equality of one covariance matrix {mvhtests} | R Documentation |
Log-likelihood ratio test for equality of one covariance matrix
Description
Log-likelihood ratio test for equality of one covariance matrix.
Usage
equal.cov(x, Sigma, a = 0.05)
Arguments
x |
A matrix containing Euclidean data. |
Sigma |
The hypothesis covariance matrix. |
a |
The significance level, set to 0.05 by default. |
Details
The hypothesis test is that the the sample covariance is equal to some specified covariance matrix: H_0:\pmb{\Sigma}=\pmb{\Sigma}_0
, with \pmb{\mu}
unknown. The algorithm for this test is taken from Mardia, Bibby and Kent (1979, pg. 126-127).
The test is based upon the log-likelihood ratio test. The form of the test is
-2\log{\lambda}=n \text{tr}\left\lbrace \pmb{\Sigma}_0^{-1}{\bf S}\right\rbrace-n\log{\left|\pmb{\Sigma}_0^{-1}{\bf S} \right|}-np,
where n
is the sample size, \pmb{\Sigma}_0
is the specified covariance matrix under the null hypothesis, {\bf S}
is the sample covariance matrix and p
is the dimensionality of the data (or the number of variables). Let \alpha
and g
denote the arithmetic mean and the geometric mean respectively of the eigenvalues of \pmb{\Sigma}_0^{-1}{\bf S}
, so that tr\left\lbrace \pmb{\Sigma}_0^{-1}{\bf S}\right\rbrace=p\alpha
and
\left|\pmb{\Sigma}_0^{-1}{\bf S} \right|=g^p
, then the test statistic becomes
-2\log{\lambda}=np\left(\alpha-log{(g)}-1 \right).
The degrees of freedom of the \chi^2
distribution are \frac{1}{2}p\left(p+1\right)
.
Value
A vector with the the test statistic, the p-value, the degrees of freedom and the critical value of the test.
Author(s)
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
Mardia K.V., Kent J.T. and Bibby J.M. (1979). Multivariate Analysis. London: Academic Press.
See Also
Examples
x <- as.matrix( iris[, 1:4] )
s <- cov(x) * 1.5
equal.cov(x, s)