Skip to contents

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

Usage

covTest.multi(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.

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.88-89.

Author

Xifeng Zhang

Examples

data(iris)
chart <- iris[, 1:4]
species <- iris[, 5]
# carry out the test
test1 <- covTest.multi(chart, species)
test2 <- covTest.multi(chart, species, verbose = FALSE)
#> H0: Sigma1 = Sigma2 = ... = Sigmak, k = 3
# get the elements
test1$Stat
#>                                    Value p.value   Critical.Value
#> Likelihood Ratio            3.180759e-33                         
#> Likelihood Ratio (Adjusted) 1.420627e-32                         
#> M                           1.466632e+02                         
#> Chi2                        1.409430e+02       0 31.4104328442309
test1$SampMeanT
#> Sepal.Length  Sepal.Width Petal.Length  Petal.Width 
#>     5.843333     3.057333     3.758000     1.199333 
test1$sampleSize
#>     setosa versicolor  virginica 
#>         50         50         50