for the two factors, for demonstration purposes, we will test the two main factors and
their interaction, each time using the appropriate terms as covariables. Using
Helmert contrasts instead of factors allows an explicit control of all the terms of
the model specification. Note that coding the factors with binary variables would not
make the coding variables orthogonal among the groups (factors and interaction). At
the end of this section, however, we show how to compute the whole permutational
MANOVA in one single command by means of the function adonis2().
The condition of homogeneity of the variance-covariance matrices still
applies even with this permutational approach. It can be tested with function
betadisper() of package vegan which applies the Anderson (2006) testing
method. It is possible to test the homogeneity of variances with respect to each
factor separately. However, there is a risk in the case of crossed designs. When an
interaction exists between the two factors, then the hypothesis of no heterogeneity of
variances with respect to one factor may be rejected because the within-group
dispersions differ due to the varying effect of the levels of the other factor. To
avoid this, one can create an artificial factor crossing the two real ones, i.e., defining
the cell-by-cell attribution of the data. The test becomes a test of homogeneity of
within-cell dispersions.
# Creation of a factor 'elevation' (3 levels, 9 sites each)
ele.fac <- gl(3, 9, labels = c("high", "mid", "low"))
# Creation of a factor mimicking 'pH'
pH.fac
1, 1, 2, 3, 2, 1, 2, 3, 2, 1, 1, 3, 3))
# Is the two-way factorial design balanced?
table(ele.fac, pH.fac)
# Creation of Helmert contrasts for the factors and the interaction
ele.pH.helm
contrasts = list(ele.fac = "contr.helmert",
pH.fac = "contr.helmert"))[, -1]
ele.pH.helm
We removed the first column of the matrix of Helmert contrasts (…[,-1]) because
it contains a trivial column of 1 (intercept).
Examine the matrix of contrasts. Which columns represent ele.fac? pH.fac? The
interaction?
6.3 Redundancy Analysis (RDA)
239
their interaction, each time using the appropriate terms as covariables. Using
Helmert contrasts instead of factors allows an explicit control of all the terms of
the model specification. Note that coding the factors with binary variables would not
make the coding variables orthogonal among the groups (factors and interaction). At
the end of this section, however, we show how to compute the whole permutational
MANOVA in one single command by means of the function adonis2().
The condition of homogeneity of the variance-covariance matrices still
applies even with this permutational approach. It can be tested with function
betadisper() of package vegan which applies the Anderson (2006) testing
method. It is possible to test the homogeneity of variances with respect to each
factor separately. However, there is a risk in the case of crossed designs. When an
interaction exists between the two factors, then the hypothesis of no heterogeneity of
variances with respect to one factor may be rejected because the within-group
dispersions differ due to the varying effect of the levels of the other factor. To
avoid this, one can create an artificial factor crossing the two real ones, i.e., defining
the cell-by-cell attribution of the data. The test becomes a test of homogeneity of
within-cell dispersions.
# Creation of a factor 'elevation' (3 levels, 9 sites each)
ele.fac <- gl(3, 9, labels = c("high", "mid", "low"))
# Creation of a factor mimicking 'pH'
pH.fac
# Is the two-way factorial design balanced?
table(ele.fac, pH.fac)
# Creation of Helmert contrasts for the factors and the interaction
ele.pH.helm
pH.fac = "contr.helmert"))[, -1]
ele.pH.helm
We removed the first column of the matrix of Helmert contrasts (…[,-1]) because
it contains a trivial column of 1 (intercept).
Examine the matrix of contrasts. Which columns represent ele.fac? pH.fac? The
interaction?
6.3 Redundancy Analysis (RDA)
239
