WorksMathematics
-Midranks: A robust clustering algorithm for heavy-tailed data with applications to spectroscopy and finance
Abstract
Clustering data with extreme observations and heavy tails can be challenging for methods that rely on distances between raw observations or specific distributional assumptions. We introduce -midranks, a clustering method that replaces observations with coordinatewise ranks and partitions the transformed data using a procedure analogous to -means. This transformation reduces the influence of extreme values while preserving the ordering of observations within each variable. We evaluate -midranks against -means, -medoids, and mixture models based on Gaussian, Student's t, Cauchy, and generalized hyperbolic distributions through simulation studies, and provide some theoretical properties. -midranks generally outperforms the competing methods on Cauchy-shifted data. In contrast, -means and model-based methods perform better on Gaussian data and Student's t data with three degrees of freedom. We demonstrate the method's practical use in grouping samples based on Raman and LIBS spectra and clustering S&P 500 stocks according to their returns. -midranks achieves competitive performance with model-based methods in the spectroscopy applications and the best performance among the methods considered in the stock-return application. These findings suggest that -midranks provides a useful alternative for clustering data with Cauchy-like heavy tails. An R package implementing the proposed method is available.
Introduction
Cluster analysis is a fundamental process in statistics and machine learning in which data are grouped into subsets, known as clusters, according to their similarity (see James et al. [19] for a review). The primary goal is to uncover hidden structure in data not having group labels. Cluster analysis is widely applied across fields including business, medicine, and the environmental and social sciences. For instance, it is used to identify groups of customers with similar purchasing behavior, to group cancer cells by biochemical characteristics, and analyze wildfire risk areas using satellite data (see Ragavan, Ananth and M.R.Rajan [27]; Cizungu et al. [7] for more examples). The well known -means clustering (MacQueen, [24]) algorithm is perhaps the most notable, though the collection also includes, -medoids (Kaufman, [21]), hierarchical clustering (Tryon, [32]), EM clustering (Dempster, Laird and Rubin, [10]), DBSCAN (Ester et al., [12]), and model based clustering (Banfield and Raftery, [4]).
While many algorithms may be reliable when applied to well behaved data sets, they may fail when the observations are governed by distributions having heavy tails. Such distributions commonly arise in many real-world applications, including financial returns, spectroscopic measurements (e.g., Raman, LIBS, and mass spectrometry), insurance claim sizes, telecommunication and network traffic, environmental extremes (e.g., rainfall and flood events), and biomedical data (see Cont [9]; Embrechts, Klüppelberg and Mikosch [11]; Coles et al. (2001)). In these applications, the presence of extreme observations is an inherent characteristic of the data rather than a result of measurement errors.
Heavy-tailed data present significant challenges for conventional clustering algorithms such as -means and -medoids, which are sensitive to extreme observations [17, 14]. Since these algorithms optimize distance-based objective functions, a small number of extreme observations can substantially distort the estimated cluster centers, leading to inaccurate cluster assignments, especially when clusters overlap. Consequently, specialized clustering methods are required to analyze datasets exhibiting heavy-tailed characteristics effectively. The most popular option is model-based clustering [1, 26, 34]. However, its performance relies heavily on the choice of the underlying probability distribution, which may negatively affect the convergence of the procedure’s parameter estimates, particularly for complex models or high-dimensional data.
In this work, we introduce -midranks, a novel clustering method based on coordinatewise ranks. Replacing continuous variables with coordinatewise ranks reduces the influence of outliers and extreme values, and does not require assumptions about the existence of marginal moments.
Transformations to ranks have a storied history in non-parametric statistics, including the well known rank correlation of Spearman [30] and the Wilcoxon rank-sum/Mann–Whitney test [33, 25]. In all such procedures, the gain in robustness and stability in the presence of outliers is made at the cost of discarding the sizes of the gaps between observations, which may contain useful information.
The connection between clustering and rank-based techniques has been studied previously. Cape, Yu and Liao [6] proposed an eigenvector-based clustering method that operates on a matrix of nonparametric normalized rank statistics derived entrywise from the original data matrix. Unlike our setting, the raw data in their work take the form of an weighted adjacency matrix, where each entry represents a random relationship between objects and . A symmetric rank transformation is first applied to the original matrix, after which clustering is performed using the truncated eigendecomposition of the resulting rank matrix. Ballante, Mira and Figini (2024) proposed a hierarchical clustering algorithm based on the rank-based similarity measure introduced by Ballante, Figini and Mira (2024), which extends the approach of Gilemo et al. (2022). In their framework, the rank is defined as the rank of object from the perspective of object . These definitions differ fundamentally from the coordinatewise rank employed here in our proposed method, which is introduced below.
We assess the performance of the proposed -midranks algorithm by first evaluating it on simulated datasets with known class labels and comparing its performance with several existing clustering methods, including -means, -medoids, and model-based clustering based on Gaussian, Student’s , Cauchy, and generalized hyperbolic distributions. We then apply -midranks to the real-world datasets mentioned above.
The remainder of this work is organized as follows. § 2 gives the scientific and data context. The proposed methodology is presented in § 3, followed by the main mathematical and statistical properties in § 4. § 5 presents the simulation and comparative validation study, and § 6 gives the real-data analyses. Discussion, limitations, and concluding remarks appear in § 7. A supplement to this article provides the proofs of the claims made regarding the procedure.
Scientific and data context
Heavy-tailed distributions
A heavy-tailed distribution is a probability distribution whose tail probabilities decay more slowly than those of an exponential distribution. Consequently, extreme observations occur with a substantially higher probability than under light-tailed distributions, such as the normal distribution. Many common heavy-tailed distributions lack a finite first absolute moment, including the Cauchy distribution, the Pareto distribution with , and Student’s distribution with .
Scientific application settings
We introduce the real-world settings considered in the application section of this study. Specifically, we consider Laser-Induced Breakdown Spectroscopy (LIBS), Raman spectroscopy, and Standard & Poor’s 500 (S&P 500) stock returns.
Spectroscopy is one of the principal tools by which scientists infer the physical and chemical properties of matter from its interaction with electromagnetic radiation. Different atoms and molecules absorb, emit, or scatter radiation at characteristic wavelengths, so that its measured spectrum can contain information about many of its physical properties, and principally its chemical composition. Spectroscopy is also useful when direct examination of an object is difficult or impossible. In astronomy, for example, spectra are used to determine the chemical composition and motion of stars and galaxies and to identify molecules in the atmospheres of distant planets.
Raman and LIBS spectroscopy provide complementary information about materials. Raman spectroscopy ([13]) probes molecular structure through small frequency shifts in laser light scattered by a sample, while LIBS ([22]) creates a short-lived plasma and analyzes the light emitted as it cools, providing information principally about elemental composition. The physical mechanisms of the two techniques are described in more detail in § 6.1 and § 6.2.
The growing use of spectroscopy also creates a statistical problem: a single experiment may produce hundreds or thousands of spectral measurements, each recorded at thousands of wavelengths. Clustering provides a way to explore such data without prespecifying the identities of the samples. If spectra naturally separate into groups, they may correspond to a shared property such as composition, or forms. Clustering can therefore be used not only to compress a large collection of spectra into an interpretable structure, but also to reveal unexpected similarities that could merit further investigation.
Because -midranks is intended primarily for settings in which extreme observations can make standard methods unreliable, it is important to examine whether the numerical features in our applications exhibit heavy tails. We investigate this empirically using normal Q–Q plots. We first compare the Q–Q behavior of the Gaussian, Student’s , and Cauchy-based simulated datasets, and then compare these patterns with those observed in the Raman, LIBS, and S&P 500 data; see Figure 16 and Figure 17. These diagnostics provide visual evidence about the presence of extreme tail behavior, but are not intended by themselves to establish that a population moment is infinite.

Figure 16. Normal Q–Q plots for all standardized variables from one selected case of each simulation class: Class 1 (Gaussian-based, , ), Class 2 (-based, , ), Class 3 (Cauchy-based, , ), and Class 4 (Cauchy-based, , ). Each colored curve is a Q–Q plot constructed from the observations of one variable across all clusters, and the dashed line represents the standard normal reference.

