User Tools

Site Tools


Ecological resemblance


The ecological resemblance including similarities and distances between samples, is the basic tool how to handle multivariate ecological data. Two samples sharing the same species in the same abundances have the highest similarity (and lowest distance), and the similarity decreases (and distance increases) with the differences in their species composition. All cluster and ordination methods operate with similarity or distance between samples. Even PCA and CA, even if not said explicitly, are based on Euclidean and chi-square distances, respectively.

Similarity, dissimilarity and distance


There is a number of measures of similarities or distances (Legendre & Legendre 2012 list around 30 of them). The first decision one has to make is whether the aim is R- or Q-mode analysis (R-mode focuses on differences among species, Q-mode on differences among samples), since some of the measures differ between both modes (e.g. Pearson's r correlation coefficient makes sense for association between species (R-mode), but not for association between samples (Q-mode); in contrast, e.g. Sørensen index can be used in both Q- and R-mode analysis, called Dice index in R-mode analysis). Further, if focusing on differences between samples (Q-mode), the most relevant measures in ecology are asymmetric indices ignoring double zeros (more about double-zero problem below). Then, it also depends whether the data are qualitative (i.e. binary, presence-absence) or quantitative (species abundances). In the case of distance indices, an important criterium is whether they are metric (they can be displayed in Euclidean space) or not, since this influences the choice of the index for some ordination or clustering methods.

Legendre & Legendre (2012) offers a kind of “key” how to select an appropriate measure for given data and problem (Tables 7.4-7.6). Generally, as a rule of thumb, Bray-Curtis and Hellinger distances are better choices than Euclidean or Chi-square distances.

Double-zero problem

“Double zero” is a situation when certain species is missing in both compared community samples for which similarity/distance is calculated. Species missing simultaneously in two samples can mean the following: (1) samples are located outside of the species ecological niche, but one cannot say whether both samples are on the same side of the ecological gradient (i.e. they can be rather ecologically similar, samples A and B on Fig. 1) or they are on the opposite sides (and hence very different, samples A and C). Alternatively, (2) samples are located inside species ecological niche (samples D and E), but the species in given samples does not occur, since it didn’t get there (dispersal limitation), or it was present, but overlooked and not sampled (sampling bias). In both cases, the double zero represents missing information, which cannot offer an insight into the ecology of compared samples.


Similarity indices differ in a way how they approach the double-zero problem. Symmetrical indices treat double zero (0-0) in the same way as double presences, i.e. as a reason to consider samples similar. This is not usually meaningful for species composition data (as explained above), but could be meaningful e.g. for multivariate data containing chemical measurement (the fact that e.g. heavy metals are missing in both samples could really indicate similarity between both samples). Asymmetrical indices ignore double zero, and focus only on double presences when evaluating the similarity of samples; these indices are usually more meaningful for species composition data.

Figure 2: For details see the text.

Fig. 2 shows an ecological example of double zero problem. Samples 1 to 3 are sorted according to the wetness of their habitat – sample 1 is the wettest and sample 3 is the driest. In samples 1 and 3, no mesic species occur, since sample 1 is too wet and sample 3 too dry - these is the double zero. The fact that the mesic species is missing does not say anything about ecological similarity or difference between both samples; simply there is no information, and it is better to ignore it. In the case of symmetrical indices of similarity, the absence of mesic species in sample 1 and sample 3 (0-0, double zero) will increase similarity of sample 1 and 2; in asymmetrical indices, double zeros will be ignored and only presences (1-1, 1-0, 0-1) will be considered.

Similarity indices

Table 1 summarizes categories of similarity indices. Symmetric indices, i.e. those which consider double zeros as relevant, are not further treated here since they are not useful for analysis of ecological data (although they may be useful e.g. for analysis of environmental variables if there are binary). Here we will consider only asymmetric similarity indices, i.e. those ignoring double zeros. These split into two types according to the data which they are using: qualitative (binary) indices, applied on presence-absence data, and quantitative indices, applied on raw (or transformed) species abundances. Note that some of the indices have also multi-sample alternatives (i.e. they could be calculated on more than two samples), which could be used for calculating beta diversity.

Similarity indices How they deal with double zero problem?
Table 1: Similarity indices classified according to their properties.
present absent
in sample 2 present a b
absent c d







Species abundances A B W
Site x1 7 3 0 5 0 1 16
Site x2 2 4 7 6 0 3 22
Minimum 2 3 0 5 0 1 11


Quantitative similarity indices (applied on raw abundances) include percentage similarity, which is a quantitative version of Sørensen similarity index (which means that if calculated on presence-absence data, it gives the same results are Sørensen similarity index). Note that percentage difference, calculated as 1-percentage similarity, is called Bray-Curtis index.

Distance indices

While similarity indices return the highest value in the case that both compares samples are identical (maximally similar), distance indices are largest for two samples which do not share any species (are maximally dissimilar). There are two types of distance (or dissimilarity) indices2):

  1. those calculated from similarity indices, usually as D = 1 - S, where S is the similarity index; examples include Jaccard, Sørensen and Simpson dissimilarity for qualitative (binary) data, and percentage difference (known also as Bray-Curtis distance) for quantitative data;
  2. those distances which have no analog in the similarity indices, e.g. Euclidean, chord, Hellinger or chi-square distance index.

