binomial_deviance {abdiv} | R Documentation |
The binomial deviance dissimilarity and the CY (or Cao) index of dissimilarity were created to compare species counts at sites with moderate to large differences.
binomial_deviance(x, y)
cy_dissimilarity(x, y, base = 10, min_value = 0.1)
x , y |
Numeric vectors |
base |
Base of the logarithm |
min_value |
Replacement for zero or near-zero values. Values less than
|
Both of these measures were designed to be used with whole-numbered counts, and may not make sense for comparing normalized vectors or vectors of species proportions.
For two vectors x
and y
, the binomial deviance dissimilarity
is
d(x,y) = \sum_i{
\frac{1}{n_i}
\left (
x_i \log{\frac{x_i}{n_i}} +
y_i \log{\frac{y_i}{n_i}} -
(x_i + y_i) log{2}
\right )
},
where n_i = x_i + y_i
. This value is the weighted average of the
deviance for each species, under a binomial model where the expected counts
are n_i / 2
at each site. It was proposed by Anderson and Millar in
2004. Relation to other definitions:
Equivalent to vegdist() with method = "binomial".
The CY index was proposed by Cao, Williams, and Bark in 1997. For two
vectors x
and y
, the CY index is
d(x,y) = \frac{1}{N} \sum_i
\left (
\frac{
(x_i + y_i) \log_{10} ( \frac{x_i + y_i}{2} ) -
x_i \log_{10}(y_i) - y_i \log_{10}(x_i)
}{
x_i + y_i
}
\right ),
where N
is the total number of species in vectors x
and y
.
Double zeros are not considered in the measure.
When either x_i
or y_i
are zero, they need to be replaced by
another value in the CY index to avoid infinities. Cao suggested replacing
zero values with 0.1
, which is one log lower than the minimum value
for whole-numbered counts. Here, we use a min_value
argument to allow
the user set a lower limit on the values. For vectors of species counts,
this function follows the formulation of Cao by default.
Relation of the CY index to other definitions:
Equivalent to the vegdist()
function with
method = "cao"
, if base = exp(1)
.
The Binomial deviance or CY index of dissimilarity. The CY index is
undefined if all elements of x
and y
are zero, in which case
we return NaN
.
Anderson MJ, Millar RB. Spatial variation and effects of habitat on temperate reef fish assemblages in northeastern New Zealand. Journal of Experimental Marine Biology and Ecology 2004;305:191–221.
Cao Y, Williams WP, Bark AW. Similarity measure bias in river benthic Aufwuchs community analysis. Water Environment Research 1997;69(1):95-106.