Figure 17. Normal Q–Q plots for selected standardized variables from the real-world datasets: Raman with 20 retained principal components (left), LIBS with 50 retained principal components (center), and S&P500 with 15 randomly selected time points (right). Each colored curve is a Q–Q plot constructed from the observations of one variable across all clusters, and the dashed line represents the standard normal reference.
Next, the well known S&P 500 stock market index consists of 500 leading publicly traded companies in the United States and is widely regarded as a proxy for the overall U.S. equity market. Return distributions are well known to exhibit heavy tails ([5]), making them challenging for conventional statistical methods that are predicated on Gaussian tails.
Although S&P 500 companies are commonly categorized into sectors such as information technology, healthcare, and financials, these classifications are based on primary business activities rather than market behavior. Stocks from different sectors may exhibit similar return patterns because they are exposed to common economic factors, while companies within the same sector may behave differently due to differences in size, growth prospects, or financial structure. Consequently, clustering can reveal latent market structure that can identify groups of stocks with similar risk and return profiles.
Proposed methodology
K-midranks and other clustering methods based on representatives
Many clustering methods determine a partition of into clusters, with each set in the collection non-empty and all pairs having null intersection, by minimizing an objective function depending on a choice of dissimilarity measure and of center, or representative , for the non-empty cluster .
We first introduce -midranks, followed by the methods we use for performance comparison. The key difference between -midranks and the other methods considered is that it replaces the given data by coordinatewise ranks before computing distances and cluster representatives. This transformation removes marginal units and is independent of the sizes of marginal gaps. This makes -midranks more robust against extreme values and outliers, as the median is with respect to the mean. However, as with other procedures that protect against outliers, there is typically an efficiency price to pay when the data are well behaved, such as when their tails are sub-Gaussian.
In the following, we will use
to denote the and Euclidean distance, respectively.
K-midranks
Here we first transform the data matrix using ranks, define the column-wise rank matrix to have entries
Notice that the largest value is given rank 1, and equal observations are given the same rank.
For , the objective function and cluster representatives are respectively given by
where the minimization is over partitions of where each set is non-empty and all pairs have null intersection. When , any coordinatewise median of the rank vectors in is a minimizer in (2); for , the unique minimizer is the coordinatewise mean. The algorithm we use in practice to minimize the objective function in (2) is given at the end of this section.
K-means
The objective function and choice of cluster representative of the -means method (MacQueen, [24]) are given by
The squared-Euclidean version of -midranks uses the same within-cluster sum-of-squares criterion, but applies it to the coordinatewise rank vectors rather than to the original observations.
K-medians
The objective function and choice of cluster representative of -medians ([18]) are given by
where denotes the th coordinate of observation . Hence this method is similar to -means in (3), but replaces the squared Euclidean loss by the loss , and the mean representative by the coordinatewise median.
Since the median and the size of an absolute deviation are less sensitive to extreme observations than the mean and squared deviations, -medians is generally more robust to outliers than -means.
The version of -midranks is -medians applied to the coordinatewise rank vectors. Thus both use coordinatewise medians as representatives, but ordinary -medians retains the original numerical magnitudes, whereas -midranks replaces them by their relative order.
K-medoids
-medoids also partitions the data into groups, but it represents each cluster by an observed data point, called its medoid. For a given dissimilarity , the objective function and the choice of center are respectively given by
One common choice for the measure is the distance. We note that here the cluster representative is an observed data point. Consequently -medoids does not require computing, say, averages or medians. For a fixed cluster and data representation, restricting the representative to an observed point can give a larger minimum loss than allowing an arbitrary representative, as in -medians and -midranks. Although -medoids is usually less sensitive than -means to isolated extreme observations, large distances between the original observations can still influence its assignments and objective. In contrast, -midranks computes dissimilarities after replacing the observations by coordinatewise ranks.
Model-based clustering
Model-based clustering ([4]) assumes that the observations arise from a finite mixture of probability distributions, whose parameters may differ across components to capture differences in location, spread, and shape (see McNicholas [26] for a review). The mixing proportions and the parameters of the component distributions are estimated from the data. The fitted model is then used to calculate the posterior probability that each observation belongs to each component. These probabilities provide soft cluster memberships, while a hard clustering is obtained by assigning each observation to the component with the largest posterior probability.
Examples include Gaussian, Student’s , and generalized hyperbolic mixture models, which differ in the distributions used to model the latent groups. Gaussian components describe ellipsoidal groups, while Student’s components accommodate heavier tails. Generalized hyperbolic components allow additional flexibility in tail behavior and asymmetry.
In comparison with ours, Model-based methods retain the original numerical measurements and posit an explicit probability model. On the positive side, they can accommodate overlapping clusters, quantify posterior membership uncertainty, and estimate cluster-specific location and shape parameters. Their performance, however, depends on whether the particular distributional family selected by the user is actually in force, and how reliably its parameters can be estimated. These methods may employ heavy-tailed distributions such as the Student’s , the generalized hyperbolic, and Cauchy distributions to accommodate extreme observations.
In contrast, the use of -midranks does not require any parametric model for the data to be adopted, and achieves robustness by transforming the data via ranks, which depend only on the ordering of observations which are are independent of the sizes of marginal gaps.
To run -midranks in practice, we use Algorithm 1, modeled after that for -means. In particular, the algorithm is essentially the usual -means algorithm applied to data whose coordinate values have been replaced by ranks, and modified to have the two loss functions we consider; see Proposition 4.1. We include the algorithm description not only for clarity and completeness, but also so that we can compute its complexity in Proposition 4.4 below.
Algorithm 1 -midranks Clustering
Require: Data matrix , positive integers , , an integer , and a loss as above.
Ensure: Assignments to nonempty clusters and representatives .
Construct using descending columnwise ranks
Initialize so that every cluster is nonempty.
repeat
Save .
for do
Choose a minimizing representative
For loss, take the coordinatewise median, choosing the midpoint of the two central ordered values whenever is even. For squared loss, take the coordinatewise mean.
end for
Keep the representatives fixed throughout the next assignment step.
for do
Let be the set of minimizing cluster labels:
If , retain the current assignment; otherwise set .
end for
while some cluster is empty do
Let be the smallest label of an empty cluster.
Choose the smallest index whose current cluster contains at least two observations.
Set and , (thus updating the cluster memberships and sizes.)
end while
until
Mathematical and statistical properties
Proofs of the propositions stated in this section, together with additional mathematical results, are given in the Supplementary Material.
For convenience, define the normalized rank vectors by
For each fixed partition and , replacing the rank vectors by their normalized versions multiplies the objective in (2), minimized over the representatives, by . Consequently, normalization leaves the set of minimizing partitions unchanged. The corresponding representatives are divided by . The normalization is useful because every lies in .
Proposition 4.1 (Form of the cluster representatives). Let be nonempty. For , consider the normalized cluster representatives defined by
For , the minimization separates by coordinates, and the minimizers are exactly the coordinatewise medians. More precisely, if
are the ordered values of coordinate among the normalized rank vectors indexed by , then is a minimizing representative if and only if
We take the midpoint of this interval in each coordinate. Thus the version of -midranks is -medians applied to the normalized rank vectors.
For , the unique minimizing representative is the mean
Thus the squared-Euclidean version of -midranks is -means applied to the normalized rank vectors.
Proposition 4.2 (Monotone invariance). For each coordinate , let be a strictly increasing function. Then the replacement of by leaves the rank matrix in (1) unchanged. In particular, for the losses (2) with the objective function and the set of globally minimizing partitions are unchanged.
If every coordinate is tie-free, the objective and the set of globally minimizing partitions are likewise unchanged when each is strictly decreasing. For a decreasing one then has
and coordinatewise reflections preserve both and squared-Euclidean dissimilarities.
It is also clear that the method is invariant under permutations of the coordinates.
Balanced rowwise Rand distance robustness
We now demonstrate that, for the balanced two-cluster benchmark defined below, -midranks with squared-Euclidean loss and global minimization over balanced partitions has a “breakdown point” comparable to that of the usual median. For two partitions and of , define their Rand distance by
Thus means that the two partitions disagree on at least half of all pairwise co-membership decisions.
Let be even and write . Let , where and are disjoint and both have size . Consider the benchmark matrix with entries
Every coordinate perfectly separates the two groups. Consequently, is the unique two-block global minimizer, up to relabeling.
For a data matrix , let denote the normalized rank vector of its th row, computed as in (5). For a two-block partition , define
Thus is the squared-Euclidean -midranks objective, with the normalized rank vectors computed from .
Let be the collection of partitions of into two blocks of size , and define the set of globally minimizing balanced partitions by
This set is nonempty because is finite. When the balanced optimum is unique, denote its sole element by .
For two matrices and with rows and , respectively, let
the number of row indices on which they differ. Define the balanced rowwise half-Rand corruption count by
Proposition 4.3 (Balanced rowwise half-Rand robustness). Let
For the benchmark matrix (9),
Thus, in this balanced benchmark, nearly half of the observational units must be altered before the unique optimal balanced partition can disagree with the original partition on at least half of all pairwise co-membership decisions.
More generally, if denotes the analogous minimum number of altered rows required so that the unique optimal balanced partition satisfies , then
where the function is plotted in Figure 1. The proof, including this extension, is given in the Supplementary Material.
Figure 1. The function on the admissible range .
For the following complexity bound we assume and order for sorting and extracting a median from a list of size , respectively.
Proposition 4.4 (Termination and computational cost). Algorithm Algorithm 1 terminates after finitely many steps to a partition which has exactly non-empty clusters, is a fixed point, and which need not be globally optimal. If is the number of iterations performed before the fixed point is reached then the total running time, using the squared Euclidean or loss is .
Simulation and validation
Comparison with existing procedures
In this section, we assess the quality of the clustering produced by -midranks on synthetic data by withholding the known labels using two metrics, Accuracy and the Adjusted Rand Index. As these two measures emphasize somewhat different aspects of agreement, both measures are reported in the tables and displayed graphically below.
Let and denote the true labels and the estimated cluster labels, respectively. Since cluster labels are arbitrary up to a permutation, the clustering accuracy is defined as
where denotes the set of all permutations of .
The Adjusted Rand Index, or ARI (Hubert and Arabie, [16]) evaluates the agreement between the predicted clustering and ground truth labels while adjusting for chance grouping. The ARI is defined as:
where is the partition into clusters obtained from the algorithm, is the true partition, and is the total number of data points. The ARI ranges from to , with indicating perfect agreement.
The ARI has a useful pairwise interpretation. For each pair of observations, two partitions agree if they either place both observations in the same cluster or place them in different clusters. The ordinary Rand index (Rand, [28]) measures this pairwise agreement, while the adjusted Rand index removes the amount of agreement that would be expected by chance given the cluster sizes. Thus an ARI of 0 means agreement at the chance level, rather than that the two partitions agree on no pairs; a negative ARI indicates agreement below the chance level.
We compare the experimental accuracy Acc (15) and the Adjusted Rand Index, ARI (16), of our -midranks procedure using the distance (denoted KMR.L1 in the tables and figures below) and the squared-Euclidean loss (KMR.L2) with those of -means (Kmeans), -medoids (Kmed), Gaussian mixture models (Gauss), Student’s mixture models (t), Cauchy mixture models (Cauchy), and generalized hyperbolic mixture models (G-Hpbl) across datasets from the four classes mentioned earlier. -medians is not included in our experiment since it is closely related to the -medoids.
We conduct experiments on four classes of synthetic datasets consisting of clusters whose labels are withheld. Data is initially generated independently via the standard normal distribution. The datasets are categorized into four classes according to the type of contamination introduced.
In more detail, in the first three classes we create clusters, each containing 1000 individuals, by initially generating feature vectors of length for each individual having independent standard normal entries.
Class 1 result discussion
Class 1: Clusters are created from the initial configuration by adding independent normal random variables in coordinates and with mean and standard deviation 1.
Class 2 result discussion
Class 2: We proceed as for Class 1, but using the Student’s distribution with location parameter and 3 degrees of freedom.
Class 3: As for Class 1, but the shifts follow a Cauchy distribution with location parameter and scale parameter 0.3.
Class 4: We generate data as for Class 3, but for clusters of different sizes, with clusters that contain 1000 individuals, and clusters that contain 2000 individuals, for a total of clusters. In addition, we perform the Cauchy shifts as for Class 3, with the number of shifted coordinates independently taking values in for each group of clusters.
All tables and figures presenting the results are collected in Appendix § 9. The results are discussed separately for each data class in the subsections below.
Class 1 examines the performance cost of replacing numerical magnitudes by ranks when the data are Gaussian. As shown in Table 1 and Figure 2 and Figure 3, the Gaussian mixture model performs best according to both accuracy and ARI in 13 of the 16 settings. Other mixture models perform best in the remaining three settings, and -means generally performs nearly as well as the best-performing method.
| Kmeans | Kmed | KMR.L1 | KMR.L2 | ||||||||
| K | n | p | sepp | Acc | ARI | Acc | ARI | Acc | ARI | Acc | ARI |
| 2 | 2000 | 4 | 1.5 | 0.899 | 0.637 | 0.882 | 0.583 | 0.877 | 0.57 | 0.872 | 0.552 |
| 3 | 3000 | 6 | 1.5 | 0.819 | 0.53 | 0.792 | 0.472 | 0.788 | 0.465 | 0.776 | 0.44 |
| 4 | 4000 | 8 | 1.5 | 0.802 | 0.542 | 0.756 | 0.453 | 0.755 | 0.453 | 0.736 | 0.419 |
| 5 | 5000 | 10 | 1.5 | 0.757 | 0.484 | 0.659 | 0.329 | 0.653 | 0.325 | 0.659 | 0.33 |
| 6 | 6000 | 12 | 1.5 | 0.734 | 0.463 | 0.582 | 0.255 | 0.622 | 0.299 | 0.626 | 0.304 |
| 7 | 7000 | 14 | 1.5 | 0.7 | 0.422 | 0.533 | 0.216 | 0.448 | 0.149 | 0.581 | 0.263 |
| 8 | 8000 | 16 | 1.5 | 0.688 | 0.414 | 0.482 | 0.178 | 0.33 | 0.101 | 0.556 | 0.244 |
| 9 | 9000 | 18 | 1.5 | 0.672 | 0.397 | 0.349 | 0.106 | 0.363 | 0.099 | 0.529 | 0.223 |
| 2 | 2000 | 4 | 2 | 0.95 | 0.808 | 0.947 | 0.799 | 0.945 | 0.792 | 0.941 | 0.778 |
| 3 | 3000 | 6 | 2 | 0.913 | 0.756 | 0.9 | 0.722 | 0.896 | 0.711 | 0.885 | 0.686 |
| 4 | 4000 | 8 | 2 | 0.89 | 0.729 | 0.874 | 0.692 | 0.867 | 0.677 | 0.855 | 0.649 |
| 5 | 5000 | 10 | 2 | 0.877 | 0.717 | 0.835 | 0.628 | 0.832 | 0.623 | 0.815 | 0.591 |
| 6 | 6000 | 12 | 2 | 0.856 | 0.684 | 0.784 | 0.546 | 0.794 | 0.567 | 0.778 | 0.537 |
| 7 | 7000 | 14 | 2 | 0.846 | 0.673 | 0.753 | 0.497 | 0.772 | 0.539 | 0.758 | 0.515 |
| 8 | 8000 | 16 | 2 | 0.83 | 0.649 | 0.714 | 0.449 | 0.738 | 0.491 | 0.734 | 0.485 |
| 9 | 9000 | 18 | 2 | 0.814 | 0.625 | 0.66 | 0.372 | 0.664 | 0.392 | 0.707 | 0.45 |
| Gauss | t | Cauchy | G-Hpbl | ||||||||
| K | n | p | sepp | Acc | ARI | Acc | ARI | Acc | ARI | Acc | ARI |
| 2 | 2000 | 4 | 1.5 | 0.903 | 0.651 | 0.902 | 0.648 | 0.902 | 0.646 | 0.905 | 0.658 |
| 3 | 3000 | 6 | 1.5 | 0.835 | 0.567 | 0.829 | 0.553 | 0.828 | 0.551 | 0.831 | 0.558 |
| 4 | 4000 | 8 | 1.5 | 0.811 | 0.559 | 0.805 | 0.546 | 0.803 | 0.544 | 0.805 | 0.548 |
| 5 | 5000 | 10 | 1.5 | 0.770 | 0.507 | 0.765 | 0.497 | 0.762 | 0.492 | 0.764 | 0.495 |
| 6 | 6000 | 12 | 1.5 | 0.747 | 0.485 | 0.734 | 0.462 | 0.731 | 0.458 | 0.731 | 0.457 |
| 7 | 7000 | 14 | 1.5 | 0.715 | 0.446 | 0.601 | 0.353 | 0.692 | 0.410 | 0.686 | 0.401 |
| 8 | 8000 | 16 | 1.5 | 0.704 | 0.437 | 0.584 | 0.327 | 0.669 | 0.387 | 0.673 | 0.391 |
| 9 | 9000 | 18 | 1.5 | 0.687 | 0.417 | 0.630 | 0.339 | 0.639 | 0.352 | 0.635 | 0.347 |
| 2 | 2000 | 4 | 2 | 0.956 | 0.832 | 0.952 | 0.817 | 0.954 | 0.823 | 0.953 | 0.821 |
| 3 | 3000 | 6 | 2 | 0.915 | 0.762 | 0.916 | 0.764 | 0.913 | 0.757 | 0.917 | 0.766 |
| 4 | 4000 | 8 | 2 | 0.892 | 0.733 | 0.890 | 0.729 | 0.894 | 0.738 | 0.891 | 0.731 |
| 5 | 5000 | 10 | 2 | 0.880 | 0.722 | 0.876 | 0.713 | 0.872 | 0.705 | 0.876 | 0.712 |
| 6 | 6000 | 12 | 2 | 0.862 | 0.696 | 0.854 | 0.680 | 0.851 | 0.673 | 0.853 | 0.677 |
| 7 | 7000 | 14 | 2 | 0.852 | 0.685 | 0.844 | 0.669 | 0.841 | 0.663 | 0.843 | 0.667 |
| 8 | 8000 | 16 | 2 | 0.839 | 0.665 | 0.825 | 0.640 | 0.823 | 0.635 | 0.826 | 0.641 |
| 9 | 9000 | 18 | 2 | 0.826 | 0.647 | 0.717 | 0.540 | 0.810 | 0.618 | 0.807 | 0.612 |
Table 1. Class 1: Gaussian data. Accuracy and ARI for each dataset in this class. The highest Accuracy and ARI values in each row are shown in bold. Here, K is the number of clusters, n is the total sample size, p is the number of variables, and sepp is the separation parameter. The same notation applies to Classes 2 and 3.

