Categories &

Functions List

Function Reference: mdscale

statistics: Y = mdscale (D, p)
statistics: [Y, stress] = mdscale (D, p)
statistics: [Y, stress, disparities] = mdscale (D, p)
statistics: […] = mdscale (…, Name, Value)

Nonclassical (metric and nonmetric) multidimensional scaling.

Y = mdscale (D, p) takes a matrix of dissimilarities D and returns a configuration Y of n points in p dimensions (an n × p matrix) whose interpoint distances approximate D, by minimizing a stress criterion. D may be given either as a full n × n symmetric matrix with zero diagonal, or as the vector of the n (n - 1) / 2 upper-triangle dissimilarities returned by pdist.

[Y, stress, disparities] = mdscale (…) also returns the final value of the stress criterion and the disparities (the transformed dissimilarities the distances are fitted to). For the nonmetric criteria the disparities are the monotone (isotonic) regression of the dissimilarities onto the distances; for the metric criteria they are the dissimilarities themselves.

Name/Value pairs:

'Criterion'
The goodness-of-fit criterion to minimize, one of:
'stress' (default)
Kruskal’s normalized stress-1, sqrt (sum ((d - dhat)^2) / sum (d^2)), computed from disparities dhat (nonmetric).
'sstress'
Squared stress, sqrt (sum ((d^2 - dhat^2)^2) / sum (d^4)) (nonmetric).
'metricstress'
Metric stress, sqrt (sum ((d - delta)^2) / sum (delta^2)), fitting the dissimilarities delta directly.
'metricsstress'
Metric squared stress, sqrt (sum ((d^2 - delta^2)^2) / sum (delta^4)).
'sammon'
Sammon’s nonlinear mapping criterion, (1 / sum (delta)) sum ((d - delta)^2 / delta).
'strain'
The classical scaling criterion; equivalent to cmdscale.
'Weights'
A matrix or vector of nonnegative weights, the same size as D, weighting each dissimilarity in the criterion.
'Start'
The initial configuration: 'cmdscale' (default, classical scaling), 'random', or an explicit n × p matrix.
'Replicates'
The number of times to repeat the minimization from different starting points, keeping the best (lowest-stress) result. The default is 1.
'Options'
A structure of algorithm options (as returned by statset) whose MaxIter, TolFun, and TolX fields control the iterative minimization.

Non-uniqueness of the solution

A stress-minimizing configuration is defined only up to a translation, rotation, and reflection, because these leave all interpoint distances (and hence the stress) unchanged. mdscale removes this ambiguity by returning Y centred at the origin and rotated to its principal axes (with the largest-magnitude coordinate on each axis made positive), matching the convention used by MATLAB.

Beyond that rigid ambiguity, the nonmetric criteria ('stress' and 'sstress') are non-convex and typically have several local minima; the one reached depends on the starting configuration and the details of the optimizer. As a result the returned configuration for these criteria may differ from the one another program (including MATLAB) reports even when the stress value agrees, and different runs may find configurations with slightly different stress. Use 'Replicates' with a 'random' start to search for a lower-stress solution. The metric criteria and 'strain' have an essentially unique solution and are reproducible up to the rigid ambiguity above.

See also: cmdscale, pdist, squareform, procrustes, statset

Source Code: mdscale

Recover a 2-D map of 8 points from their pairwise distances.

 rng = [0 0; 5 0; 5 4; 0 4; 8 2; -3 2; 2 7; 2 -3];
 D = pdist (rng);
 [Y, stress] = mdscale (D, 2, 'Criterion', 'metricstress');
 stress
stress = 3.5536e-16

Y reproduces the pairwise distances closely.

 max (abs (pdist (Y)' - D'))
ans = 3.5527e-15