I have two community data sets (samples as rows, species as columns, populated with abundance). This data comes from two habitats/sites, with differing numbers of samples at each site.
What I want to do is test the hypothesis that species that tend to co-occur at the first site also tend to co-occur in the second site and whether species that tend to avoid each other in one site also tend to avoid each other in the second site. What is the best way to test this?
My first thought is to do something like a Mantel test where my two matrices are some type of pairwise species co-occurrence index like c-scores or a covariance matrix containing the covariance of each species pair, one for each site. Would this work?
I also considered doing something like ANOSIM or PERMANOVA, but I don't actually want to test if the two sites are different, just if the underlying correlations/co-occurrences between species are the same.
To add some data to this, let's use the first 10 species of the mite data in vegan.
library(vegan) data(mite) data(mite.env) mite=mite[,1:10]
The microtopograhpy in the environmental data is a factor with two levels, "Blanket" and "Hummock." For this example we are interested in the wether these two topographies have the same species associations.
If we look at the data in an NMDS plot, we see that the two topographies do have different mite communities.
However, that's not really what I am asking, but instead want to know if they have the same species associations (i.e. are species whose abundances are positively correlated in one of the topographies also positively correlated in the second?).
So my first thought here is to generate a correlation or covariance matrix for each of the topographies.
Blanket=subset.data.frame(mite,mite.env$Topo=='Blanket') Hummock=subset.data.frame(mite,mite.env$Topo=='Hummock') CorBlanket=cor(Blanket);CorBlanket[upper.tri(CorBlanket,diag=T)]=NA CorHummock=cor(Hummock);CorHummock[upper.tri(CorHummock,diag=T)]=NA
Now, if there was no issue of lack of independence, I would then run a correlation test on the two correlation matrices to test whether species that are correlated in topography 1 are also correlated in topography 2
However, I think this would be invalid and am wondering if I could instead run something like a mantel test to examine this.