Figure 3: Triangle inequality principle.

An important criterium is whether the distance index is metric or not (i.e. it is semi-metric or non-metric). The term “metric” refers to the indices which can be displayed in the orthogonal Euclidean space, since they obey so-called “triangle inequality principle” (see explanation in Fig. 3). Some dissimilarity indices calculated from similarities are metric (e.g. Jaccard dissimilarity), some are not (e.g. Sørensen dissimilarity and it's quantitative version called Bray-Curtis dissimilarity). In the case of Sørensen and Bray-Curtis (and some others), this can be solved by calculating the dissimilarity as D~=~sqrt{1-S} instead of the standard D~=~1-S (where S is the similarity); resulting dissimilarity index is then metric. Indices which are not metric cause troubles in ordination methods relying on Euclidean space (PCoA or db-RDA) and numerical clustering algorithms which need to locate samples in the Euclidean space (such as Ward algorithm or K-means). For example, PCoA calculated using distances which are not metric creates axes with negative eigenvalues, and this e.g. in db-RDA may result in virtually higher variation explained by explanatory variables than would reflect the data.



Euclidean distance, although not suitable for ecological data, is frequently used in a multivariate analysis (mostly because it is the implicit distance for linear ordination methods like PCA, RDA and for some clustering algorithms). Euclidean distance has no upper limit and the maximum value depends on the data. The main reason why it is not suitable for compositional data is that it is a symmetrical index, i.e. it treats double zeros in the same way as double presences. Double zeros shrink the distance between two plots. The solution is to apply Euclidean distances on pre-transformed species composition data (e.g. using Hellinger, Chord or chi-square transformation). An example of calculating Euclidean distance between samples with only two species is on Fig. 4.



Hellinger distance is Euclidean distance calculated on Hellinger transformed species data (and is the distance used in tb-PCA and tb-RDA if the species data are pre-transformed by Hellinger transformation). Hellinger transformation consists of first relativizing the species abundances in the sample by standardizing them to sample total (sum of all abundances in the sample); then, each standardized value is square-rooted. This puts the species abundances on the relative scale, and square-rooting lowers the importance of the dominant species. Hellinger distance has an upper limit of sqrt{2} and is considered as a suitable method for ecological data with many zeros.

Chi-square distance is rarely calculated itself, but is important since it is implicit for CA and CCA ordination.

Euclidean distance: abundance paradox



Species 1 Species 2 Species 3
Sample 1 0 1 1
Sample 2 1 0 0
Sample 3 0 4 8



Matrix of similarities/distances

The matrix of similarities or distances is squared (the same number of rows as columns), with the values on diagonal either zeros (distances) or ones (similarities), and symmetric - the upper right triangle is a mirror of values in lower left one (Fig. 5).

Figure 5: Matrix of Eculidean distances calculated between all pairs of samples (a subset of 10 samples from Ellenberg's Danube meadow dataset used). Diagonal values (yellow) are zeros, since distance of two identical samples is zero.

en/similarity.txt · Last modified: 2018/03/31 08:22 by David Zelený