vegandevs / vegan

R package for community ecologists: popular ordination methods, ecological null models & diversity analysis
https://vegandevs.github.io/vegan/
GNU General Public License v2.0
448 stars 97 forks source link

Why does PROTEST report high significance when PROCRUSTES residuals are high? #630

Closed NJOram closed 6 months ago

NJOram commented 6 months ago

I am trying to test the concurrence of a plant and a microbial community (2 matrices, d1, d2) with Procrustes analysis and protest in vegan. Although the Procrustes residuals are quite high, Protest tells me that the communities are highly significant (with a sum of squares near zero). I am confused why the residuals are high (signaling that the concurrence is low) while the Protest function says otherwise. Can anyone shed light on this issue?

An example: example_data1.csv example_data2.csv


# Read Data
# 1-36 sites (rows), 6 species (columns)
d1<-read.csv("example_data1.csv")%>%
  dplyr::select(-X)%>%
  column_to_rownames(var = "ID")%>%
  as.matrix()

# 1-36 sites (rows), 13988 species (columns)
d2<-read.csv("example_data2.csv")%>%
  dplyr::select(-X)%>%
  column_to_rownames(var = "ID")%>%
  as.matrix()

# Transform and run a PCA on each community (each matrix)
# Extract scores 
# PCA 1
mat1<- decostand (d1, 'hell')
pca1<-rda(mat1)
summary(pca1)
plot(pca1)
scores_pca1<-scores(pca1, display = "sites", choices = c(1:6))%>%
  as.data.frame() 

# PCA2 
mat2 <- decostand (d2, 'hell')
pca2<-rda(mat2)
summary(pca2)
plot(pca2)
scores_pca2<-scores(pca2, display = "sites", choices = c(1:6))%>%
  as.data.frame()

###### Procrusts
set.seed(12345)
pro<-procrustes(scores_pca1,scores_pca2)
summary(pro)
plot(pro, kind = 1)
plot(pro, kind = 2)

image image

# Protest to test significance
prot<-protest(x = scores_pca1, y = scores_pca2,permutations = 9999)
prot
Call:
protest(permutations = 9999, x = scores_pca1, y = scores_pca2) 

Procrustes Sum of Squares (m12 squared):        2.22e-16 
Correlation in a symmetric Procrustes rotation:     1 
Significance:  1e-04 

Permutation: free
Number of permutations: 9999