# Check property 1 of Helmert contrasts: all variables sum to 0
apply(ele.pH.helm, 2, sum)
# Check property 2 of Helmert contrasts: their crossproducts
# must be 0 within and between groups (factors and interaction)
crossprod(ele.pH.helm)
# Verify multivariate homogeneity of within-group covariance
# matrices using the betadisper() function (vegan package)
# implementing Marti Anderson's testing method (Anderson 2006)
cell.fac <- gl(9, 3)
spe.hel.d1 <- dist(spe.hel[1:27, ])
# Test of homogeneity of within-cell dispersions
(spe.hel.cell.MHV <- betadisper(spe.hel.d1, cell.fac))
anova(spe.hel.cell.MHV)
# Parametric test, not recommended
permutest(spe.hel.cell.MHV)
# Alternatively, test homogeneity of dispersions within each
# factor.
# These tests ore more robust with this small example because
# there are now 9 observations per group instead of 3.
# Factor "elevation"
(spe.hel.ele.MHV <- betadisper(spe.hel.d1, ele.fac))
permutest(spe.hel.ele.MHV) # Permutation test
# Factor "pH"
(spe.hel.pH.MHV <- betadisper(spe.hel.d1, pH.fac))
anova(spe.hel.pH.MHV)
permutest(spe.hel.pH.MHV) # Permutation test
The within-group dispersions are homogeneous. We can proceed with anova.
# Test the interaction first. Factors ele and pH (columns 1-4)
# are assembled to form the matrix of covariables for the test.
interaction.rda
ele.pH.helm[, 5:8],
ele.pH.helm[, 1:4])
anova(interaction.rda, permutations = how(nperm = 999))
240
6 Canonical Ordination
apply(ele.pH.helm, 2, sum)
# Check property 2 of Helmert contrasts: their crossproducts
# must be 0 within and between groups (factors and interaction)
crossprod(ele.pH.helm)
# Verify multivariate homogeneity of within-group covariance
# matrices using the betadisper() function (vegan package)
# implementing Marti Anderson's testing method (Anderson 2006)
cell.fac <- gl(9, 3)
spe.hel.d1 <- dist(spe.hel[1:27, ])
# Test of homogeneity of within-cell dispersions
(spe.hel.cell.MHV <- betadisper(spe.hel.d1, cell.fac))
anova(spe.hel.cell.MHV)
# Parametric test, not recommended
permutest(spe.hel.cell.MHV)
# Alternatively, test homogeneity of dispersions within each
# factor.
# These tests ore more robust with this small example because
# there are now 9 observations per group instead of 3.
# Factor "elevation"
(spe.hel.ele.MHV <- betadisper(spe.hel.d1, ele.fac))
permutest(spe.hel.ele.MHV) # Permutation test
# Factor "pH"
(spe.hel.pH.MHV <- betadisper(spe.hel.d1, pH.fac))
anova(spe.hel.pH.MHV)
permutest(spe.hel.pH.MHV) # Permutation test
The within-group dispersions are homogeneous. We can proceed with anova.
# Test the interaction first. Factors ele and pH (columns 1-4)
# are assembled to form the matrix of covariables for the test.
interaction.rda
ele.pH.helm[, 1:4])
anova(interaction.rda, permutations = how(nperm = 999))
240
6 Canonical Ordination
