fourthcorner  R Documentation 
These functions allow to compute the fourthcorner statistic for abundance or presenceabsence data. The fourthcorner 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 class '4thcorner' print(x, varQ = 1:length(x$varnames.Q), varR = 1:length(x$varnames.R), stat = c("D", "D2"), ...) ## S3 method for class '4thcorner' summary(object,...) ## S3 method for class '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"), ...)
tabR 
a dataframe containing the measurements (numeric values or factors) of m environmental variables (columns) for the n sites (rows). 
tabL 
a dataframe containing the abundances of p species (columns) at n sites (rows). 
tabQ 
a dataframe containing numeric values or factors describing s species traits (columns) for the p species (rows). 
modeltype 
an integer (16) indicating the permutation model used in the testing procedure (see details). 
nrepet 
the number of permutations 
tr01 
a logical indicating if data in 
object 
an object of the class 4thcorner 
x 
an object of the class 4thcorner 
varR 
a vector containing indices for variables in 
varQ 
a vector containing indices for variables in 
type 
results are represented by a table or on a biplot (see x.rlq) 
alpha 
a value of significance level 
p.adjust.method.G 
a string indicating a method for multiple
adjustment used for output tabG, see 
p.adjust.method.D 
a string indicating a method for multiple
adjustment used for output tabD/tabD2, see 
p.adjust.D 
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) 
stat 
a character to specify if results should be plotted for cells (D and D2) or variables (G) 
xax 
an integer indicating which rlq axis should be plotted on the xaxis 
yax 
an integer indicating which rlq axis should be plotted on the yaxis 
x.rlq 
an object created by the 
col 
a vector of length 4 containing four colors used for the
graphical representations. The first is used to represent nonsignificant
associations, the second positive significant, the third negative
significant. For the 'biplot' method and objects created by the

xtest 
an object created by the 
typetest 
a string indicating which tests should be performed 
... 
further arguments passed to or from other methods 
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 PseudoF 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.
The fourthcorner
function returns a a list where:
tabD
is a krandtest
object giving the results of tests
for cells of the fourthcorner (homogeneity for quant./qual.).
tabD2
is a krandtest
object giving the results of tests
for cells of the fourthcorner (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).
Stéphane Dray stephane.dray@univlyon1.fr
Doledec, S., Chessel, D., ter Braak, C.J.F. and Champely, S. (1996) Matching species traits to environmental variables: a new threetable ordination method. Environmental and Ecological Statistics, 3, 143–166.
Legendre, P., R. Galzin, and M. L. HarmelinVivien. (1997) Relating behavior to habitat: solutions to the fourthcorner problem. Ecology, 78, 547–562.
Dray, S. and Legendre, P. (2008) Testing the species traitsenvironment relationships: the fourthcorner problem revisited. Ecology, 89, 3400–3412.
ter Braak, C., Cormont, A., and Dray, S. (2012) Improved testing of species traitsenvironment relationships in the fourth corner problem. Ecology, 93, 1525–1526.
Dray, S., Choler, P., Doledec, S., PeresNeto, P.R., Thuiller, W., Pavoine, S. and ter Braak, C.J.F (2014) Combining the fourthcorner and the RLQ methods for assessing trait responses to environmental variation. Ecology, 95, 14–21. doi:10.1890/130196.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 Pvalues (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 Pvalues 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.