bayesjaccard | R Documentation |
Jaccard dissimilarity for presence/absence data can be seen as the mode of Beta distributed variate. The function calculates the dissimilarity as a random sample of Beta distribution, or alternatively as its expected value or mode.
bayesjaccard(x, method = c("rbeta", "expected", "mode"))
x |
Community data, will be treated as binary. |
method |
Dissimilarity as a random sample from Beta distribution or as its expected value or mode. |
In often-used 2x2 contingency table notation, a
is the number
of species shared by two compared communities, and b
and
c
are the numbers of species occurring only in one of the
compared communities. Assuming uniform prior in (0, 1), the species
will “sample” the dissimilarity of two communities with
posterior Beta(b+c+1
, a+1
). This will have mode
(b+c)/(a+b+c)
and expected value (b+c+1)/(a+b+c+2)
. The
mode is directly the Jaccard dissimilarity for binary
(presence/absence) data, and the expected value adds 1 in numerator
and 2 in denominator from the prior. The importance of prior will
diminish when the number of species a+b+c
grows, but it will
protect from claiming complete identity or complete difference when
we only have a few species.
Function bayesjaccard
estimates Jaccard dissimilarity as
Beta-distributed random variate, and will return random sample from
its posterior distribution. It can also return the expected value
or the mode which are constant in function calls.
The function is intended to be used to assess the effect of random
sampling variation in community analysis. The natto package
provided three examples of its application: clsupport
finds the “support” of branches in hierarchic clustering by
function hclust
, bjNMDS
the variation
of ordination scores in non-metric multidimensional scaling by
functions metaMDS
and
monoMDS
, and bjdbrda
the
variation of ordination scores of constrained component of
distance-based RDA by function dbrda
. All
these functions find the basic result from the expected value of
the dissimilarity, and produce a set of random samples from the
Beta distribution to assess the variation in the result.
Dissimilarity object inheriting from classes "dist"
and "designdist"
.
Function is a wrapper to designdist
.
data(spurn)
## the effect of prior
plot(bayesjaccard(spurn, "mode"), bayesjaccard(spurn, "expected"))
abline(0, 1, col=2)
## one random sample of dissimilarities
plot(bayesjaccard(spurn, "expected"), bayesjaccard(spurn), asp=1)
abline(0, 1, col=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.