Figure 2. Class 1: Comparison of ARI values for to under separations of 1.5 (left) and 2 (right).

Figure 3. Class 1: Comparison of ACC values for to under separations of 1.5 (left) and 2 (right).
The performance disadvantage of -midranks varies considerably across settings. At and separation 2, the accuracies of its and squared-Euclidean versions are 0.945 and 0.941, compared with 0.956 for the Gaussian mixture model. At and separation 1.5, however, the corresponding accuracies are 0.363 and 0.529, compared with 0.687 for the Gaussian mixture model; the ARIs are 0.099 and 0.223, compared with 0.417.
Thus, on these Gaussian data, -midranks performs worse than Gaussian mixture clustering and -means. The difference is small in some settings with few clusters and larger separation, but can be substantial in the larger, lower-separation configurations.
Class 2 uses Student’s shifts with three degrees of freedom. Table 2 and Figure 4 and Figure 5 show that the best-performing mixture models outperform both -midranks versions in every displayed setting. -means also usually outperforms both versions. The Cauchy mixture most often performs best at separation 1.5, while Gaussian and Student’s mixtures frequently perform best at separation 2. Not every mixture model outperforms every representative-based method. For example, at and separation 2, the Gaussian mixture performs worse than -means on both measures: its accuracy and ARI are 0.623 and 0.433, compared with 0.882 and 0.677 for -means. The Student’s mixture performs better than both, with accuracy 0.911 and ARI 0.751. The performance disadvantage of -midranks can also be substantial: at and separation 1.5, its and squared-Euclidean ARIs are 0.058 and 0.190, compared with 0.374 for -means and 0.397 for the Cauchy mixture.
| K | n | p | sepp | Kmeans Acc | Kmeans ARI | Kmed Acc | Kmed ARI | KMR.L1 Acc | KMR.L1 ARI | KMR.L2 Acc | KMR.L2 ARI |
| 2 | 2000 | 4 | 1.5 | 0.853 | 0.498 | 0.849 | 0.487 | 0.857 | 0.51 | 0.846 | 0.477 |
| 3 | 3000 | 6 | 1.5 | 0.778 | 0.445 | 0.759 | 0.406 | 0.758 | 0.406 | 0.735 | 0.364 |
| 4 | 4000 | 8 | 1.5 | 0.75 | 0.444 | 0.726 | 0.4 | 0.702 | 0.363 | 0.684 | 0.335 |
| 5 | 5000 | 10 | 1.5 | 0.723 | 0.427 | 0.661 | 0.322 | 0.646 | 0.312 | 0.622 | 0.279 |
| 6 | 6000 | 12 | 1.5 | 0.703 | 0.413 | 0.626 | 0.296 | 0.583 | 0.252 | 0.594 | 0.263 |
| 7 | 7000 | 14 | 1.5 | 0.681 | 0.393 | 0.535 | 0.212 | 0.457 | 0.148 | 0.557 | 0.234 |
| 8 | 8000 | 16 | 1.5 | 0.664 | 0.38 | 0.457 | 0.157 | 0.316 | 0.075 | 0.507 | 0.192 |
| 9 | 9000 | 18 | 1.5 | 0.655 | 0.374 | 0.316 | 0.088 | 0.275 | 0.058 | 0.497 | 0.19 |
| 2 | 2000 | 4 | 2 | 0.915 | 0.689 | 0.913 | 0.682 | 0.915 | 0.689 | 0.913 | 0.684 |
| 3 | 3000 | 6 | 2 | 0.882 | 0.677 | 0.878 | 0.666 | 0.866 | 0.638 | 0.852 | 0.606 |
| 4 | 4000 | 8 | 2 | 0.86 | 0.661 | 0.807 | 0.541 | 0.834 | 0.606 | 0.82 | 0.577 |
| 5 | 5000 | 10 | 2 | 0.831 | 0.622 | 0.793 | 0.544 | 0.799 | 0.561 | 0.773 | 0.513 |
| 6 | 6000 | 12 | 2 | 0.817 | 0.607 | 0.753 | 0.491 | 0.759 | 0.506 | 0.732 | 0.461 |
| 7 | 7000 | 14 | 2 | 0.805 | 0.597 | 0.723 | 0.461 | 0.722 | 0.457 | 0.71 | 0.438 |
| 8 | 8000 | 16 | 2 | 0.789 | 0.575 | 0.632 | 0.328 | 0.684 | 0.41 | 0.684 | 0.408 |
| 9 | 9000 | 18 | 2 | 0.778 | 0.562 | 0.615 | 0.298 | 0.592 | 0.297 | 0.658 | 0.379 |
| K | n | p | sepp | Gauss Acc | Gauss ARI | t Acc | t ARI | Cauchy Acc | Cauchy ARI | G-Hpbl Acc | G-Hpbl ARI |
| 2 | 2000 | 4 | 1.5 | 0.867 | 0.539 | 0.879 | 0.576 | 0.886 | 0.597 | 0.874 | 0.559 |
| 3 | 3000 | 6 | 1.5 | 0.821 | 0.535 | 0.827 | 0.548 | 0.831 | 0.557 | 0.821 | 0.535 |
| 4 | 4000 | 8 | 1.5 | 0.800 | 0.538 | 0.790 | 0.517 | 0.800 | 0.537 | 0.787 | 0.511 |
| 5 | 5000 | 10 | 1.5 | 0.624 | 0.391 | 0.758 | 0.485 | 0.765 | 0.499 | 0.758 | 0.486 |
| 6 | 6000 | 12 | 1.5 | 0.742 | 0.476 | 0.734 | 0.462 | 0.735 | 0.464 | 0.733 | 0.460 |
| 7 | 7000 | 14 | 1.5 | 0.618 | 0.370 | 0.698 | 0.417 | 0.700 | 0.422 | 0.693 | 0.410 |
| 8 | 8000 | 16 | 1.5 | 0.698 | 0.428 | 0.676 | 0.396 | 0.608 | 0.366 | 0.673 | 0.392 |
| 9 | 9000 | 18 | 1.5 | 0.637 | 0.320 | 0.668 | 0.391 | 0.671 | 0.397 | 0.666 | 0.388 |
| 2 | 2000 | 4 | 2 | 0.936 | 0.762 | 0.935 | 0.757 | 0.936 | 0.762 | 0.936 | 0.760 |
| 3 | 3000 | 6 | 2 | 0.623 | 0.433 | 0.911 | 0.751 | 0.909 | 0.746 | 0.911 | 0.750 |
| 4 | 4000 | 8 | 2 | 0.885 | 0.716 | 0.886 | 0.718 | 0.885 | 0.716 | 0.883 | 0.713 |
| 5 | 5000 | 10 | 2 | 0.870 | 0.701 | 0.694 | 0.539 | 0.862 | 0.684 | 0.861 | 0.683 |
| 6 | 6000 | 12 | 2 | 0.846 | 0.665 | 0.845 | 0.661 | 0.844 | 0.661 | 0.843 | 0.658 |
| 7 | 7000 | 14 | 2 | 0.722 | 0.555 | 0.831 | 0.644 | 0.832 | 0.646 | 0.830 | 0.643 |
| 8 | 8000 | 16 | 2 | 0.824 | 0.638 | 0.812 | 0.616 | 0.817 | 0.624 | 0.811 | 0.615 |
| 9 | 9000 | 18 | 2 | 0.816 | 0.628 | 0.694 | 0.520 | 0.800 | 0.601 | 0.797 | 0.596 |
Table 2. Table 2 Class 2: Gaussian data with simple Student’s t shifts. Accuracy and ARI for each dataset in this class. The highest Accuracy and ARI values in each row are shown in bold.

