## 2 Theoretical Background
### Distance Measures and MDS Techniques  
The distance measures used in the present study were the squared Euclidean and Mahalanobis distances with and without correction for small sample sizes, ED, cED, MD1, cMD1, MD2, cMD2, as well as the corresponding distances for binary data, MMD and UMD, defined by [PERSON] (2015). Note that the MMD and UMD are, in fact, squared Euclidean distances with correction for small sample sizes for binary data. Thus,for completeness, we added the corresponding Mahalanobis-type distance cBMD1, that is, the distance cMD1 when the variables are binary data. To define this distance, we assumed that the binary data code is an underlying continuous variable that follows the normal distribution with unit standard deviation [17]. Under this assumption, the squared Mahalanobis distance between two multivariate samples of continuous variables, MD1, is transformed into a distance for binary variables as follows: MD1 is defined by [3; 18; 19; 20]:  
\[MD1=(\overline{x}_{1}-\overline{x}_{2})^{T}C^{-1}(\overline{x}_{1}-\overline {x}_{2}) \tag{4}\]  
where \(\overline{x}_{1}\) and \(\overline{x}_{2}\) are the vectors of the mean values of samples 1 and 2, respectively; \(T\) denotes the transpose matrix; and \(C^{-1}\) is the inverse covariance matrix of the populations from which samples 1 and 2 are drawn. In the event that this matrix is unknown, it may be replaced by the pooled covariance matrix \(S\), which is an unbiased estimator of \(C\). When the samples consist of binary variables, the contribution of each binary variable \(i\) to the difference \(\overline{x}_{1}-\overline{x}_{2}\) is estimated from the difference \(z_{1i}-z_{2i}=probit(p_{1i})-probit(p_{2i})\), where probit is the inverse of the cumulative distribution function of the standard normal distribution, \(p_{1i}\) is the percentage of absences (0) or presences (1) of the trait \(i\) in sample 1, and \(p_{2i}\) is the corresponding quantity for sample 2. In what concerns the covariance matrix \(C\), it is estimated from the pooled covariance matrix \(S\), where the covariances between the binary variables can be estimated using tetrachoric correlations and unit standard deviation. However, at this point, we should stress that when the number of binary variables is relatively large, the covariance matrix may have negative eigenvalues, which shows that the calculated Mahalanobis distance is incorrect [21]. This computational problem can be easily handled by computing at each sample the nearest positive definite matrix. Thus, in the R computing language, this can be performed via the _nearPD()_ function of the _Matrix_ package. The distance measure defined above will be denoted by BMD1, which is the analog of MD1 for continuous variables. Therefore, BMD1 can become an unbiased estimator of population divergence if it is corrected as [15]:  
\[cBMD1=BMD1-r\bigg{(}\frac{1}{n_{1}}+\frac{1}{n_{2}}\bigg{)} \tag{5}\]  
where \(r\) is the number of variables and \(n_{1}\) and \(n_{2}\) are the number of observations (cases) for each sample. There are several MDS techniques that may be classified into metric and nonmetric MDS. Metric MDS produces a map of points for which the Euclidean distances, or any other distance measure adopted, are as close as possible to the distances used to produce the map. In nonmetric MDS, the map reproduces not the input distances but the ranks of these distances. In the present paper, we examined four MDS techniques: metric MDS (mMDS) using the SMACOF algorithm [4], nonmetric MDS (nMDS) also based on the SMACOF algorithm, metric MDS based on Principal Coordinates Analysis (PCoA) [22], and an approach adopted to the present study based on the maximum correlation between initial and MDS distances (corMDS). Note that the latter technique does not produce a map of points for which the Euclidean distances are as close as possible to the input distances; instead, the corMDS technique produces a map of points for which the Euclidean distances are highly correlated to the input distances.