Different calculation of Bray-Curtis dissimilarity in vegan (R) and mothur?
2
0
Entering edit mode
9.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.

Are they the same mathematically?

Thanks!

dissimilarity mothur bray-curtis R • 14k views
6
Entering edit mode
9.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

0
Entering edit mode
8.1 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.