JSlocombe95 - 1 year ago 73

R Question

I need to test the equality of two co variance matrices for my two subsets:

trains[1:5, c(3,6,8,11)] and trains[6:10, c(3,6,8,11)].

Should I be using a boxM test or something similar? Thanks

Answer Source

You can use `compareCov`

from the package `covmat`

.

As an example I will use the `longely`

dataset from the `stats`

package:

```
library(covmat)
(Cl <- cor(longley))
compareCov(Cl, Cl, labels = c("Robust Croux", "Robust"))
```

You can find more examples and details in the package's Vignette.

https://cran.r-project.org/web/packages/covmat/vignettes/CovarianceEstimation.pdf

If you're asking how to select the most appropriate statistical test, then that's more of a question for Cross Validated, like Ben Bolker just commented.