Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fourthcorner

Functions to compute the fourth-corner statistic


Description

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) with 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.

Usage

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"), ...)

Arguments

tabR

a dataframe with the measurements 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 describing s species traits (columns) for the p species (rows).

modeltype

an integer (1-6) indicating the permutation model used in the testing procedure (see details).

nrepet

the number of permutations

tr01

a logical indicating if data in tabL must be transformed to presence-absence data (FALSE by default)

object

an object of the class 4thcorner

x

an object of the class 4thcorner

varR

a vector with indices for variables in tabR

varQ

a vector with indices for variables in tabQ

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.methods for possible choices

p.adjust.method.D

a string indicating a method for multiple adjustment used for output tabD/tabD2, see p.adjust.methods for possible choices

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 x-axis

yax

an integer indicating which rlq axis should be plotted on the y-axis

x.rlq

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)

col

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

xtest

an object created by the rlq function

typetest

a string indicating which tests should be performed

...

further arguments passed to or from other methods

Details

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.

Value

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).

Author(s)

References

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

See Also

Examples

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")

ade4

Analysis of Ecological Data: Exploratory and Euclidean Methods in Environmental Sciences

v1.7-16
GPL (>= 2)
Authors
Stéphane Dray <stephane.dray@univ-lyon1.fr>, Anne-Béatrice Dufour <anne-beatrice.dufour@univ-lyon1.fr>, and Jean Thioulouse <jean.thioulouse@univ-lyon1.fr>, with contributions from Thibaut Jombart, Sandrine Pavoine, Jean R. Lobry, Sébastien Ollier, Daniel Borcard, Pierre Legendre, Stéphanie Bougeard and Aurélie Siberchicot. Based on earlier work by Daniel Chessel.
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.