Skip to contents

Test whether a set of multivariate normal random vectors are independent. The null hypothesis is "H0: The random vectors are independent of each other".

Usage

indTest.multi(data, subdim = FALSE, alpha = 0.05, verbose = TRUE)

Arguments

data

The data matrix which is a matrix or data frame. Each column represents a random variable.

subdim

The dimensions of submatrices. The default is FALSE, which means the independence of all components of the random vector will be tested.

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.

SampMean

The sample mean.

SampA

The sample deviation.

SampAii

The sample deviation of submatrices.

Df

The degree of freedom.

b

The Modified factor of the statistic.

References

Huixuan, Gao. Applied Multivariate Statistical Analysis. Peking University Press, 2005: pp.92-94.

Author

Xifeng Zhang

Examples

data(iris)
chart <- iris[, 1:4]
# carry out the test
test1 <- indTest.multi(chart)
test2 <- indTest.multi(chart, subdim = c(2, 1, 1))
test3 <- indTest.multi(chart, verbose = FALSE)
#> H0: The random vectors are independent of each other
# get the elements
test1$Stat
#>                          Value p.value  Critical.Value
#> V                 8.109611e-03                        
#> Likelihood Ratio 1.496239e-157                        
#> Chi2              7.069592e+02       0 12.591587243744
test1$SampMean
#> Sepal.Length  Sepal.Width Petal.Length  Petal.Width 
#>       5.8433       3.0573       3.7580       1.1993 
test2$SampAii
#> [[1]]
#>              Sepal.Length Sepal.Width
#> Sepal.Length   102.168333   -6.322667
#> Sepal.Width     -6.322667   28.306933
#> 
#> [[2]]
#>          [,1]
#> [1,] 464.3254
#> 
#> [[3]]
#>          [,1]
#> [1,] 86.56993
#>