Figure 4. Class 2: Comparison of ARI values for to under separations of 1.5 (left) and 2 (right).

Figure 5. Class 2: Comparison of ACC values for to under separations of 1.5 (left) and 2 (right).
These results show that the presence of heavy tails alone does not ensure an advantage for rank-based clustering. In the Student’s -shifted settings considered here, retaining the numerical magnitudes gives better results for the leading mixture models and, in most settings, for -means.
Class 3 result discussion
Replacing the Student’s shifts by Cauchy shifts changes the comparison markedly. Table 3 and Figure 6 and Figure 7 show that, among methods with reported results, one of the two -midranks versions performs best according to both accuracy and ARI in each of the 14 settings with . At , the generalized hyperbolic mixture performs best at separation 1.5, whereas the Cauchy mixture performs best at separation 2.
| Kmeans | Kmed | KMR.L1 | KMR.L2 | ||||||||
| K | n | p | loc | Acc | ARI | Acc | ARI | Acc | ARI | Acc | ARI |
| 2 | 2000 | 4 | 1.5 | 0.5 | 0 | 0.5 | 0 | 0.892 | 0.616 | 0.892 | 0.614 |
| 3 | 3000 | 6 | 1.5 | 0.334 | 0 | 0.334 | 0 | 0.820 | 0.533 | 0.805 | 0.501 |
| 4 | 4000 | 8 | 1.5 | 0.251 | 0 | 0.416 | 0.141 | 0.755 | 0.453 | 0.741 | 0.429 |
| 5 | 5000 | 10 | 1.5 | 0.201 | 0 | 0.457 | 0.193 | 0.712 | 0.411 | 0.701 | 0.393 |
| 6 | 6000 | 12 | 1.5 | 0.167 | 0 | 0.316 | 0.070 | 0.643 | 0.329 | 0.649 | 0.335 |
| 7 | 7000 | 14 | 1.5 | 0.143 | 0 | 0.194 | 0.014 | 0.459 | 0.175 | 0.615 | 0.304 |
| 8 | 8000 | 16 | 1.5 | 0.276 | 0.110 | 0.458 | 0.190 | 0.380 | 0.127 | 0.589 | 0.282 |
| 9 | 9000 | 18 | 1.5 | 0.171 | 0.044 | 0.223 | 0.054 | 0.294 | 0.081 | 0.566 | 0.263 |
| 2 | 2000 | 4 | 2 | 0.5 | 0 | 0.919 | 0.702 | 0.951 | 0.812 | 0.949 | 0.805 |
| 3 | 3000 | 6 | 2 | 0.334 | 0 | 0.604 | 0.350 | 0.912 | 0.754 | 0.899 | 0.721 |
| 4 | 4000 | 8 | 2 | 0.250 | 0 | 0.448 | 0.205 | 0.872 | 0.688 | 0.860 | 0.661 |
| 5 | 5000 | 10 | 2 | 0.201 | 0 | 0.201 | 0 | 0.841 | 0.641 | 0.830 | 0.621 |
| 6 | 6000 | 12 | 2 | 0.289 | 0.147 | 0.661 | 0.399 | 0.813 | 0.601 | 0.797 | 0.572 |
| 7 | 7000 | 14 | 2 | 0.345 | 0.225 | 0.554 | 0.314 | 0.778 | 0.550 | 0.770 | 0.535 |
| 8 | 8000 | 16 | 2 | 0.299 | 0.143 | 0.357 | 0.142 | 0.768 | 0.540 | 0.760 | 0.527 |
| 9 | 9000 | 18 | 2 | 0.260 | 0.148 | 0.537 | 0.297 | 0.710 | 0.456 | 0.730 | 0.484 |
| Gauss | t | Cauchy | G-Hpbl | ||||||||
| K | n | p | loc | Acc | ARI | Acc | ARI | Acc | ARI | Acc | ARI |
| 2 | 2000 | 4 | 1.5 | 0.505 | 0 | 0.874 | 0.559 | 0.5 | 0 | 0.901 | 0.643 |
| 3 | 3000 | 6 | 1.5 | 0.35 | 0.001 | 0.355 | 0.002 | 0.334 | 0 | 0.367 | 0.003 |
| 4 | 4000 | 8 | 1.5 | 0.289 | 0.003 | 0.288 | 0.003 | 0.251 | 0 | 0.299 | 0.005 |
| 5 | 5000 | 10 | 1.5 | 0.445 | 0.237 | 0.359 | 0.176 | 0.362 | 0.216 | DNC | DNC |
| 6 | 6000 | 12 | 1.5 | 0.377 | 0.218 | 0.304 | 0.117 | 0.287 | 0.16 | DNC | DNC |
| 7 | 7000 | 14 | 1.5 | 0.339 | 0.183 | 0.264 | 0.086 | 0.143 | 0 | DNC | DNC |
| 8 | 8000 | 16 | 1.5 | 0.245 | 0.082 | 0.301 | 0.175 | 0.294 | 0.185 | 0.422 | 0.227 |
| 9 | 9000 | 18 | 1.5 | 0.244 | 0.025 | 0.218 | 0.087 | 0.182 | 0.056 | 0.322 | 0.162 |
| 2 | 2000 | 4 | 2 | 0.509 | 0 | 0.935 | 0.757 | 0.96 | 0.844 | 0.939 | 0.771 |
| 3 | 3000 | 6 | 2 | 0.617 | 0.424 | 0.885 | 0.684 | 0.334 | 0 | DNC | DNC |
| 4 | 4000 | 8 | 2 | 0.478 | 0.356 | 0.493 | 0.237 | 0.251 | 0 | DNC | DNC |
| 5 | 5000 | 10 | 2 | 0.534 | 0.344 | 0.378 | 0.251 | 0.202 | 0 | 0.701 | 0.547 |
| 6 | 6000 | 12 | 2 | 0.578 | 0.395 | 0.454 | 0.322 | 0.457 | 0.35 | 0.467 | 0.373 |
| 7 | 7000 | 14 | 2 | 0.392 | 0.231 | 0.39 | 0.295 | 0.496 | 0.372 | 0.499 | 0.401 |
| 8 | 8000 | 16 | 2 | 0.636 | 0.451 | 0.446 | 0.386 | 0.436 | 0.364 | DNC | DNC |
| 9 | 9000 | 18 | 2 | 0.719 | 0.482 | 0.386 | 0.309 | 0.546 | 0.41 | DNC | DNC |
Table 3. Class 3: Gaussian data with simple Cauchy shifts. Accuracy and ARI for each dataset in this class. The highest Accuracy and ARI values in each row are shown in bold. Note: DNC denotes “did not converge” throughout the paper.

Figure 6. Class 3: Comparison of ARI values for to under separations of 1.5 (left) and 2 (right).

