vegan
.
dist.ldc(Y, method = "hellinger", binary = FALSE, samp = TRUE, silent = FALSE)
data.frame
or matrix
."chord"
, "chisquare"
,
"profiles"
, "percentdiff"
, "ruzicka"
,
"divergence"
, "canberra"
, "whittaker"
,
"wishart"
, "kulczynski"
, "jaccard"
, "sorensen"
,
"ochiai"
, "ab.jaccard"
, "ab.sorensen"
,
"ab.ochiai"
, "ab.simpson"
, "euclidean"
,
"manhattan"
, "modmeanchardiff"
. See Details. Names can be
abbreviated to a non-ambiguous set of first letters. Default:
method="hellinger"
.binary=TRUE
, the data are transformed to
presence-absence form before computation of the dissimilarities. Default
value: binary=FALSE
, except for the Jaccard, Sørensen and Ochiai
indices where binary=TRUE
.samp=TRUE
, the abundance-based distances (ab.jaccard,
ab.sorensen, ab.ochiai, ab.simpson) are computed for sample data. If
samp=FALSE
, binary indices are computed for true population data.silent=FALSE
, informative messages sent to users will
be printed to the R console. Use silent=TRUE
is called on a
numerical simulation loop, for example.dist
.
samp=TRUE
, the abundance-based distances
(ab.jaccard, ab.sorensen, ab.ochiai, ab.simpson) are computed for sample
data. If samp=FALSE
, indices are computed for true population data.
– Do not use indices of group 4 with samp=TRUE
on presence-absence
data; the indices are not meant to accommodate this type of data. If
samp=FALSE
is used with presence-absence data, the indices are the
regular Jaccard, Sorensen, Ochiai, Simpson indices. On output, however,
the D matrices are not square-rooted, contrary to the Jaccard, Sorensen,
Ochiai indices in section 3 which are square-rooted.
dist.binary
of ade4, because that form is
Euclidean and will thus produce no negative eigenvalues in principal
coordinate analysis. The Hellinger, chord, chi-square and species profile
dissimilarities are computed using the two-step procedure developed by
Legendre & Gallagher (2001). The data are first transformed using either
the row marginals, or the row and column marginals in the case of the
chi-square distance. The dissimilarities are then computed from the
transformed data using the Euclidean distance formula. As a consequence,
these four dissimilarities are necessarily Euclidean. D matrices for other
binary coefficients can be computed in two ways: either by using function
dist.binary
of ade4, or by choosing option binary=TRUE
, which
transforms the abundance data to binary form, and using one of the
quantitative indices of the present function. Table 1 of Legendre & De
Cáceres (2013) shows the incidence-based (presence-absence-based) indices
computed by the various indices using binary data. The Euclidean distance
computed on untransformed presence-absence or abundance data produces
non-informative and incorrect ordinations, as shown in Legendre & Legendre
(2012, p. 300) and in Legendre & De Cáceres (2013). However, the Euclidean
distance computed on log-transformed abundance data produces meaningful
ordinations in principal coordinate analysis (PCoA). Nonetheless, it is
easier to compute a PCA of log-transformed abundance data instead of a
PCoA; the resulting ordination with scaling 1 will be meaningful. Messages
are printed to the R console indicating the Euclidean status of the
computed dissimilarity matrices. Note that for the chi-square distance,
the columns that sum to zero are eliminated before calculation of the distances,
thus preventing divisions by zero in the calculation of the chi-square
transformation.
if(require("vegan", quietly = TRUE)) {
data(mite)
mat1 = as.matrix(mite[1:10, 1:15]) # No column has a sum of 0
mat2 = as.matrix(mite[61:70, 1:15]) # 7 of the 15 columns have a sum of 0
#Example 1: compute Hellinger distance for mat1
D.out = dist.ldc(mat1,"hellinger")
#Example 2: compute chi-square distance for mat2
D.out = dist.ldc(mat2,"chisquare")
#Example 3: compute percentage difference dissimilarity for mat2
D.out = dist.ldc(mat2,"percentdiff")
}
Run the code above in your browser using DataLab