Skip to contents

Test whether the mean vectors and covariance matrices of multiple multivariate normal populations are all equal simultaneously. Suppose we have k populations, the null hypothesis is "H0: mu1 = mu2 = ... = muk and Sigma1 = Sigma2 = ... = Sigmak".

Usage

meancov.Test(X, label, alpha = 0.05, verbose = TRUE)

Arguments

X

The data matrix which is a matrix or data frame.

label

A vector of group labels.

alpha

The significance level. Default is 0.05.

verbose

A boolean value. Default is TRUE. If TRUE, the null hypothesis will be displayed. If FALSE, the test will be carried out silently.

Value

An object of class "testResult", which is a list with the following elements:

Conclusion

The conclusion of the test.

Stat

A data frame containing the statistics, p value and critical value.

SampMeanT

The sample mean.

SampMeanWithin

The sample mean of each group.

SdTotal

The total sample deviation.

SdWithin

The sample deviation of each group.

SdWithinT

The sample deviation within group.

Df

The degree of freedom.

sampleSize

The sample size of each group.

d

The Modified factor of the statistic.

References

Huixuan, Gao. Applied Multivariate Statistical Analysis. Peking University Press, 2005: pp.90-91.

Author

Xifeng Zhang

Examples

data(iris)
chart <- iris[, 1:4]
species <- iris[, 5]
# carry out the test
test1 <- meancov.Test(chart, species)
test2 <- meancov.Test(chart, species, verbose = FALSE)
#> H0: mu1 = mu2 = ... = muk, Sigma1 = Sigma2 = ... = Sigmak, k = 3
# get the elements
test1$Stat
#>                                     Value p.value   Critical.Value
#> Likelihood Ratio            1.767862e-155                         
#> Likelihood Ratio (Modified) 2.200389e-152                         
#> M                            6.984086e+02                         
#> Chi2                         6.809880e+02       0 41.3371381514274
test1$SampMeanT
#> Sepal.Length  Sepal.Width Petal.Length  Petal.Width 
#>     5.843333     3.057333     3.758000     1.199333