Figure 7. Class 3: Comparison of ACC values for to under separations of 1.5 (left) and 2 (right).
The choice of loss matters. At separation 1.5, the version performs better than the squared-Euclidean version according to ARI for , while the squared-Euclidean version performs better according to both accuracy and ARI for . At , for example, the accuracies of the and squared-Euclidean versions are 0.294 and 0.566, and their ARIs are 0.081 and 0.263, respectively. At separation 2, the version performs better on both measures through , with the squared-Euclidean version performing better at . Thus a performance advantage for one -midranks version does not imply that both versions outperform all competitors.
The effect of separation on the performance advantage over competitors depends on the setting and the performance measure. At and separation 2, squared-Euclidean -midranks performs only slightly better than the Gaussian mixture: their accuracies are 0.730 and 0.719, and their ARIs are 0.484 and 0.482. The generalized hyperbolic mixture is reported as not converging in seven settings, so comparisons in those settings are limited to methods with reported results.
In these experiments, Cauchy shifts provide a clear setting in which rank transformation improves clustering performance. Neither loss is uniformly preferable, and the squared-Euclidean version is particularly advantageous in the larger-, lower-separation configurations.
Class 4 result discussion
Class 4 combines Cauchy shifts with unequal cluster sizes and heterogeneous shift configurations. Table 4 reports 18 settings, and Figure 8 displays their results ordered by decreasing ARI for -midranks. The squared-Euclidean version of -midranks outperforms every non--midranks competitor with reported results on both accuracy and ARI in all 18 settings; the version does so in 17. In the direct comparison between the two rank-based versions, performs better on both measures in ten settings, while squared Euclidean performs better in seven. They tie in one setting at the reported precision.
| Class 4: Gaussian data with mixed Cauchy shifts, varying cluster sizes and densities. Accuracy and ARI for each dataset in this class. The highest Accuracy and ARI values in each row are shown in bold. Here, and denote the numbers of clusters in the two groups, and their respective total sample sizes, and the numbers of shifted coordinates for the clusters in groups and , respectively, and and the corresponding separation parameters. Other notation follows Table 1. | |||||||||||||||
| Kmeans Acc | Kmeans ARI | Kmed Acc | Kmed ARI | KMR.L1 Acc | KMR.L1 ARI | KMR.L2 Acc | KMR.L2 ARI | ||||||||
| 2 | 2 | 2000 | 4000 | 3 | 3 | 1.5 | 1.5 | 0.573 | 0.219 | 0.657 | 0.353 | 0.818 | 0.584 | 0.804 | 0.559 |
| 2 | 3 | 2000 | 6000 | 2 | 3 | 1.5 | 1.5 | 0.25 | 0 | 0.646 | 0.366 | 0.768 | 0.530 | 0.759 | 0.513 |
| 2 | 4 | 2000 | 8000 | 2 | 3 | 1.5 | 1.5 | 0.2 | 0 | 0.47 | 0.192 | 0.742 | 0.501 | 0.733 | 0.483 |
| 3 | 2 | 3000 | 4000 | 2 | 2 | 1.5 | 1.5 | 0.286 | 0 | 0.458 | 0.121 | 0.680 | 0.370 | 0.680 | 0.370 |
| 3 | 3 | 3000 | 6000 | 3 | 2 | 1.5 | 1.5 | 0.223 | 0 | 0.341 | 0.082 | 0.690 | 0.391 | 0.674 | 0.369 |
| 3 | 4 | 3000 | 8000 | 2 | 2 | 1.5 | 1.5 | 0.182 | 0 | 0.417 | 0.148 | 0.502 | 0.225 | 0.613 | 0.311 |
| 4 | 2 | 4000 | 4000 | 2 | 2 | 1.5 | 1.5 | 0.251 | 0 | 0.414 | 0.132 | 0.624 | 0.316 | 0.626 | 0.318 |
| 4 | 3 | 4000 | 6000 | 3 | 2 | 1.5 | 1.5 | 0.323 | 0.098 | 0.328 | 0.086 | 0.662 | 0.363 | 0.644 | 0.340 |
| 4 | 4 | 4000 | 8000 | 3 | 2 | 1.5 | 1.5 | 0.167 | 0 | 0.278 | 0.059 | 0.536 | 0.231 | 0.615 | 0.313 |
| 2 | 2 | 2000 | 4000 | 2 | 3 | 1.5 | 2 | 0.333 | 0 | 0.721 | 0.537 | 0.872 | 0.725 | 0.859 | 0.697 |
| 2 | 3 | 2000 | 6000 | 2 | 2 | 1.5 | 2 | 0.25 | 0 | 0.635 | 0.353 | 0.771 | 0.546 | 0.785 | 0.564 |
| 2 | 4 | 2000 | 8000 | 2 | 2 | 1.5 | 2 | 0.2 | 0 | 0.357 | 0.117 | 0.759 | 0.537 | 0.767 | 0.544 |
| 3 | 2 | 3000 | 4000 | 2 | 2 | 1.5 | 2 | 0.286 | 0 | 0.517 | 0.216 | 0.750 | 0.509 | 0.748 | 0.504 |
| 3 | 3 | 3000 | 6000 | 3 | 3 | 1.5 | 2 | 0.403 | 0.133 | 0.538 | 0.265 | 0.851 | 0.702 | 0.831 | 0.668 |
| 3 | 4 | 3000 | 8000 | 2 | 2 | 1.5 | 2 | 0.183 | 0 | 0.582 | 0.327 | 0.626 | 0.406 | 0.717 | 0.487 |
| 4 | 2 | 4000 | 4000 | 2 | 3 | 1.5 | 2 | 0.41 | 0.071 | 0.527 | 0.308 | 0.770 | 0.589 | 0.763 | 0.576 |
| 4 | 3 | 4000 | 6000 | 2 | 3 | 1.5 | 2 | 0.346 | 0.075 | 0.435 | 0.215 | 0.761 | 0.594 | 0.769 | 0.595 |
| 4 | 4 | 4000 | 8000 | 3 | 2 | 1.5 | 2 | 0.167 | 0 | 0.336 | 0.118 | 0.719 | 0.480 | 0.713 | 0.468 |
| Gauss Acc | Gauss ARI | Acc | ARI | Cauchy Acc | Cauchy ARI | G-Hpbl Acc | G-Hpbl ARI | ||||||||
| 2 | 2 | 2000 | 4000 | 3 | 3 | 1.5 | 1.5 | 0.474 | 0.297 | 0.448 | 0.216 | 0.626 | 0.359 | DNC | DNC |
| 2 | 3 | 2000 | 6000 | 2 | 3 | 1.5 | 1.5 | 0.452 | 0.27 | 0.46 | 0.27 | 0.287 | -0.007 | 0.468 | 0.241 |
| 2 | 4 | 2000 | 8000 | 2 | 3 | 1.5 | 1.5 | 0.572 | 0.412 | 0.38 | 0.22 | 0.202 | 0 | DNC | DNC |
| 3 | 2 | 3000 | 4000 | 2 | 2 | 1.5 | 1.5 | 0.459 | 0.094 | 0.481 | 0.214 | 0.323 | -0.005 | DNC | DNC |
| 3 | 3 | 3000 | 6000 | 3 | 2 | 1.5 | 1.5 | 0.427 | 0.202 | 0.334 | 0.131 | 0.223 | 0 | DNC | DNC |
| 3 | 4 | 3000 | 8000 | 2 | 2 | 1.5 | 1.5 | 0.318 | 0.048 | 0.431 | 0.218 | 0.19 | 0.001 | 0.243 | 0 |
| 4 | 2 | 4000 | 4000 | 2 | 2 | 1.5 | 1.5 | 0.325 | 0.062 | 0.427 | 0.157 | 0.251 | 0 | 0.334 | 0.159 |
| 4 | 3 | 4000 | 6000 | 3 | 2 | 1.5 | 1.5 | 0.373 | 0.112 | 0.29 | 0.135 | 0.311 | 0.113 | 0.355 | 0.09 |
| 4 | 4 | 4000 | 8000 | 3 | 2 | 1.5 | 1.5 | 0.292 | 0.028 | 0.397 | 0.207 | 0.175 | 0.001 | DNC | DNC |
| 2 | 2 | 2000 | 4000 | 2 | 3 | 1.5 | 2 | 0.61 | 0.381 | 0.617 | 0.41 | 0.652 | 0.425 | 0.607 | 0.379 |
| 2 | 3 | 2000 | 6000 | 2 | 2 | 1.5 | 2 | 0.675 | 0.477 | 0.647 | 0.441 | 0.469 | 0.314 | DNC | DNC |
| 2 | 4 | 2000 | 8000 | 2 | 2 | 1.5 | 2 | 0.539 | 0.379 | 0.528 | 0.379 | 0.222 | -0.001 | DNC | DNC |
| 3 | 2 | 3000 | 4000 | 2 | 2 | 1.5 | 2 | 0.402 | 0.265 | 0.516 | 0.284 | 0.286 | 0 | DNC | DNC |
| 3 | 3 | 3000 | 6000 | 3 | 3 | 1.5 | 2 | 0.687 | 0.504 | 0.52 | 0.436 | 0.474 | 0.197 | 0.618 | 0.447 |
| 3 | 4 | 3000 | 8000 | 2 | 2 | 1.5 | 2 | 0.642 | 0.454 | 0.353 | 0.194 | 0.341 | 0.205 | 0.622 | 0.435 |
| 4 | 2 | 4000 | 4000 | 2 | 3 | 1.5 | 2 | 0.562 | 0.421 | 0.472 | 0.249 | 0.489 | 0.263 | DNC | DNC |
| 4 | 3 | 4000 | 6000 | 2 | 3 | 1.5 | 2 | 0.634 | 0.51 | 0.548 | 0.34 | 0.576 | 0.399 | DNC | DNC |
| 4 | 4 | 4000 | 8000 | 3 | 2 | 1.5 | 2 | 0.533 | 0.347 | 0.45 | 0.299 | 0.167 | 0 | DNC | DNC |
Table 4.

Figure 8. Class 4: ARI and ACC comparison ordered by the ARI values of -midranks from largest to smallest.
The size of the performance advantage varies. For example, with , , and separation parameters 1.5 and 2, squared-Euclidean -midranks performs better than the Gaussian mixture on both measures: its accuracy and ARI are 0.717 and 0.487, compared with 0.642 and 0.454 for the Gaussian mixture. In this setting, however, the version performs worse than the Gaussian mixture, with accuracy 0.626 and ARI 0.406. The generalized hyperbolic mixture is reported as not converging in eleven settings. Our comparisons concern the displayed settings and the results available for them.
Thus both versions of -midranks generally outperform the other clustering methods in these experiments with unequal cluster sizes and heterogeneous Cauchy shifts. Although the version more often performs better in the direct comparison between the two rank-based versions, the squared-Euclidean version outperforms all non--midranks competitors with reported results in every displayed setting.
Sensitivity analysis
We assess the sensitivity of the -midranks algorithm to initialization using heavy-tailed datasets from Class 3, the setting for which the algorithm was designed. For each dataset (, 5, or 9), we run the algorithm 30 times with different random initializations. Table 5 reports the mean, standard deviation (SD), minimum, and maximum of both clustering accuracy and the adjusted Rand index (ARI) across the 30 runs. For -midranks, the results are relatively stable across initializations for and at both separations. However, greater variability is observed for , particularly at a separation of 1.5, where the mean accuracy is 0.322 (SD 0.024) and the mean ARI is 0.092 (SD 0.010). At a separation of 2, the mean accuracy increases to 0.723 (SD 0.039), while the mean ARI increases to 0.480 (SD 0.040). In comparison, squared-Euclidean -midranks exhibits smaller variability at a separation of 2, with SDs of 0.001 for both accuracy and ARI when .
| Loss | K | n | p | loc | Accuracy Max | Accuracy Mean | Accuracy SD | Accuracy Min | ARI Max | ARI Mean | ARI sd | ARI Min |
| 1 | 2 | 2000 | 4 | 1.5 | 0.89 | 0.889 | 0.002 | 0.886 | 0.61 | 0.605 | 0.006 | 0.596 |
| 1 | 2 | 2000 | 4 | 2 | 0.951 | 0.95 | <0.001 | 0.95 | 0.812 | 0.811 | 0.001 | 0.81 |
| 1 | 5 | 5000 | 10 | 1.5 | 0.707 | 0.703 | 0.002 | 0.697 | 0.403 | 0.396 | 0.004 | 0.386 |
| 1 | 5 | 5000 | 10 | 2 | 0.839 | 0.839 | <0.001 | 0.838 | 0.638 | 0.637 | 0.001 | 0.635 |
| 1 | 9 | 9000 | 18 | 1.5 | 0.377 | 0.322 | 0.024 | 0.278 | 0.12 | 0.092 | 0.01 | 0.076 |
| 1 | 9 | 9000 | 18 | 2 | 0.741 | 0.723 | 0.039 | 0.57 | 0.503 | 0.48 | 0.04 | 0.331 |
| 2 | 2 | 2000 | 4 | 1.5 | 0.888 | 0.885 | 0.001 | 0.884 | 0.602 | 0.594 | 0.005 | 0.59 |
| 2 | 2 | 2000 | 4 | 2 | 0.95 | 0.95 | <0.001 | 0.95 | 0.808 | 0.808 | <0.001 | 0.808 |
| 2 | 5 | 5000 | 10 | 1.5 | 0.694 | 0.691 | 0.001 | 0.688 | 0.382 | 0.377 | 0.002 | 0.373 |
| 2 | 5 | 5000 | 10 | 2 | 0.827 | 0.826 | <0.001 | 0.825 | 0.615 | 0.612 | 0.001 | 0.61 |
| 2 | 9 | 9000 | 18 | 1.5 | 0.57 | 0.556 | 0.034 | 0.403 | 0.268 | 0.255 | 0.023 | 0.15 |
| 2 | 9 | 9000 | 18 | 2 | 0.739 | 0.737 | 0.001 | 0.735 | 0.499 | 0.496 | 0.001 | 0.493 |
Table 5. Sensitivity analysis. Maximum, mean, standard deviation (SD), and minimum values of Accuracy and ARI over 30 runs for each dataset, used to assess the sensitivity of the algorithm to different initializations. Dist denotes the loss function, with 1 representing loss and 2 representing squared-Euclidean loss.
Detecting the correct number of clusters
In practice, the true number of clusters will be unknown to the user. We investigate its selection using the classical elbow principle Thorndike [31].
For a fitted partition into clusters, , let
where is the representative of cluster . Thus is the total within-cluster dispersion for the -cluster solution, with smaller values corresponding to tighter clusters.
Following the one-step elbow index of Rykov et al. [29], define, for ,
The numerator measures the reduction in within-cluster dispersion obtained by increasing the number of clusters from to , whereas the denominator measures the additional reduction obtained by increasing it from to . Hence a value of substantially larger than 1 indicates that the reduction in within-cluster dispersion obtained by increasing the number of clusters from to is appreciably greater than the additional reduction obtained by increasing the number from to . This is precisely the flattening of the dispersion curve that the elbow method seeks to detect. We therefore select the value of for which is largest.
We report results for the datasets from Class 3 in Table 6, which reports the values of corresponding to the two largest values of . At a separation of 2, the criterion in (17) correctly identifies the true number of clusters in all settings using the distance. For the squared-Euclidean distance, the criterion correctly identifies for , but selects 2 when , with the true value 9 ranked second. For datasets with a separation of 1.5, however, it fails to identify the correct number of clusters when .
| loc | KMR.L1 First choice | KMR.L1 Second choice | KMR.L2 First choice | KMR.L2 Second choice | |||
| 2000 | 4 | 1.5 | 2 | 2 | 4 | 2 | 4 |
| 2000 | 4 | 2 | 2 | 2 | 3 | 2 | 3 |
| 3000 | 6 | 1.5 | 3 | 3 | 4 | 3 | 8 |
| 3000 | 6 | 2 | 3 | 3 | 10 | 3 | 6 |
| 4000 | 8 | 1.5 | 4 | 4 | 2 | 4 | 7 |
| 4000 | 8 | 2 | 4 | 4 | 10 | 4 | 8 |
| 5000 | 10 | 1.5 | 5 | 5 | 2 | 5 | 2 |
| 5000 | 10 | 2 | 5 | 5 | 8 | 5 | 2 |
| 6000 | 12 | 1.5 | 6 | 6 | 2 | 6 | 2 |
| 6000 | 12 | 2 | 6 | 6 | 2 | 6 | 2 |
| 7000 | 14 | 1.5 | 7 | 7 | 10 | 10 | 2 |
| 7000 | 14 | 2 | 7 | 7 | 2 | 7 | 2 |
| 8000 | 16 | 1.5 | 8 | 2 | 4 | 2 | 3 |
| 8000 | 16 | 2 | 8 | 8 | 2 | 8 | 2 |
| 9000 | 18 | 1.5 | 9 | 2 | 4 | 2 | 4 |
| 9000 | 18 | 2 | 9 | 9 | 2 | 2 | 9 |
Table 6. Detecting the number of clusters. For each , the table reports the values corresponding to the maximum and second maximum values for . The true numbers of clusters are shown in bold.
Run time
Table 7 gives runtimes for the Class 3 datasets, which we see are consistent with the theoretical computational complexity bound established in Proposition 4.4. The (scaled up by ) ratio of the runtimes to the complexity expression , from Proposition 4.4, appears to stabilize for the case around 13 for , and to 10 for , for squared Euclidean loss.
| \multicolumn{2}{c}{Runtime (s)} | \multicolumn{2}{c}{Iterations} | \multicolumn{2}{c}{Complexity} | \multicolumn{2}{c}{Scaled runtime ratio} | |||||||
| 2000 | 4 | 2 | 0.04 | 0.02 | 6 | 11 | 156807.2 | 236807.2 | 255.090 | 84.457 |
| 3000 | 6 | 3 | 0.03 | 0.02 | 20 | 10 | 1224114.6 | 684114.6 | 24.508 | 29.235 |
| 4000 | 8 | 4 | 0.07 | 0.04 | 27 | 14 | 3721409.6 | 2057409.6 | 18.810 | 19.442 |
| 5000 | 10 | 5 | 0.15 | 0.06 | 30 | 22 | 7925859.7 | 5925859.7 | 18.925 | 10.125 |
| 6000 | 12 | 6 | 0.97 | 0.17 | 118 | 35 | 51602365.1 | 15746365.1 | 18.798 | 10.796 |
| 7000 | 14 | 7 | 0.88 | 0.23 | 71 | 33 | 49573659.2 | 23505659.2 | 17.751 | 9.785 |
| 8000 | 16 | 8 | 1.14 | 0.52 | 86 | 60 | 89214361.2 | 62590361.2 | 12.778 | 8.308 |
| 9000 | 18 | 9 | 1.83 | 0.97 | 96 | 67 | 141443006.7 | 99161006.7 | 12.938 | 9.782 |
Table 7. Computational results for the Class 3 datasets. Subscripts 1 and 2 denote -midranks with the and squared Euclidean losses, respectively. For , is the observed runtime in seconds and is the number of iterations. We compute as given in the expression in the run-time bound of Proposition 4.4.
Figure 9 further illustrates this relationship. For both the and cases, we see that the observed runtimes exhibit an approximately linear relationship with the complexity expression given. Although deviations from the fitted lines are observed, particularly for the algorithm, the overall trends are consistent with the theoretical complexity bound over the ranges considered.

