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 kk samples is

J=i=1k(xˉiXˉ)TWi(xˉiXˉ), 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 xˉi\bar{{\bf x}}_i and nin_i are the sample mean vector and sample size of the ii-th sample respectively and Wi=(Sini)1{\bf W}_i=\left(\frac{{\bf S}_i}{n_i}\right)^{-1}, where Si{\bf S}_i is the covariance matrix of the ii-sample mean vector and Xˉ\bar{{\bf X}} is the estimate of the common mean Xˉ=(i=1kWi)1i=1kWixˉi\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 χr,1α2\chi^2_{r,1-\alpha}, where r=p(k1)r=p\left(k-1\right) are the degrees of freedom with kk denoting the number of groups and pp the dimensionality of the data. There are rr 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 χ2\chi^2 distribution instead. Let AA and BB be A=1+12ri=1k[tr(IpW1Wi)]2ni1A= 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=1r(r+2)i=1k{tr[(IpW1Wi)2]ni1+[tr(IpW1Wi)]22(ni1)}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 χ2\chi^2 distribution is given as before by 2h(α)=χ2(A+Bχ2)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

maov, hotel2T2, james

Examples

maov( as.matrix(iris[,1:4]), iris[,5] )
maovjames( as.matrix(iris[,1:4]), iris[,5] )

[Package mvhtests version 1.0 Index]