There's more...

As it happens with the univariate case, we should also check whether the covariance matrices are the same between the two samples. This obviously requires a more sophisticated test (compared to the univariate test), because we are now working with matrices. There are several possible strategies, although a simple one is to use Box's M test, which can be obtained via the heplots package.

We need to create a combined dataset and a grouping variable to use boxM:

library(heplots) 
class1$group = "1"
class2$group = "2"
combined = rbind(class1,class2)
combined$group = as.factor(combined$group)
boxM(cbind(combined$Math,combined$History,combined$Sociology)~group,data = combined)

The preceding code generate the following output for testing the homogeneity of the covariance matrices. We don't reject the homogeneity assumption

Because the p-value is larger (much larger than 5%), we decide to accept the null hypothesis that the covariance matrices are the same between the two groups.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.195.183