Figure 9. Observed runtimes versus the expression appearing in the theoretical computational complexity bound established in Proposition 4.4, for the and -midranks algorithms on the Class 3 datasets. Each point represents one dataset, and the dotted lines indicate fitted linear trends.
All experiments were conducted on a laptop equipped with an Intel Core Ultra 7 165H (1.40 GHz), 64 GB RAM, running Windows 11. The algorithms were implemented in R 4.4.1 using R packages ‘clue’, ‘cluster’, ‘factoextra’, ‘mclust’, ‘teigen’, and ‘MixGHD’ through RStudio. Our R package for -midranks, called ‘kmidrank’ is currently available at https://github.com/nwiroonsri/kmidranks.
Real-data analyses and substantive findings
In this section, we apply -midranks to three real-world datasets including Raman and LIBS spectroscopy, and S&P500 returns.
Before interpreting the clustering results, we examine whether the real datasets display distributional behavior for which a rank-based procedure may be advantageous. Figure 16 provides benchmarks from the simulated datasets, ranging from the approximately Gaussian behavior of Class 1 through the heavier-tailed Student’s setting of Class 2 to the Cauchy-based Classes 3 and 4. The corresponding Q–Q plots for the real datasets are shown in Figure 17. Several dimensions of the LIBS and S&P 500 data show substantial outward departures in both tails from the normal reference line, indicating the presence of observations far more extreme than would be expected under a Gaussian model. The Raman data also depart markedly from normality, although their Q–Q plots have a different shape, with pronounced changes in slope rather than the pattern observed in the Cauchy simulations. These diagnostics provide empirical motivation for applying a procedure which is robust to heavy tailed data.
Raman spectroscopy
Raman spectroscopy is a form of spectroscopy distinguished by its use of light scattered from a sample rather than light absorbed or emitted by it. A monochromatic beam, usually produced by a laser, is directed at the sample. Almost all of the scattered light has the same frequency as the incident beam, but a very small fraction emerges with a slightly different frequency because energy has been exchanged between the light and molecular vibrations. The resulting frequency changes, called Raman shifts, depend on the bonds and molecular structure of the substance and therefore produce a characteristic fingerprint. In this respect Raman spectroscopy is closely related to infrared spectroscopy, which also probes molecular vibrations, but infrared spectroscopy measures the absorption of radiation, whereas Raman spectroscopy measures these frequency shifts in scattered light. The two techniques consequently provide complementary information about molecular structure.
Because Raman measurements can be rapid and nondestructive, they are used in areas such as mineral identification, pharmaceutical analysis, and the monitoring of chemical and crystallization processes. For example, Raman spectra can distinguish different crystalline forms, or polymorphs, of the same pharmaceutical compound, which is important because different polymorphs of an active pharmaceutical ingredient can have different physical and therapeutic properties.
The dataset of Flanagan and Glavin [13] was assembled to address a practical limitation in pharmaceutical research: despite the extensive use of Raman spectroscopy in drug discovery and active pharmaceutical ingredient (API) development, relatively few large, high-quality Raman spectral libraries are openly available. The authors therefore collected spectra from 32 commercial chemical substances, primarily solvents and reagents used in API development. These substances were not chosen arbitrarily: only products that had been tested and successfully used in API-development work were included, where individual chemicals may serve, for instance, as solvents or reactants. The resulting dataset contains 3,510 spectra and was intended to provide reference data for spectral analysis.
Although the dataset was not created specifically for clustering, it provides a natural setting in which to study whether an unsupervised clustering method can recover chemically meaningful structure from Raman measurements alone. Spectra from the same substance should exhibit a common molecular signature, while spectra from different substances should in principle be distinguishable through differences in their Raman features. In our study the known identities of the 32 substances are withheld during clustering and used only afterward as external labels for evaluating how well the recovered groups correspond to the underlying chemical classes.
To reduce the original dimension from 3,276, we apply PCA and use the first 20 components, which explain about 0.999999 of the variance. Table 8 shows that -midranks with and , Gaussian and Cauchy mixture models are among the best performers, with accuracies of 0.829, 0.759, 0.789, and 0.681, and ARI values of 0.733, 0.698, 0.656, and 0.664, respectively. In comparison, -means achieves an accuracy of 0.499 and an ARI of 0.354, while -medoids achieves an accuracy of 0.569 and an ARI of 0.407. Student’s and generalized hyperbolic mixture models did not converge. Figure 10 shows all 32 groups on the first two principal components. We note the strong similarity between the true and clustering labels, reflecting the accuracy of 0.829 and the ARI of 0.733.
| Data | PCA | Kmeans Acc | Kmeans ARI | Kmed Acc | Kmed ARI | KMR.L1 Acc | KMR.L1 ARI | KMR.L2 Acc | KMR.L2 ARI | |||
| Raman | 3510 | 3276 | 32 | 20 | 0.499 | 0.354 | 0.569 | 0.407 | 0.829 | 0.733 | 0.759 | 0.698 |
| LIBs | 10000 | 39995 | 12 | 50 | 0.215 | 0.060 | 0.217 | 0.060 | 0.536 | 0.303 | 0.526 | 0.306 |
| S&P500 | 85 | 751 | 3 | NA | 0.565 | 0.286 | 0.635 | 0.359 | 0.906 | 0.752 | 0.929 | 0.802 |
| S&P500 | 215 | 751 | 5 | NA | 0.493 | 0.243 | 0.609 | 0.385 | 0.786 | 0.589 | 0.818 | 0.633 |
| S&P500 | 352 | 751 | 8 | NA | 0.537 | 0.311 | 0.514 | 0.289 | 0.691 | 0.507 | 0.664 | 0.463 |
| Data | PCA | Gauss Acc | Gauss ARI | Acc | ARI | Cauchy Acc | Cauchy ARI | G-Hpbl Acc | G-Hpbl ARI | |||
| Raman | 3510 | 3276 | 32 | 20 | 0.789 | 0.656 | DNC | DNC | 0.681 | 0.664 | DNC | DNC |
| LIBs | 10000 | 39995 | 12 | 50 | 0.479 | 0.281 | 0.470 | 0.297 | 0.417 | 0.252 | 0.504 | 0.343 |
| S&P500 | 85 | 751 | 3 | NA | 0.588 | 0.369 | DNC | DNC | DNC | DNC | DNC | DNC |
| S&P500 | 215 | 751 | 5 | NA | 0.698 | 0.398 | DNC | DNC | DNC | DNC | DNC | DNC |
| S&P500 | 352 | 751 | 8 | NA | 0.483 | 0.225 | DNC | DNC | DNC | DNC | DNC | DNC |
Table 8. Real-world data. Accuracy and ARI for each dataset. The highest Accuracy and ARI values in each row are shown in bold.

