Quant Memo
Core

Distance and Similarity Measures for Assets

Turning 'how similar are these two assets' into a number you can compute and rank — and why the choice of distance metric (correlation-based, Euclidean, or rank-based) changes which assets end up looking alike.

Prerequisites: The Sample Covariance Matrix and Eigenvalue Bias

You want to group similar assets together — for diversification, for pairs trading, for building a hierarchical risk model — and the first step is deciding what "similar" even means, mathematically. It's tempting to reach for correlation directly, but correlation isn't itself a distance: two perfectly correlated assets (correlation 1) should have distance zero, but two perfectly anti-correlated assets (correlation −1) are also, in a real sense, maximally informative about each other — they're not "randomly unrelated," they're opposite twins. A naive use of 1ρ1 - \rho as a distance would treat anti-correlated assets as maximally far apart (distance 2), lumping them in with assets that share no relationship at all, which loses real information a clustering or grouping algorithm could use.

An analogy: sorting people by how they answer, not just whether they agree

Imagine grouping people by their answers to yes/no survey questions, intending "similar" people to answer the same way often. If two people answer oppositely to every single question — one always says yes when the other says no — they're not "unrelated" to each other; they're perfectly predictable from one another, just in reverse. Grouping them with truly random strangers (who agree with each about half the time, no pattern at all) would throw away a strong, structured relationship. A well-designed distance measure should place perfect agreers close together, perfect disagreers also meaningfully close together (in a mirrored sense), and only truly unpredictable pairs far apart.

The mechanics, one symbol at a time

Let ρij\rho_{ij} be the correlation between assets ii and jj. The commonly used correlation-based distance (from Mantegna's work on financial market structure) is

dij=2(1ρij),d_{ij} = \sqrt{2(1-\rho_{ij})},

which ranges from dij=0d_{ij}=0 (when ρij=1\rho_{ij}=1, perfectly correlated — zero distance) to dij=2d_{ij}=2 (when ρij=1\rho_{ij}=-1, perfectly anti-correlated — maximum distance) with dij=2d_{ij}=\sqrt2 at ρij=0\rho_{ij}=0 (uncorrelated). In plain English: this metric treats perfect anti-correlation as the most dissimilar possible relationship, the same conceptual mistake as the survey example — it doesn't recognize that perfectly opposite behavior is still a strong, structured relationship, not "no relationship." An alternative, when you specifically want to group assets that move together regardless of direction (useful for hedging or long/short pair construction), uses dij=2(1ρij)d_{ij} = \sqrt{2(1-|\rho_{ij}|)}, which correctly places both perfectly correlated and perfectly anti-correlated pairs at distance zero.

Two other common choices matter for different reasons: Euclidean distance on raw return vectors, dij=rirjd_{ij} = \|r_i - r_j\|, is sensitive to each asset's overall volatility level, not just how the two co-move — a low-vol and a high-vol asset can look "far apart" in Euclidean terms even if they're highly correlated, because the raw magnitude of their moves differs. Rank-based (Spearman) correlation distance replaces returns with their rank order before computing correlation, which is far more robust to outliers and nonlinear (but monotonic) relationships than ordinary Pearson correlation, at some cost in sensitivity to genuinely linear relationships.

Worked example 1: the anti-correlation trap

Take three assets: A and B have correlation ρAB=0.95\rho_{AB} = 0.95 (near-identical movers, perhaps two share classes of the same company). C and A have ρAC=0.95\rho_{AC} = -0.95 (C is a near-perfect inverse — say, a short ETF on A's sector). Using the signed distance d=2(1ρ)d=\sqrt{2(1-\rho)}: dAB=2(0.05)0.32d_{AB} = \sqrt{2(0.05)} \approx 0.32 (very close), but dAC=2(1.95)1.97d_{AC} = \sqrt{2(1.95)} \approx 1.97 (nearly maximally far) — C is clustered with unrelated random assets, even though knowing A tells you almost exactly what C will do (just flipped in sign). A clustering algorithm using this metric would completely miss that C is one of the most informative, structurally related assets to A in the whole universe, simply of opposite sign.

Worked example 2: fixing it with absolute correlation distance

Same three assets, now using dij=2(1ρij)d_{ij} = \sqrt{2(1-|\rho_{ij}|)}: dAB=2(10.95)0.32d_{AB} = \sqrt{2(1-0.95)} \approx 0.32 (unchanged, still close) and dAC=2(10.95)0.32d_{AC} = \sqrt{2(1-0.95)} \approx 0.32 as well — now A and C are recognized as equally "close" in the sense of predictive relationship, just with opposite sign. A hierarchical clustering run on this corrected distance would group A, B, and C together as a tightly linked cluster (same underlying driver, different sign exposures), which is the economically meaningful grouping for hedging or pairs-trading purposes, whereas the signed distance in worked example 1 would have split them apart.

signed distance: C isolated A B C far from A, B absolute distance: A, B, C grouped A B C
Signed correlation distance places anti-correlated C far from A and B despite a strong (inverse) relationship; absolute correlation distance correctly groups all three as tightly linked.

What this means in practice

The right distance metric depends on what "similar" should mean for the task: use signed correlation distance when direction of movement genuinely matters (you want long-only diversifiers, not inverse plays lumped in); use absolute correlation distance when you care about strength of relationship regardless of sign (hedge candidates, pairs-trading universes, or building a hierarchical risk-parity tree where anti-correlated assets are just as useful for diversification as uncorrelated ones); use rank-based distance when returns have heavy tails or outliers that would distort ordinary correlation. This choice feeds directly into clustering, hierarchical risk parity, and dimensionality-reduction techniques like multidimensional scaling, all of which only see the distances you hand them.

Correlation isn't itself a distance, and the most common conversion, d=2(1ρ)d=\sqrt{2(1-\rho)}, treats perfectly anti-correlated assets as maximally dissimilar — appropriate only when direction of movement matters; when it doesn't, using ρ|\rho| instead correctly groups strongly (even inversely) related assets together.

Don't default to d=2(1ρ)d=\sqrt{2(1-\rho)} without checking whether anti-correlation should count as "similar" or "different" for your purpose. Clustering or risk-grouping algorithms fed the signed distance will scatter strongly anti-correlated pairs — often the most economically informative relationships in the dataset — into unrelated clusters, silently discarding structure that an absolute-value or task-appropriate distance would have captured.

Related concepts

Practice in interviews

Further reading

  • Mantegna, 'Hierarchical Structure in Financial Markets', European Physical Journal B (1999)
  • de Prado, Advances in Financial Machine Learning, ch. 4
ShareTwitterLinkedIn