## 3 Implementation and Software
### Software  
For each method used to construct confidence ellipses presented in this study, a custom function has been written in R. In particular, these functions are: _PCE()_, _JACmds()_, _BOOTres()_, and _MAPSov()_ for the methods pseudo-confidence ellipses, Jackknife, bootstrapping of the MDS residuals, and overlapping MDS maps, respectively. All functions, among other things, calculate sample, population, and simulated distances, apply HCA to determine the dendrogram of the sample distances, and estimate the Monte-Carlo probabilities of the clusters shown in this dendrogram. In addition, each function calculates confidence ellipses based on the method it applies. Cluster probabilities related to the MDS confidence ellipses are calculated only from the function that implements the MAPsov method, since, as shown below, MAPsov is the most effective method to determine confidence ellipses. This function also presents the most likely dendrogram of the distances calculated from points randomly selected from the MDS ellipses and the probability of obtaining this dendrogram. The basic steps of the algorithm implemented by the MAPsov function are the following:  
1. Input the initial dataset consisting of g samples of N\({}_{i}\) observations each and r continuous or binary variables.
2. Compute all pairwise Euclidean or Mahalanobis-type distances between sample centroids. The mean measure of divergence can also be used.
3. Create simulated distances based on the initial dataset and the selected distance measure using the Monte-Carlo method or bootstrapping.
4. For each generated dataset of pairwise distances, compute the first two MDS dimensions.
5. Use Ordinary Procrustes Analysis to scale, reflect, rotate, translate, and superimpose the MDS solutions created in step 4.
6. Construct confidence ellipses from the superimposed data and display them as a MDS map.
7. In the MDS map, randomly select a point from each ellipse and calculate all pairwise Euclidean distances among these points.
8. Repeat step 7 multiple times, generating a large dataset of Euclidean distances.
9. Estimate all dendrograms of the Euclidean distances of step 8 and determine the most probable dendrogram.
10. Count the number of times that each pattern in the most probable dendrogram appears in the dendrograms of the Euclidean distances and use it to estimate the probability of the formation of this pattern. This procedure is also used to estimate cluster probabilities for all pairwise clusters.
11. The most probable dendrogram related to the confidence ellipses is displayed along with the probabilities of its patterns.  
Based on this function, one additional function, _MAPsov.cnst_(), has been written to test the effect of adding a constant value to all pairwise distances. The default number of iterations used to estimate simulated distances was 2000, and the population size was equal to 100,000. The bootstrap iterations and the number of overlapping maps were 2000, whereas the number of iterations used for sampling points from the ellipses varied from 2000 to 5000.  
All software material, along with detailed instructions, is presented as Supplementary Materials in Supplement-S1-Instructions and Code.