Figure 10. Projection of the true and -midranks clustering labels onto the first two principal components of the Raman spectroscopy dataset. Each color represents one group.
Figure 11 shows the frequencies of true and false detections for each of the 32 materials using -midranks with distance. These results reveal substantial variation in the ability of -midranks to distinguish different Raman spectra. Isobutylamine, Diethylamine, and Formic acid are perfectly detected, with all their observations assigned to their corresponding matched clusters. In contrast, 2,2-Dimethoxypropane, Dimethyl sulfoxide, and Dichloromethane have detection rates of only 0%, 21%, and 46.8%, respectively, thus appearing to be considerably more difficult for -midranks to distinguish. Interestingly, the poor detection of 2,2-Dimethoxypropane is highly systematic rather than being caused by assignments across several different materials. Among its 107 observations, 100 are grouped with tert-butyl methyl ether. This suggests that the two materials are difficult to distinguish using -midranks with distance, possibly because their Raman spectra exhibit similar rank patterns across the retained principal component scores.

Figure 11. Frequency of true and false detections for each of the 32 materials in the Raman spectroscopy dataset using -midranks with distance. Dark gray represents true detections, while light gray represents false detections. For each material, the detection percentage is calculated as the number of true detections divided by the total number of true and false detections for that material.
Laser-induced breakdown spectroscopy
Laser-induced breakdown spectroscopy (LIBS) is an emission spectroscopy technique used primarily to determine the elemental composition of a material. A short, high-powered laser pulse is focused onto a very small region of the sample, where the deposited energy vaporizes and ionizes a tiny amount of material and creates a short-lived plasma. The word “breakdown” in the name refers to this laser-induced transition to an ionized plasma. As the plasma cools, its atoms and ions emit light at characteristic wavelengths. Recording the intensities of these emission lines therefore produces a spectral signature from which the elements present in the material can be inferred.
LIBS is particularly useful when rapid measurements must be made directly on a material with little sample preparation, and it has consequently been used in applications including geological analysis and industrial materials identification ([22]). These applications naturally give rise to clustering and classification problems: samples having similar elemental compositions should tend to produce similar emission spectra, while distinct material classes should exhibit different spectral patterns.
The dataset of Képeš et al. [22] was created specifically as a benchmark for developing and evaluating LIBS classification and clustering methods. It contains spectra from 138 prepared geological samples belonging to 12 ore and geological material classes, numbered 1–12 in Table 9. The dataset is divided into training and test subsets. For our illustration we use only the training subset, which contains 100 specimens. We select the first 100 spectra from each specimen, resulting in 10,000 spectral observations. Each recorded spectrum consists of emission intensities measured over a large number of wavelengths and is therefore represented as a high-dimensional feature vector. The benchmark dataset was designed to provide a more realistic classification and clustering problem than simply distinguishing repeated measurements of the same specimen. Specifically, different physical samples belong to the same geological class, and additional mixing was used to introduce controlled within-class variation. Thus a successful method must identify the common spectral structure of a geological class rather than merely recognize a particular sample. In our unsupervised setting, the class labels are withheld from the clustering procedure and used afterward to assess whether the groups recovered from the LIBS spectra correspond to the known geological classes. There are 12 such classes, and we use in this analysis.
| Class | Geological material |
| 1 | U ore |
| 2 | Zn-Pb-Ag sulfide ore |
| 3 | Ni-Cu-PGE ore |
| 4 | Sn ore |
| 5 | Au-Cu ore |
| 6 | Mn ore |
| 7 | Gold oxide ore |
| 8 | Zinc sulfide ore |
| 9 | Hematite ore |
| 10 | Anomalous ferruginous soil |
| 11 | Silver-copper-gold ore |
| 12 | Skarn tungsten magnetite ore |
Table 9. The 12 geological classes in the LIBS benchmark dataset of Képeš et al. [22] and their corresponding class labels.
Since the data is high-dimensional, we again apply PCA and use the first 50 principal components as inputs for clustering. These components explain 0.999999 of the total variance. None of the approaches performs particularly well on this dataset. Nevertheless, -midranks achieves the highest accuracy (, ), followed closely by -midranks (, ). The generalized hyperbolic mixture model achieves the highest ARI (, ). The other mixture models yield slightly lower accuracy and ARI, while -means and -medoids perform particularly poorly on the LIBS dataset. Figure 12 displays all 12 groups projected onto the first two principal components using true labels and -midranks labels. We note that the true and the clustering labels are not closely aligned, reflecting the accuracy of 0.536 and the ARI of 0.303.

Figure 12. Projection of the true and -midranks clustering labels onto the first two principal components of the LIBS dataset. Each color represents one cluster.
The heatmap in Figure 13 provides a more detailed view of the class-specific clustering performance of -midranks. Classes 10 and 12 are the most successfully detected, with 95.2% and 87.0% of their observations assigned to their corresponding matched clusters, respectively. In contrast, Classes 3, 4, and 8 are among the most difficult to recover. The misclassifications of these classes exhibit relatively structured patterns. For Class 3, 36.0% of observations are assigned to Cluster 3, while substantial proportions are assigned to Clusters 4 (20.4%), 7 (18.8%), and 1 (14.4%). For Class 4, only 33.8% of observations are assigned to Cluster 4, with substantial proportions assigned to Clusters 10 (30.0%), 5 (14.2%), and 1 (11.7%). Class 8 has 50.0% of observations assigned to Cluster 3 and 32.2% to Cluster 8, indicating considerable misclassification. These results show considerable variation in the ability of -midranks to recover the predefined LIBS classes. Given the overall clustering accuracy of approximately 0.50, the observed misclassification patterns should be interpreted cautiously and do not by themselves establish similarities in the underlying chemical compositions of these classes.

Figure 13. Heatmap of class-specific clustering results for the LIBS dataset using -midranks with distance. Each row represents a true class and each column represents a matched cluster. The values indicate the percentage of observations from each true class assigned to each matched cluster, with each row summing to 100%.
S&P 500 returns
The S&P 500 dataset from Kaggle (Larxel, [23]) contains stock information for 751 trading days from 2023 to 2025 for companies included in the S&P 500 index, one of the most widely used benchmarks for the U.S. equity market. For clustering, each company is represented by its daily log returns over the entire observation period, and the clustering algorithms are applied to the complete dataset to obtain a single partition of the companies.
The primary objective is to perform unsupervised clustering of stocks based solely on their log return patterns, without imposing predefined sector classifications. However, since companies within the same sector often share common economic drivers and exhibit similar market behaviors, sector labels can serve as useful external benchmarks for evaluating the quality and interpretability of the clusters obtained. We conduct experiments using three, five, and eight sectors to examine whether the clustering methods can identify groups of stocks that correspond to known sector classifications or reveal similarities across different sectors. Since one objective is to use business sectors as benchmark labels, we deliberately select sectors with distinct business activities, as listed below.
Three sectors: Communication Services, Utilities, and Real Estate
Five sectors: Information Technology, Health Care, Energy, Consumer Staples, and Real Estate
Eight sectors: Consumer Staples, Financials, Industrials, Energy, Health Care, Materials, Real Estate, and Utilities
The eight sector selection is the same as in Javaheri, Cardoso and Palomar [20]. However, these authors evaluated their results only on a selected group of 100 out of 352 companies from the eight sectors, and they used 1000 days of daily returns. Moreover, their proposed method was designed for time-varying data while -midranks is for general clustering.
Table 8 shows that -midranks achieves the best clustering performance on the S&P500 data among the methods considered. For the three- and five-sector cases, -midranks achieves the highest accuracy (0.929 and 0.818) and ARI (0.802 and 0.633), respectively. For the eight-sector case, -midranks achieves the highest accuracy (0.691) and ARI (0.507). We note that replacing log-returns with simple returns yields identical results for -midranks, since the strictly increasing transformation preserves ranks and hence leaves the rank-space representation unchanged as stated in Proposition 4.2.
As mentioned earlier, our goal is to identify groups of companies with similar patterns and behaviors, regardless of their business sectors. To illustrate how the clusters identified by -midranks relate to the business-sector classification, we examine Cluster 7 from the eight-sector case, as shown in Figure 15. Figure 14 presents a heatmap showing the correspondence between the clustering labels and business sectors. Similar analyses can be conducted for the remaining clusters and for the three and five sector cases, but we restrict attention to this example for brevity.

Figure 14. Correspondence between business sectors and clusters obtained using -midranks in the eight-sector S&P500 application. Rows represent sectors and columns represent clusters, with cell values indicating the number of companies. Cluster labels are reordered to maximize the sum of diagonal counts.

