Skip to contents

boxM performs the Box's (1949) M-test for homogeneity of covariance matrices obtained from multivariate normal data according to one or more classification factors. The test compares the product of the log determinants of the separate covariance matrices to the log determinant of the pooled covariance matrix, analogous to a likelihood ratio test. The test statistic uses a chi-square approximation. Uses permutations to estimate the degrees of freedom under the null

Usage

boxM_permute(
  Y,
  group,
  nperm = 200,
  method = c("pearson", "kendall", "spearman")
)

Arguments

Y

response variable matrix

group

a factor defining groups, or a continuous variable, number of entries must equal nrow(Y)

nperm

number of permutations of group variable used to estimate degrees of freedom under the null

method

Specify type of correlation: "pearson", "kendall", "spearman"

Value

list of p.value, test statistic, and df.approx estimated by permutation

See also

heplots::boxM

Examples

data(iris)

boxM_permute(iris[, 1:4], iris[, "Species"])
#> $p.value
#> [1] 3.391204e-09
#> 
#> $statistic
#> NULL
#> 
#> $df.approx
#> [1] 16.26312
#> 
#> $stat_logdet
#> [1] NA
#>