sammon(d, y = cmdscale(d, k), k = 2, niter = 100, trace = T, magic = 0.2, tol = 1e-4)
dist
, or a full, symmetric
matrix. Data are assumed to be dissimilarities or relative distances,
but must be positive except for self-distance.
cmdscale
is used to provide
the classical solution.
T
.
This chooses a two-dimensional configuration to minimize the stress,
the sum of squared differences between the input distances and those
of the configuration, weighted by the distances, the whole sum being
divided by the sum of input distances to make the stress scale-free.
An iterative algorithm is used, which will usually converge in around
50 iterations. As this is necessarily an O(n^2) calculation, it is slow
for large datasets. Further, since the configuration is only determined
up to rotations and reflections (by convention the centroid is at the
origin), the result can vary considerably from machine to machine.
In this release the algorithm has been modified by adding a step-length
search (
magic
) to ensure that it always goes downhill.
Sammon, J. W. (1969) A non-linear mapping for data structure analysis. IEEE Trans. Comput. C-18 401-409.
swiss.sam <- sammon(dist(swiss.x)) plot(swiss.sam$points, type = "n") text(swiss.sam$points, labels = as.character(1:nrow(swiss.x)))