MANOVA example
As an example, we can use the Summit Cr. data, testing the hypothesis that the mean values of some of the hydraulic geometry variables differ from reach to reach (or from HU to HU). First, we examine some univariate analyses of variance with a single grouping variable (Reach), or "one-way" analysis of variance.
# ANOVA and MANOVA
library(lattice)
attach(sumcr)
# univariate analysis of variance
# set variable to analyze
tempvar <- WidthWS
varname <- "WidthWS"
# plot distributions by groups
histogram(~ tempvar | Reach, nint=20, aspect=1/3, xlab=varname)
# test for homogeneity of group variances
tapply(tempvar, Reach, var)
bartlett.test(tempvar ~ Reach)
# analysis of variance
sumcr.aov1 <- aov(tempvar ~ Reach)
summary(sumcr.aov1)
Next, examine the hypothesis that the vector of means of the geomorphic variables is similar among reaches using MANOVA:
# MANOVA
Y <- cbind(DepthWS, WidthWS, WidthBF, HUAreaWS, HUAreaBF, wsgrad)
sumcr.mva1 <- manova(Y ~ Reach)
summary.aov(sumcr.mva1)
summary(sumcr.mva1, test="Wilks")