【1.3】–两样方距离的几种计算方法

vegdist {vegan}

Bray-Curtis similarity index


vegdist(x, method="bray", binary=FALSE, diag=FALSE, upper=FALSE,
    na.rm = FALSE, ...)

euclidean

d[jk] = sqrt(sum(x[ij]-x[ik])^2)

binary:

sqrt(A+B-2*J)

manhattan

d[jk] = sum(abs(x[ij] - x[ik]))

binary:

A+B-2*J

gower

d[jk] = (1/M) sum(abs(x[ij]-x[ik])/(max(x[i])-min(x[i])))

binary:

(A+B-2*J)/M,

where M is the number of columns (excluding missing values)

altGower

d[jk] = (1/NZ) sum(abs(x[ij] - x[ik]))

where NZ is the number of non-zero columns excluding double-zeros (Anderson et al. 2006).

binary:

(A+B-2*J)/(A+B-J)

canberra

d[jk] = (1/NZ) sum ((x[ij]-x[ik])/(x[ij]+x[ik]))

where NZ is the number of non-zero entries.

binary:

(A+B-2*J)/(A+B-J)

bray

d[jk] = (sum abs(x[ij]-x[ik]))/(sum (x[ij]+x[ik]))

binary:

(A+B-2*J)/(A+B)

kulczynski

d[jk] 1 - 0.5*((sum min(x[ij],x[ik])/(sum x[ij]) + (sum min(x[ij],x[ik])/(sum x[ik]))

binary:

1-(J/A + J/B)/2

morisita

d[jk] = 1 - 2*sum(x[ij]*x[ik])/((lambda[j]+lambda[k]) * sum(x[ij])*sum(x[ik])), where
lambda[j] = sum(x[ij]*(x[ij]-1))/sum(x[ij])*sum(x[ij]-1)
binary: cannot be calculated

horn Like morisita, but

lambda[j] = sum(x[ij]^2)/(sum(x[ij])^2)

binary: (A+B-2*J)/(A+B)

binomial

d[jk] = sum(x[ij]*log(x[ij]/n[i]) + x[ik]*log(x[ik]/n[i]) - n[i]*log(1/2))/n[i],
where n[i] = x[ij] + x[ik]

binary: log(2)*(A+B-2*J)

cao

d[jk] = (1/S) * sum(log(n[i]/2) - (x[ij]*log(x[ik]) + x[ik]*log(x[ij]))/n[i]),

where S is the number of species in compared sites and n[i] = x[ij] + x[ik]

参考资料:

http://cc.oulu.fi/~jarioksa/opetus/metodi/sessio3.pdf help(vegdist)

个人公众号,比较懒,很少更新,可以在上面提问题,如果回复不及时,可发邮件给我: tiehan@sina.cn

Sam avatar
About Sam
专注生物信息 专注转化医学