Multivariate analysis of variance (James test) {mvhtests} | R Documentation |
Multivariate analysis of variance (James test)
Description
Multivariate analysis of variance without assuming equality of the covariance matrices.
Usage
maovjames(x, ina, a = 0.05)
Arguments
x |
A matrix containing Euclidean data. |
ina |
A numerical or factor variable indicating the groups of the data. |
a |
The significance level, set to 0.005 by default. |
Details
James (1954) also proposed an alternative to MANOVA when the covariance matrices are not assumed equal. The test statistic for k
samples is
J=\sum_{i=1}^k\left(\bar{{\bf x}}_i-\bar{{\bf X}}\right)^T{\bf W}_i\left(\bar{{\bf x}}_i-\bar{{\bf X}}\right),
where \bar{{\bf x}}_i
and n_i
are the sample mean vector and sample size of the i
-th sample respectively and {\bf W}_i=\left(\frac{{\bf S}_i}{n_i}\right)^{-1}
, where {\bf S}_i
is the covariance matrix of the i
-sample mean vector and \bar{{\bf X}}
is the estimate of the common mean \bar{{\bf X}}=\left(\sum_{i=1}^k{\bf W}_i\right)^{-1}\sum_{i=1}^k{\bf W}_i\bar{{\bf x}}_i
.
Normally one would compare the test statistic with a \chi^2_{r,1-\alpha}
, where r=p\left(k-1\right)
are the degrees of freedom with k
denoting the number of groups and p
the dimensionality of the data. There are r
constraints (how many univariate means must be equal, so that the null hypothesis, that all the mean vectors are equal, holds true), that is where these degrees of freedom come from. James (1954) compared the test statistic with a corrected \chi^2
distribution instead. Let
A
and B
be
A= 1+\frac{1}{2r}\sum_{i=1}^k\frac{\left[\text{tr}\left({\bf I}_p-{\bf W}^{-1}{\bf W}_i\right)\right]^2}{n_i-1}
and B= \frac{1}{r\left(r+2\right)}\sum_{i=1}^k\left\lbrace\frac{\text{tr}\left[\left({\bf I}_p-{\bf W}^{-1}{\bf W}_i\right)^2\right]}{n_i-1}+\frac{\left[\text{tr}\left({\bf I}_p-{\bf W}^{-1}{\bf W}_i\right)\right]^2}{2\left(n_i-1\right)}\right\rbrace
.
The corrected quantile of the \chi^2
distribution is given as before by
2h\left(\alpha\right)=\chi^2\left(A+B\chi^2\right)
.
Value
A vector with the next 4 elements:
test |
The test statistic. |
correction |
The value of the correction factor. |
corr.critical |
The corrected critical value of the chi-square distribution. |
p-value |
The p-value of the corrected test statistic. |
Author(s)
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
James G.S. (1954). Tests of Linear Hypotheses in Univariate and Multivariate Analysis when the Ratios of the Population Variances are Unknown. Biometrika, 41(1/2): 19–43.
See Also
Examples
maov( as.matrix(iris[,1:4]), iris[,5] )
maovjames( as.matrix(iris[,1:4]), iris[,5] )