Figure 15. Illustration of -midranks clustering in the eight-sector S&P500 application. Left: mean daily closing-price trajectories of the eight clusters, with Cluster 7 highlighted in red. Middle: individual company trajectories in Cluster 7, colored by business sector, with the cluster mean in red. Companies with particularly high closing prices are omitted from the middle panel for visual clarity but are included in calculating the cluster mean. Right: sector-wide mean daily closing-price trajectories for the six sectors represented in Cluster 7.
The left panel of Figure 15 shows the mean daily closing-price trajectories of the eight clusters obtained using -midranks, with Cluster 7 highlighted in red. This cluster exhibits a comparatively flat mean trajectory over the observation period, whereas several other clusters display more pronounced upward trends. The middle panel displays individual trajectories within Cluster 7, colored by sector, together with the cluster mean in red. For visual clarity, companies with particularly high closing prices are omitted from this panel to make the remaining trajectories easier to distinguish; however, the cluster mean is calculated using all companies in the cluster. Cluster 7 consists primarily of Real Estate companies but also includes companies from Consumer Staples, Financials, Health Care, Industrials, and Materials. Although the displayed trajectories vary in price level and short-term fluctuations, many exhibit relatively limited overall growth.
The right panel of Figure 15 shows the sector-wide mean trajectories of the six sectors represented in Cluster 1. In particular, the Financials and Industrials sector means show clearer upward trends than the mean of Cluster 7. These comparisons suggest that -midranks identifies a grouping across sector boundaries, bringing together companies whose price trajectories can differ from the aggregate behavior of their respective sectors.
This example illustrates the potential of -midranks to identify groupings of companies across sector boundaries based on their stock behavior and hence to potentially provide additional insights beyond the existing sector classification.
Discussion and limitations
When to Use K-midranks
Our experiments suggest that -midranks is particularly effective for data with very heavy tails, as illustrated by the Cauchy-based simulations, where the underlying distributions do not have finite means. In contrast, -means and model-based methods perform better in the Gaussian and Student’s settings considered here, including the heavy-tailed distribution with three degrees of freedom. Thus, heavy tails alone do not imply that -midranks is to be preferred. However, we note that on real data, -midranks performs slightly better than the model-based methods on the spectroscopy datasets and achieves a more substantial advantage on the S&P500 data. These findings suggest that -midranks is a useful candidate when extreme observations may adversely affect methods that rely on the magnitudes of the original measurements.
To investigate whether heavy-tailed distributions may help explain the experimental results across the simulated and real-world datasets, we constructed normal Q–Q plots for individual variables, each standardized by its sample mean and standard deviation. Each plot uses observations from a single variable pooled across all clusters.
For the simulated datasets, we select one representative case from each class for illustration. Specifically, we consider and sepp for Classes 1–3, and and sepp sepp for Class 4. Figure 16 presents the normal Q–Q plots for all variables in each selected dataset. The Gaussian-based data in Class 1 follow the normal reference line closely, whereas the -based data in Class 2 exhibit pronounced departures in both tails. The Cauchy-based data in Classes 3 and 4 display much flatter central portions and substantially more extreme tail departures than those observed in Class 2. These differences illustrate the distinct tail behaviors among the four simulation classes.
For the real-world datasets, we examined the 20 and 50 retained principal components of the Raman and LIBS data, respectively, and 15 randomly selected trading dates from the S&P 500 dataset, each representing the cross-sectional distribution of returns across companies. As shown in Figure 17, LIBS and S&P500 exhibit pronounced departures from the normal reference line in both tails across several variables, with the lower tails falling below and the upper tails rising above the reference line. These patterns suggest heavy-tailed behavior and are similar to those observed in the -based simulations of Class 2, although the magnitude of the tail departures varies across variables. In contrast, the Raman data exhibit less consistent evidence of heavy-tailed behavior, with pronounced changes in slope and flattening over portions of the Q–Q curves rather than the more systematic tail departures observed in LIBS and S&P500. We note that these observations provide only exploratory evidence of heavy-tailed behavior.
Conclusion and future work
In this work, we introduce a new clustering method, called -midranks, which replaces raw data with coordinatewise ranks for each variable and then handles them similarly to the classic -means. This transformation is intended to reduce the influence of outliers and heavy tails.
-midranks is evaluated and compared with existing clustering algorithms, including -means, -medoids, and model-based clustering based on Gaussian, Student’s , Cauchy, and generalized hyperbolic distributions, using simulated datasets. It is then applied to several real-world applications, including Raman and LIBS spectroscopy and S&P 500 stock returns. Its performance on these real-world datasets is evaluated using the available external labels. In the spectroscopy applications, -midranks achieves the highest clustering accuracy, although model-based methods remain competitive in terms of ARI. -midranks also achieves the best performance on S&P 500 returns, which are well known to exhibit heavy-tailed behavior.
Despite these promising results, several limitations of the proposed method should be acknowledged. -midranks underperforms model-based clustering on Student’s data, which also have heavy tails but with a finite mean. In practice, it would be hard to know when a heavy tailed distribution lacks a first moment. Compared to -means, -midranks has the additional computational burden of ordering the observations and replacing them with ranks. Our R package for -midranks, currently available at https://github.com/nwiroonsri/kmidranks, makes this method practically accessible. Future work includes exploring more situations in which -midranks is suitable, further investigating cluster validation techniques for -midranks, and applying -midranks to a broader range of real-world problems.
Acknowledgments. The second author would like to thank King Mongkut’s University of Technology Thonburi for providing a Skill Development Grant to support his research visit to the University of Southern California.
Funding. The second author was supported in part by the Skill Development Grant 2026, King Mongkut’s University of Technology Thonburi.
Statement on AI use. Generative AI tools were used to assist in drafting and refining portions of the manuscript, improving language and readability, and identifying potential inconsistencies and ambiguities in the presentation. AI was also used to assist in checking mathematical proofs, verifying and debugging computational code, and supporting real-data analyses. The research ideas, proposed methodology, and mathematical results were developed by the authors. All AI-assisted content, mathematical arguments, computational implementations, and numerical results were reviewed and verified by the authors, who take full responsibility for the accuracy and integrity of the manuscript.
Supplementary Material
Proofs of the mathematical properties stated in the main paper, together with additional theoretical results appear in the accompanying supplement.
Simulation and validation results
This section presents tables and plots that summarize the simulation and validation results. These include comparisons of clustering performance, sensitivity analyses, estimates of the number of clusters, and computational performance (runtime).
Clustering performance tables
The following tables compare the clustering performance of the methods across the simulated data classes and parameter settings.
Clustering performance plots
The following plots illustrate how clustering performance varies across the simulation settings, complementing the numerical results in the preceding tables.
Sensitivity analysis
The following results examine the sensitivity of clustering performance to different random initializations.
Estimation of the number of clusters
The following table summarizes the performance of the procedures used to estimate the number of clusters in the simulated datasets.
Computational performance
The following tables and plots summarize the computational performance of the methods, including runtimes and iteration counts across the simulation settings.
Real-data result
This section contains the table summarizing clustering performance on the real datasets, and plots for the Raman spectroscopy laser-induced breakdown, and the S&P 500 returns data.
Clustering performance
The following table compares the clustering performance of the methods on the real datasets considered in this study.
Raman spectroscopy
The following plots illustrate the clustering results for the Raman spectroscopy data and their correspondence with the known substance labels.
Laser-induced breakdown spectroscopy
Table 9 lists the 12 geological classes and their corresponding numerical labels. The following plots illustrate the clustering results for the LIBS data and their correspondence with these known classes.
S&P 500 returns
The following plots illustrate the clustering results for the S&P 500 returns data and the corresponding closing-price trajectories.
Normal Q–Q plots
This section presents normal Q–Q plots for the simulated and real datasets to assess departures from normality, particularly differences in tail behavior. These plots provide distributional context for interpreting the clustering results discussed in the main text.
References
References
- [1]Andrews, J. L. and McNicholas, P. D. (2012). Model-based clustering, classification, and discriminant analysis via mixtures of multivariate t-distributions: The t EIGEN family. Statistics and Computing 22 1021–1029.DOI
- [4]Banfield, J. D. and Raftery, A. E. (1993). Model-based Gaussian and non-Gaussian clustering. Biometrіcs 803–821.DOI
- [5]Borak, S., Misiorek, A. and Weron, R. (2011). Models for heavy-tailed asset returns. In Statistical tools for finance and insurance 21–55. Springer.
- [6]Cape, J., Yu, X. and Liao, J. Z. (2024). Robust spectral clustering with rank statistics. Journal of Machine Learning Research 25 1–81.arxiv.org/abs/2408.10136
- [7]Cizungu, N. C., Tshibasu, E., Lutete, E., Mushagalusa, C. A., Mugumaarhama, Y., Ganza, D., Karume, K., Michel, B., Lumbuенamo, R. and Bogaert, J. (2021). Fire risk assessment, spatiotemporal clustering and hotspot analysis in the Luki biosphere reserve region, western DR Congo. Trees, Forests and People 5 100104. https://doi.org/10.1016/j.tfp.2021.100104
- [9]Cont, R. (2001). Empirical properties of asset returns: stylized facts and statistical issues. Quantitative finance 1 223.
- [10]Dempster, A. P., Laird, N. M. and Rubin, D. B. (2018). Maximum Likelihood from Incomplete Data Via the EM Algorithm. Journal of the Royal Statistical Society: Series B (Methodological) 39 1–22.
- [11]Embrechts, P., Klüppelberg, C. and Mikosch, T. (2013). Modelling extremal events: for insurance and finance 33. Springer Science & Business Media.
- [12]Ester, M., Kriegel, H.-P., Sander, J. and Xu, X. (1996). A density-based algorithm for discovering clusters in large spatial databases with noise. In Proceedings of the Second International Conference on Knowledge Discovery and Data Mining. KDD’96 226–231. AAAI Press.
- [13]Flanagan, A. R. and Glavin, F. G. (2025). Open-source Raman spectra of chemical compounds for active pharmaceutical ingredient development. Scientific Data 12 498.
- [14]García-Escudero, L. A., Gordaliza, A., Matrán, C. and Mayo-Iscar, A. (2010). A review of robust clustering methods. Advances in Data Analysis and Classification 4 89–109.DOI
- [16]Hubert, L. and Arabie, P. (1985). Comparing partitions. Journal of classification 2 193–218.DOI
- [17]JAIN, A. K. (2010). Data clustering: 50 years beyond K-means. Pattern recognition letters 31 651–666.
- [18]JAIN, A. K. and DUBES, R. C. (1988). Algorithms for Clustering Data. Prentice Hall.
- [19]JAMES, G., WITTEN, D., HASTIE, T. and TIBSHIRANI, R. (2021). An Introduction to Statistical Learning: With Applications in R, 2nd ed. Springer.
- [20]JAVAHERI, A., CARDOSO, J. V. D. M. and PALOMAR, D. P. (2023). Graph learning for balanced clustering of heavy-tailed data. In 2023 IEEE 9th International Workshop on Computational Advances in Multi-Sensor Adaptive Processing (CAMSAP) 481–485. IEEE.DOI
- [21]KAUFMAN, L. (1990). Partitioning around medoids (program pam). Wiley series in probability and statistics 344 68–125.DOI
- [22]KÉPÉS, E., VRÁBEL, J., STŘÍTEŽSKÁ, S., POŘÍZKA, P. and KAISER, J. (2020). Benchmark classification dataset for laser-induced breakdown spectroscopy. Scientific data 7 53.
- [23]LARXEL (2021). S&P 500 Stocks (daily updated). https://www.kaggle.com/datasets/andrewmvd/sp-500-stocks. Accessed: 2026-07-21.
- [24]MACQUEEN, J. B. (1967). Some Methods for Classification and Analysis of Multi-Variate Observations. In Proc. of the fifth Berkeley Symposium on Mathematical Statistics and Probability (L. M. L. CAM and J. NEYMAN, eds.) 1 281-297. University of California Press.
- [25]MANN, H. B. and WHITNEY, D. R. (1947). On a Test of Whether One of Two Random Variables Is Stochastically Larger than the Other. The Annals of Mathematical Statistics 18 50–60. https://doi.org/10.1214/aoms/1177730491
- [26]McNICHOLAS, P. D. (2016). Mixture model-based classification. Chapman and Hall/CRC.DOI
- [27]RAGAVAN, P., ANANTH, A. and RAJAN, M. R. (2017). Impact of Selenium Nanoparticles on Growth, Biochemical Characteristics and Yield of Cluster Bean Cyamopsis tetragonoloba. International Journal of Environment Agriculture and Biotechnology 2 2917-2926.
- [28]RAND, W. M. (1971). Objective criteria for the evaluation of clustering methods. Journal of the American Statistical association 66 846–850.DOI
- [29]RYKOV, A., CORDEIRO DE AMORIM, R., MAKARENKOV, V. and MIRKIN, B. (2024). Inertia-Based Indices to Determine the Number of Clusters in K-Means: An Experimental Evaluation. IEEE Access 12 11761–11773. https://doi.org/10.1109/ACCESS.2024.3350791
- [30]SPEARMAN, C. (1904). The Proof and Measurement of Association between Two Things. The American Journal of Psychology 15 72–101. https://doi.org/10.2307/1412159
- [31]THORNDIKE, R. L. (1953). Who Belongs in the Family? Psychometrika 18 267–276. https://doi.org/10.1007/BF02289263
- [32]TRYON, R. C. (1939). Cluster Analysis; Correlation Profile and Orthometric (Factor) Analysis for the Isolation of Unities in Mind and Personality. Edwards Brother, Inc., Lithoprinters and Publishers.
- [33]WILCOXON, F. (1945). Individual Comparisons by Ranking Methods. Biometrics Bulletin 1 80–83. https://doi.org/10.2307/3001968
- [34]ZHANG, Y., MELNYKOV, V. and MELNYKOV, I. (2023). On model-based clustering of directional data with heavy tails. Journal of Classification 40 527–551.
