[R] isoMDS
Jari Oksanen
jarioksa at sun3.oulu.fi
Thu Sep 9 10:37:10 CEST 2004
On Thu, 2004-09-09 at 04:53, Kjetil Brinchmann Halvorsen wrote:
> >
> Mardia, kent & Bibby defines the "standard transformation" from a
> similarity matrix to a dissimilarity
> (distance) matrix by
>
> d_rs <- sqrt( c_rr -2*c_rs + c_ss)
>
> where c_rs are the similarities. This assures the diagonal of the
> dissimilarity matrix to be zero.
> You could try that.
>
In R notation, this would be
sim2dist <- function(x)
as.dist(sqrt(outer(diag(x), diag(x), "+") - 2*x))
Mardia, Kent & Bibby indeed passingly say that this is a `standard
transformation' (page 403). However, it is really a canonical way only
if diagonal elements in similarity matrix are sums of squares, and
off-diagonal elements are cross products. In that case the `standard
transformation' gives you Euclidean distances (or if you have
variances/covariances or ones/correlations it gives you something
similar). However, it is no standard if your similarities are something
else, and cannot be transformed into Euclidean distances.
However, in isoMDS this *may* not matter, since NMDS uses only rank
order of dissimilarities, and any transformation giving dissimilarities
in the same rank order *may* give similar results. The statement was
conditions ("may"), since isoMDS uses cmdscale for the starting
configuration, and cmdscale will give different results with different
transformations. So isoMDS may stop in different (local) optima. Setting
`tol' parameter low enough in isoMDS (see ?isoMDS) helped in a couple of
cases I tried, and the results were practically identical with different
transformations. So it doesn't matter too much how you change your
similarities to dissimilarities, since isoMDS indeed treats them as
dissimilarities (but cmdscale treats them as distances).
cheers, jari oksanen
--
J.Oksanen, Oulu, Finland.
"Object-oriented programming is an exceptionally bad idea which could
only have originated in California." E. Dijkstra
More information about the R-help
mailing list