Different calculation of Bray-Curtis dissimilarity in vegan (R) and mothur?
2
0
Entering edit mode
6.4 years ago
songzewei ▴ 10

The Bray-Curtis dissimilarity using vegdist of the vegan package in R is calculated as the sum of absolute difference between each pair of OTU:

bray d[jk] = (sum abs(x[ij]-x[ik]))/(sum (x[ij]+x[ik]))
  binary: (A+B-2*J)/(A+B)

But this is different from what is described in mothur (http://www.mothur.org/wiki/Braycurtis ), and wiki (http://en.wikipedia.org/wiki/Bray%E2%80%93Curtis_dissimilarity ), which use the sum of minimum abundance of each pair of OTU.

D_{Bray-Curtis}=1-2\frac{\sum min\left(S_{A,i}\mbox{, } S_{B,i}\right)}{\sum S_{A,i}+\sum S_{B,i}}

Are they the same mathematically?

Thanks!

bray-curtis dissimilarity R mothur • 11k views
ADD COMMENT
6
Entering edit mode
6.4 years ago
pschloss ▴ 300

 

Mathematically they're the same and give the same answer. For example...

forest <- c(1, 1, 1, 1, 1, 1, 3, 3, 2, 2, 1, 1, 3, 2, 1, 1, 1, 1, 2, 1, 1, 2, 5, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

pasture <- c(0, 0, 0, 1, 1, 0, 1, 0, 0, 5, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 2, 1, 1, 1, 1, 1, 7, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1)


1-2*sum(pmin(forest, pasture))/(sum(forest) + sum(pasture))
vegdist(rbind(forest, pasture))

Both will give you 0.7551

 

ADD COMMENT
0
Entering edit mode
5.2 years ago
ingra_sg • 0

In this pdf_file http://www.econ.upf.edu/~michael/stanford/maeb5.pdf, you can find the correct formula´s notation used in vegdist implemented in vegan and their explanation of Bray-Curtis dissimilarity.

ADD COMMENT

Login before adding your answer.

Traffic: 941 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6