These functions allow to compute the fourth-corner statistic for abundance or presence-absence data. The fourth-corner statistic has been developed by Legendre et al (1997) and extended in Dray and Legendre (2008). The statistic measures the link between three tables: a table L (n x p) containing the abundances of p species at n sites, a second table R (n x m) containing the measurements of m environmental variables for the n sites, and a third table Q (p x s) describing s species traits for the p species.
fourthcorner(tabR, tabL, tabQ, modeltype = 6, nrepet = 999, tr01 =
FALSE, p.adjust.method.G = p.adjust.methods, p.adjust.method.D =
p.adjust.methods, p.adjust.D = c("global", "levels"), ...)
fourthcorner2(tabR, tabL, tabQ, modeltype = 6, nrepet = 999, tr01 =
FALSE, p.adjust.method.G = p.adjust.methods, ...)
# S3 method for 4thcorner
print(x, varQ = 1:length(x$varnames.Q), varR =
1:length(x$varnames.R), stat = c("D", "D2"), ...)
# S3 method for 4thcorner
summary(object,...)
# S3 method for 4thcorner
plot(x, stat = c("D", "D2", "G"), type = c("table",
"biplot"), xax = 1, yax = 2, x.rlq = NULL, alpha = 0.05, col =
c("lightgrey", "red", "deepskyblue", "purple"), ...)
fourthcorner.rlq(xtest, nrepet = 999, modeltype = 6, typetest =
c("axes", "Q.axes", "R.axes"), p.adjust.method.G = p.adjust.methods,
p.adjust.method.D = p.adjust.methods, p.adjust.D = c("global",
"levels"), ...)
The fourthcorner
function returns a a list where:
tabD
is a krandtest
object giving the results of tests
for cells of the fourth-corner (homogeneity for quant./qual.).
tabD2
is a krandtest
object giving the results of tests
for cells of the fourth-corner (Pearson r for quant./qual.).
tabG
is a krandtest
object giving the results of tests
for variables (Pearson's Chi2 for qual./qual.).
The fourthcorner2
function returns a list where:
tabG
is a krandtest
object giving the results of tests for
variables.
trRLQ
is a krandtest
object giving the results of tests for
the multivariate statistic (i.e. equivalent to randtest.rlq
function).
a dataframe containing the measurements (numeric values or factors) of m environmental variables (columns) for the n sites (rows).
a dataframe containing the abundances of p species (columns) at n sites (rows).
a dataframe containing numeric values or factors describing s species traits (columns) for the p species (rows).
an integer (1-6) indicating the permutation model used in the testing procedure (see details).
the number of permutations
a logical indicating if data in tabL
must be transformed to presence-absence data (FALSE by default)
an object of the class 4thcorner
an object of the class 4thcorner
a vector containing indices for variables in tabR
a vector containing indices for variables in tabQ
results are represented by a table or on a biplot (see x.rlq)
a value of significance level
a string indicating a method for multiple
adjustment used for output tabG, see p.adjust.methods
for possible choices
a string indicating a method for multiple
adjustment used for output tabD/tabD2, see p.adjust.methods
for possible choices
a string indicating if multiple adjustment for tabD/tabD2 should be done globally or only between levels of a factor ("levels", as in the original paper of Legendre et al. 1997)
a character to specify if results should be plotted for cells (D and D2) or variables (G)
an integer indicating which rlq axis should be plotted on the x-axis
an integer indicating which rlq axis should be plotted on the y-axis
an object created by the rlq
function. Used to
represent results on a biplot (type should be "biplot" and object
created by the fourthcorner
functions)
a vector of length 4 containing four colors used for the
graphical representations. The first is used to represent non-significant
associations, the second positive significant, the third negative
significant. For the 'biplot' method and objects created by the
fourthcorner.rlq
function, the second corresponds to variables
significantly linked
to the x-axis, the third for the y-axis and the fourth for both axes
an object created by the rlq
function
a string indicating which tests should be performed
further arguments passed to or from other methods
Stéphane Dray stephane.dray@univ-lyon1.fr
For the fourthcorner
function, the link is measured by a Pearson correlation coefficient for two quantitative variables (trait and environmental variable), by a Pearson Chi2 and G statistic for two qualitative variables and by a Pseudo-F and Pearson r for one quantitative variable and one qualitative variable. The fourthcorner2 function offers a multivariate statistic (equal to the sum of eigenvalues of RLQ analysis) and measures the link between two variables by a square correlation coefficient (quant/quant), a Chi2/sum(L) (qual/qual) and a correlation ratio (quant/qual). The significance is tested by a permutation procedure. Different models are available:
model 1 (modeltype
=1): Permute values for each species independently (i.e., permute within each column of table L)
model 2 (modeltype
=2): Permute values of sites (i.e., permute entire rows of table L)
model 3 (modeltype
=3): Permute values for each site independently (i.e., permute within each row of table L)
model 4 (modeltype
=4): Permute values of species (i.e., permute entire columns of table L)
model 5 (modeltype
=5): Permute values of species and after
(or before) permute values of sites (i.e., permute entire columns and
after (or before) entire rows of table L)
model 6 (modeltype
=6): combination of the outputs of models
2 and 4. Dray and Legendre (2008) and ter Braak et al. (20012) showed
that all models (except model 6) have inflated type I error.
Note that the model 5 is strictly equivalent to permuting simultaneously the rows of tables R and Q, as proposed by Doledec et al. (1996).
The function summary
returns results for variables (G). The
function print
returns results for cells (D and D2). In the case
of qualitative variables, Holm's corrected pvalues are also provided.
The function plot
produces a graphical representation of the
results (white for non significant, light grey for negative significant
and dark grey for positive significant relationships). Results can be
plotted for variables (G) or for cells (D and D2). In the case of
qualitative / quantitative association, homogeneity (D) or correlation
(D2) are plotted.
Doledec, S., Chessel, D., ter Braak, C.J.F. and Champely, S. (1996) Matching species traits to environmental variables: a new three-table ordination method. Environmental and Ecological Statistics, 3, 143--166.
Legendre, P., R. Galzin, and M. L. Harmelin-Vivien. (1997) Relating behavior to habitat: solutions to the fourth-corner problem. Ecology, 78, 547--562.
Dray, S. and Legendre, P. (2008) Testing the species traits-environment relationships: the fourth-corner problem revisited. Ecology, 89, 3400--3412.
ter Braak, C., Cormont, A., and Dray, S. (2012) Improved testing of species traits-environment relationships in the fourth corner problem. Ecology, 93, 1525--1526.
Dray, S., Choler, P., Doledec, S., Peres-Neto, P.R., Thuiller, W., Pavoine, S. and ter Braak, C.J.F (2014) Combining the fourth-corner and the RLQ methods for assessing trait responses to environmental variation. Ecology, 95, 14--21. doi:10.1890/13-0196.1
rlq
, combine.4thcorner
, p.adjust.methods
data(aviurba)
## Version using the sequential test (ter Braak et al 2012)
## as recommended in Dray et al (2013),
## using Holm correction of P-values (only 99 permutations here)
four.comb.default <- fourthcorner(aviurba$mil,aviurba$fau,aviurba$traits,nrepet=99)
summary(four.comb.default)
plot(four.comb.default, stat = "G")
## using fdr correction of P-values
four.comb.fdr <- fourthcorner(aviurba$mil, aviurba$fau, aviurba$traits,
nrepet = 99, p.adjust.method.G = 'fdr', p.adjust.method.D = 'fdr')
summary(four.comb.fdr)
plot(four.comb.fdr, stat = "G")
## Explicit procedure to combine the results of two models
## proposed in Dray and Legendre (2008);the above does this implicitly
four2 <- fourthcorner(aviurba$mil,aviurba$fau,aviurba$traits,nrepet=99,modeltype=2)
four4 <- fourthcorner(aviurba$mil,aviurba$fau,aviurba$traits,nrepet=99,modeltype=4)
four.comb <- combine.4thcorner(four2, four4)
summary(four.comb)
plot(four.comb, stat = "G")
Run the code above in your browser using DataLab