Method · Statistics Library

Multidimensional scaling (MDS)

Multidimensional scaling takes a table of pairwise distances between objects and places them on a low-dimensional map (usually 2-D) so that objects far apart in the data sit far apart on the map, with a Stress-1 score reporting how faithfully the map reproduces those distances.

Topic indexA reference reading outside the guided chapter sequence

Understand the idea

Suppose you know how different every pair of cities, brands, or animals is from every other one: not their coordinates, just how far apart each pair is. MDS finds a 2-D picture where the distances between the DOTS reproduce those known differences as closely as possible: similar objects end up near each other, dissimilar ones far apart, without you ever telling it what makes them similar.

The map is never perfect, because squeezing many real relationships into two dimensions loses information. Stress-1 is the honest report card on how much: 0 is a perfect map, and values creep from 'excellent' below about 0.025 up to 'very poor, do not trust this' above 0.20. Always check the Stress value before reading anything into the picture.

One thing trips almost everyone up at first: the AXES of an MDS map mean nothing on their own; the whole picture can be freely rotated, flipped, or shifted without changing what it shows. Only the DISTANCES between points (who is near whom) carry information.

Multidimensional scaling draws a distance map on which items that are similar sit close together. A Shepard diagram plots the distances on the map against the original dissimilarities, to show how faithfully the map keeps them. SMACOF is the fitting method that moves the points step by step to shrink the mismatch between map distances and original dissimilarities, a mismatch called stress.

Practitioner explanation

KernelStats fits SMACOF (via scikit-learn) for both branches: metric MDS matches map distances to the input dissimilarities on their original scale; non-metric MDS instead fits an isotonic (monotone) regression to the disparities, preserving only rank order, appropriate when only relative similarity judgments are trustworthy. When variables (not a precomputed distance matrix) are supplied, standardize defaults on, because an unscaled variable with a larger numeric range (grams next to millimeters) would dominate the distance calculation; Euclidean, cosine, correlation, and Manhattan distances are all offered. Several random restarts (n_init) are run and the lowest-Stress solution is kept, because SMACOF's gradient descent can settle in a poor local optimum.

KernelStats refuses to run above a stated object ceiling (1,000 objects for metric MDS, 500 for non-metric, which is slower per iteration because it also fits an isotonic regression) rather than silently freezing, because the pairwise-distance matrix is O(n^2) in both time and memory: the refusal names the exact row count, the ceiling, and the memory the full run would need. The statistics dict deliberately does NOT populate a generic 'p' key for MDS (there is no hypothesis test here), so the card's significance-badge machinery stays inert for this function rather than displaying a fabricated significance verdict.

Two conventions to know before quoting numbers: (1) when every selected column is constant (zero variance across all objects), every pairwise distance is 0 and Stress-1 is mathematically 0/0: the card reports this as 'not computable', never as a fabricated 0 or NaN string. (2) the R code export computes classical scaling (cmdscale) and its GOF statistic, not SMACOF Stress-1: a genuine cross-package convention difference (documented in the export itself), so the R number will not match the card's Stress-1 and should not be treated as a discrepancy in the underlying data.

When to use it

Consider it when

You have, or can compute, pairwise distances or dissimilarities between a modest number of objects (tens to a few hundred) and want a 2-D map showing which objects are similar, especially when you have only the distances and not the original variables, or when only the rank order of the dissimilarities is trustworthy.

Use caution when

Large tables (KernelStats refuses above 1,000 objects for metric MDS, 500 for non-metric; use PCA or k-means instead, which scale to the whole table, or subsample first), when you need to interpret WHY objects are similar (MDS gives no loadings, unlike PCA or factor analysis), or when you plan to read meaning into the map's axes rather than the relative positions of its points.

Formulas and symbols

Kruskal's Stress-1

Stress-1=∑i<j(d^ij−dij)2∑i<jdij2\text{Stress-1} = \sqrt{\dfrac{\sum_{i<j}\left(\hat d_{ij} - d_{ij}\right)^2}{\sum_{i<j} d_{ij}^2}}

d_ij the map (fitted) distances; d-hat_ij the disparities (equal to the raw input distances for metric MDS, a monotone transform of them for non-metric MDS).

Map distance between two objects

dij=∥yi−yj∥d_{ij} = \lVert y_i - y_j \rVert

y_i, y_j the fitted low-dimensional coordinates of objects i and j; the ordinary Euclidean distance between two points on the map.

Assumptions and checks

  • A high Stress-1 value means the low-dimensional map is a poor summary of the original distances: two points that look close on the map may not really be close in the original data, so the configuration should not be over-interpreted.

    In KernelStats: Checked directly: Stress-1 (Kruskal's formula) is computed and reported on the card, with an honest 'not computable' note on a degenerate (all-equal) distance matrix rather than a fabricated zero.

  • Building the distance matrix from raw, unstandardized columns of differing scale lets the highest-variance column dominate the geometry, so the resulting map reflects scale rather than genuine similarity.

    In KernelStats: Checked directly: the card reports whether columns were standardized before computing distances, or whether a precomputed distance matrix was supplied directly, and warns when raw, unstandardized columns were used.

Alternatives

  • Principal Component Analysis. You have the original variables (not just distances) on ordinary Euclidean scale: classical metric MDS on Euclidean distances gives the same picture as PCA up to rotation/reflection, and PCA additionally gives loadings and a % variance explained per axis.
  • Hierarchical Clustering. You want explicit group assignments (which objects belong together) rather than a continuous 2-D layout of relative similarity.
  • k-Means Clustering. You have the original variables for many more objects than MDS's ceiling supports and want groupings rather than a map.

Worked example

Scenario

Metric MDS on four standardized penguin body measurements (bill length, bill depth, flipper length, body mass) across 342 penguins, mapped to 2 dimensions with seed 42.

Result

Stress-1 = 0.1043, which the card labels 'poor' (Kruskal's bands: below 0.025 excellent, below 0.05 good, below 0.10 fair, below 0.20 poor).

Interpretation

The 2-D map sits just past the fair/poor boundary: broad structure such as the separation of species clusters can be read from it, but individual within-species distances are noticeably distorted and should not be interpreted; adding a third output dimension, or checking the picture against PCA, is the honest next step.

Dataset: penguins.csv

Common misconceptions

Misconception

The horizontal and vertical position of a point on an MDS map each mean something specific, like the first and second principal component do in PCA.

Correction

MDS axes are arbitrary: the whole map can be freely rotated, reflected, or shifted without changing what it represents, because only the DISTANCES between points were fit, never any specific direction. Read relative positions (who is near whom), never the meaning of 'left' or 'up'.

Misconception

A low Stress-1 value works like an effect size (small/medium/large, Cohen's benchmarks) and can be compared to one.

Correction

Stress-1 is a lack-of-fit index on its own 0-to-1 scale with its own vocabulary (excellent/good/fair/poor), not a Cohen-style effect size, and the two are not interchangeable or comparable.

References

  1. Multidimensional scaling by optimizing goodness of fit to a nonmetric hypothesis, Kruskal, J. B. (1964), Psychometrika, 29(1), 1-27.
  2. Modern Multidimensional Scaling: Theory and Applications, Borg, I. and Groenen, P. J. F. (2005).