fourthcorner {ade4}R Documentation

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 developped 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 = 1, nrepet = 999, tr01 = FALSE)
fourthcorner2(tabR, tabL, tabQ, modeltype = 1, nrepet = 999, tr01 = FALSE)
## S3 method for class '4thcorner':
print(x, varQ = 1:nrow(x$tabG), varR = 1:ncol(x$tabG),...)
## S3 method for class '4thcorner':
summary(object,...)
## S3 method for class '4thcorner':
plot(x, type=c("D","D2","G"), alpha=0.05,...)
combine.4thcorner(four1,four2)

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 (0-5) 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 a character to specify if results should be plotted for cells (D and D2) or variables (G)
alpha a value of significance level
four1 an object of the class 4thcorner
four2 an object of the class 4thcorner
... further arguments passed to or from other methods

Details

For the fourthcorner function, the link is measured by a Pearson correlation coefficient for two quantitatives 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:

Note that the last model is strictly equivalent to permuting simultaneously the rows of tables R and Q, as proposed by Doledec et al. (1996).

The function plot produces a graphical representation of the results (white for non siginficant, light grey for negative sgnificant and dark grey for positive suignficant 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 function combine.4thcorner combines the outputs of two fourth-corner objects as described in Dray and Legendre (2008). It returns an object of the class 4thcorner. The function simply creates a new 4th.corner object where pvalues are equal to the maximum of pvalues of the two arguments.

Value

For the fourthcorner function, a list where:

tabD, tabDmin, tabDmax, tabDmoy, tabDNEQ, tabDNLT, tabDProb, tabDNperm are dataframes with observed statistic; minimum, maximum, average statistics obtained by the permutation procedure; number of simulated values equal to the observed statistic; number of simulated values less than the observed statistic; P-values; and number of permutations. Results are given for cells of the fourth-corner (homogeneity for quant./qual.).

tabG, tabGmin, tabGmax, tabGmoy, tabGNEQ, tabGNLT, tabGProb, tabGNperm are dataframes with observed statistic; minimum, maximum, average statistics obtained by the permutation procedure; number of simulated values equal to the observed statistic; number of simulated values less than the observed statistic; P-values; and number of permutations. Results are given for variables (Pearson's Chi2 for qual./qual.).

tabD2, tabD2min, tabD2max, tabD2moy, tabD2NEQ, tabD2NLT, tabD2Prob, tabD2Nperm are dataframes with observed statistic; minimum, maximum, average statistics obtained by the permutation procedure; number of simulated values equal to the observed statistic; number of simulated values less than the observed statistic; P-values; and number of permutations. Results are given for cells of the fourth-corner (Pearson r for quant./qual.).

tabG2, tabG2min, tabG2max, tabG2moy, tabG2NEQ, tabG2NLT, tabG2Prob, tabG2Nperm are dataframes with observed statistic; minimum, maximum, average statistics obtained by the permutation procedure; number of simulated values equal to the observed statistic; number of simulated values less than the observed statistic; P-values; and number of permutations. Results are given for variables (G for qual./qual.)

The fourthcorner2 function returns a list where:

tabG, tabGmin, tabGmax, tabGmoy, tabGNEQ, tabGNLT, tabGProb, tabGNperm are dataframes with observed statistic; minimum, maximum, average statistics obtained by the permutation procedure; number of simulated values equal to the observed statistic; number of simulated values less than the observed statistic; P-values; and number of permutations. Results are given for variables. It returns also the list trRLQ with results for the multivariate statistic.

Author(s)

Stephane Dray dray@biomserv.univ-lyon1.fr

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.

See Also

rlq

Examples

data(aviurba)
four1<-fourthcorner(aviurba$mil,aviurba$fau,aviurba$traits,nrepet=99)
print(four1,varR=2,varQ=3)
summary(four1)
plot(four1, type = "G")

## Procedure to combine the results of two models proposed in Dray and Legendre (2008)
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)
plot(four.comb, type = "G")

Worked out examples


> library(ade4)
> ### Name: fourthcorner
> ### Title: Functions to compute the fourth-corner statistic
> ### Aliases: fourthcorner fourthcorner2 print.4thcorner summary.4thcorner
> ###   plot.4thcorner combine.4thcorner
> ### Keywords: multivariate
> 
> ### ** Examples
> 
> data(aviurba)
> four1<-fourthcorner(aviurba$mil,aviurba$fau,aviurba$traits,nrepet=99)
> print(four1,varR=2,varQ=3)
Fourth-corner Statistics
------------------------
------------------------
Permutation method  1  ( 99  permutations)
call:  fourthcorner(tabR = aviurba$mil, tabL = aviurba$fau, tabQ = aviurba$traits,      nrepet = 99) 

breeding  and  small.bui  : 
--------------------------- 
Chi2 =  27.79316 	Prob(Chi2) = 0.01 
N. less than Chi2 obs =  99 	N. equal to Chi2 obs =  1 
Min(Chi2) =  0.1190478 	Max(Chi2) =  27.79316 	Mean(Chi2) =  3.047718

G =  36.98892 	Prob(G) = 0.01 
N. less than G obs =  99 	N. equal to G obs =  1 
Min(G) =  0.1191480 	Max(G) =  36.98892 	Mean(G) =  3.161991 
                                               
         D(ground,yes)=1     D(ground,no)=59   
Min      1                   36                
Max      24                  59                
Mean     15                  45                
                                               
Pr.      0.01                0.01              
Pr. adj. 0.08                0.08              
N.LT     0                   99                
N.EQ     1                   1                 
                                               
                                               
         D(building,yes)=128 D(building,no)=300
Min      84                  289               
Max      139                 344               
Mean     109.13              318.87            
                                               
Pr.      0.04                0.04              
Pr. adj. 0.16                0.16              
N.LT     96                  2                 
N.EQ     2                   2                 
                                               
                                               
         D(scrub,yes)=20     D(scrub,no)=101   
Min      20                  78                
Max      43                  101               
Mean     31.42               89.58             
                                               
Pr.      0.01                0.01              
Pr. adj. 0.08                0.08              
N.LT     0                   99                
N.EQ     1                   1                 
                                               
                                               
         D(foliage,yes)=38   D(foliage,no)=107 
Min      26                  95                
Max      50                  119               
Mean     36.6                108.4             
                                               
Pr.      0.4                 0.4               
Pr. adj. 0.8                 0.8               
N.LT     60                  32                
N.EQ     8                   8                 
                                               
                                               


> summary(four1)
Fourth-corner Statistics
Permutation method  1  ( 99  permutations)
---

  Var. R      Var. Q     Stat. Value      Prob.   
      farms / feed.hab   Chi2  4.36429    0.11    
      farms / feed.strat Chi2  4.29285    0.11    
      farms / breeding   Chi2  3.2343     0.29    
      farms / migratory  Chi2  3.19878    0.08  . 
  small.bui / feed.hab   Chi2  5.57482    0.07  . 
  small.bui / feed.strat Chi2  13.5964    0.01  **
  small.bui / breeding   Chi2  27.7932    0.01  **
  small.bui / migratory  Chi2  0.987997   0.42    
   high.bui / feed.hab   Chi2  3.11706    0.21    
   high.bui / feed.strat Chi2  8.13102    0.03  * 
   high.bui / breeding   Chi2  12.4354    0.01  **
   high.bui / migratory  Chi2  0.629089   0.39    
   industry / feed.hab   Chi2  2.05616    0.35    
   industry / feed.strat Chi2  1.6009     0.44    
   industry / breeding   Chi2  22.2859    0.01  **
   industry / migratory  Chi2  0.987534   0.34    
     fields / feed.hab   Chi2  14.0114    0.02  * 
     fields / feed.strat Chi2  7.89491    0.02  * 
     fields / breeding   Chi2  38.339     0.01  **
     fields / migratory  Chi2  5.39284    0.01  **
  grassland / feed.hab   Chi2  1.27967    0.57    
  grassland / feed.strat Chi2  2.1178     0.36    
  grassland / breeding   Chi2  16.6997    0.02  * 
  grassland / migratory  Chi2  0.0977542  0.79    
    scrubby / feed.hab   Chi2  2.87647    0.22    
    scrubby / feed.strat Chi2  5.17033    0.11    
    scrubby / breeding   Chi2  7.93878    0.06  . 
    scrubby / migratory  Chi2  3.40197    0.12    
  deciduous / feed.hab   Chi2  2.56302    0.29    
  deciduous / feed.strat Chi2  4.27795    0.11    
  deciduous / breeding   Chi2  36.3742    0.01  **
  deciduous / migratory  Chi2  0.00146756 0.96    
    conifer / feed.hab   Chi2  0.677739   0.70    
    conifer / feed.strat Chi2  3.27694    0.22    
    conifer / breeding   Chi2  8.13156    0.03  * 
    conifer / migratory  Chi2  0.181774   0.67    
      noisy / feed.hab   Chi2  8.04038    0.02  * 
      noisy / feed.strat Chi2  6.75501    0.03  * 
      noisy / breeding   Chi2  22.8175    0.01  **
      noisy / migratory  Chi2  0.992204   0.35    
  veg.cover / feed.hab   Chi2  29.4893    0.02  * 
  veg.cover / feed.strat Chi2  78.3169    0.01  **
  veg.cover / breeding   Chi2  118.24     0.01  **
  veg.cover / migratory  Chi2  9.14415    0.33    

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
> plot(four1, type = "G")
> 
> ## Procedure to combine the results of two models proposed in Dray and Legendre (2008)
> 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)
> plot(four.comb, type = "G")
> 
> 
> 
> 
> 

[Package ade4 Index]