I have around 50 communities and want to know the best way to estimate the distance decay between them. I want a package in R to do this. Any suggestions?
I agree with Joseph Bennett. The vegan package is well. And I suggest that you refer to Pierre Legendre's work, and take care of his idea on distance decay. His quantitative ecology class's R note is here, and I think it is very useful: http://biol09.biol.umontreal.ca/BIO6077/Practicals_in_R.pdf
Janne Soininen has also done good work on distance decay. Here is his webpage: http://www.helsinki.fi/aquaticecology/publications/publicationsSoininen.htm
In general the way to do this within R is to do a regression of the log similarity matrix on the distance matrix. So if s is the similarity matrix and d is the distance matrix, you could type:
lm.res = lm(log(as.vector(s))~as.vector(d))
Then the regression coefficient is usually used in the literature as the descriptor of distance decay, or the distance at which 50% of the maximum similarity is observed.
Note, however, that the standard errors and probability of this regression are meaningless, since the number of data points is greater than the number of independent observations (communities). To estimate the probability, you would use a permutational Mantel test. If you load vegan in R,
mantel (s, d, perm = 9999)
gives you the probability for 9999 permutations. For standard error of the regression coefficient, you would need to use the sample() function in R to do the regression a large number of times with the rows/columns of one of the matrices randomized, then calculate the standard deviation of the regression coefficient.
You do need to think carefully about the similarity measure you use for the community pairs, and what kind of geographical distance you use. For the similarity measure, you could use a measure based on presence/absence (classical beta-diversity) or on abundance (generally distance measures). In vegan, dist() and betadiver() will give you the matrices you need for the regression. Geographical distance as the crow flies is gotten by dist(cbind(easting, northing), method = "euclidean"). But you might not want distance as the crow flies, rather the path of least resistance between pairs, which gets a bit more complicated; you'd need a habitat GIS, habitat resistance scores, and optim() for that :-)
Check also the "ecodist" package in R which I think does excatly what you need since it provides dissimilarity-based functions for ecological analysis:
I have been using it a lot for similar purposes (distance decay of similarity in plant communities) and it works very well. Besides, it performs pretty fast for all the permutation tests that Stewart has nicely explained.
i suggest to work with semivariograms, where you indicate the relationship between beta-diversity (e.g. Dissimilarity indices) and spatial distance. Then you will see whether you have nugget effects (autocorrelation in close distance) or whether large distances exhibit traits of a different ecosystem.
I co-published recently a paper about the distance decay of similarity, testing the properties of several similarity indices to infer niche and dispersal based processes using a distance decay approach. This may help to choose the most suitable similarity metric. We also proposed a partioning approach to detect niche based process in presence of dispersal limitation.
The paper is:
Réjou-Méchain M., Hardy O.J. (2011). Properties of similarity indices under niche-based and dispersal-based processes in communities. American Naturalist. 177(5) : 589-604.
Hope that help for your case.
I also agree that vegan is an appropriate package!
if you also want to include environmental factors besides species data I could recommend the mso (multi-scale ordination) code presented by Helene Wagner (2004, Ecology) in combination with the vegan package. The code analyses spatial dependence of community similarity with regard to the contribution of measured and unmeasured environmental factors to this at respective distance classes.
Species spatial turnover, or β-diversity, induces a decay of community similarity with geographic distance known as the distance–decay relationship. The Poisson Cluster Process can be used to derive an exact analytical expression of the distance–decay relationship for aggregating populations .
Hi Caryne, I know an example that might be usefull for you: http://onlinelibrary.wiley.com/doi/10.1111/j.1365-2699.2005.01288.x/full
The full reference is:
Oliva M. E. & M. T. González. 2005. The decay of similarity over geographic distance in parasite communities of marine fishes. Journal of Biogeography 32:1327-1332
They estimate bray-curtis distance matrices between their communities and then this was correlated (with linear regression) with the distance (in nautical miles) among their sites where comunities were collected.