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 matrix) whose interpoint distances
approximate D, by minimizing a stress criterion. D may be given
either as a full symmetric matrix with zero diagonal,
or as the vector of the 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''stress' (default)'sstress''metricstress''metricsstress''sammon''strain'cmdscale.'Weights''Start''cmdscale' (default, classical scaling),
'random', or an explicit matrix.'Replicates''Options'statset) whose
MaxIter, TolFun, and TolX fields control the iterative
minimization. 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