Skip to content

Multidimensional scaling and distance matrices

5 messages · Christian Hennig, Brian Ripley, Federico Calboli +1 more

#
Hi,

usually the term MDS is used for methods which operate only on
dissimilarity matrices. A similarity matrix s can be easily transformed
into a dissimilarity matrix d by taking d <- max(s)-s, which could be
considered as kind of a canonical standard to do this.

It seems like the R-MDS methods give errors because your diagonals are
larger and should be smaller than anything else for dissimilarities.

I am not familiar with kinship matrices. You may try MDS on
max(test)-test, but because the diagonals in your matrix are not equal I
presume that there is another a bit more subtle standard routine to
convert kinship matrices into dissimilarities, maybe something like  
(raw, not R) d(i,j)=1-s(i,j)^2/(s(i,i)s(j,j)).

Did you consider the Statistica manual? It should tell you...

Hope this is of any help,
Christian
On 26 Feb 2004, Federico Calboli wrote:

            
***********************************************************************
Christian Hennig
Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
hennig at math.uni-hamburg.de, http://www.math.uni-hamburg.de/home/hennig/
#######################################################################
ich empfehle www.boag-online.de
#
Dear All,

I am in the somewhat unfortunate position of having to reproduce the
results previously obtained from (non-metric?) MDS on a "kinship" matrix
using Statistica. A kinship matrix measures affinity between groups, and
has its maximum values on the diagonal. 

Apparently, starting with a nxn kinship matrix, all it was needed to do
was to feed it to Statistica flagging that the matrix was NOT a distance
matrix but a kinship one. If Statistica transformed the kinship matrix
into a distance one (how?) is anybody's guess. 

A quick search immediately showed that a multidimensional scaling is
done on a distance matrix. See for instance:
MASS4, pg 304
"Elements of computational statistics", Jentle, pg 122
Edwards and Oman's article, page 2-7 R-News 3/3 

The fact that Statistica happily perform MDS on a "kinship" matrix is
puzzling. Indeed, I would expect errors, as in the following toy
example, without transforming the kinship matrix to distances:
V1          V2          V3          V4          V5
1 0.198716340 0.003612042 0.011926851 0.019737349 0.015021053
2 0.003612042 0.066742885 0.013809924 0.005121996 0.011175845
3 0.011926851 0.013809924 0.197337389 0.013893087 0.006405424
4 0.019737349 0.005121996 0.013893087 0.216047450 0.006218477
5 0.015021053 0.011175845 0.006405424 0.006218477 0.118812936

cmdscale(test)
   [,1] [,2]
V1  NaN  NaN
V2  NaN  NaN
V3  NaN  NaN
V4  NaN  NaN
V5  NaN  NaN
Warning messages:
1: some of the first 2 eigenvalues are < 0 in: cmdscale(test)
2: NaNs produced in: sqrt(ev)
Error in isoMDS(test) : NAs/Infs not allowed in d
Error in sammon(test) : initial configuration must be complete
In addition: Warning messages:
1: some of the first 2 eigenvalues are < 0 in: cmdscale(d, k)
2: NaNs produced in: sqrt(ev)


The colleagues who used the above routine are unable to tell me with
certainty whether Statistica used metric/non metric scaling, and if non
metric whether a Kruskall or a Sammon scaling. 

In any case, I would simply like to ask the memebers of the list if I am
correct in thinking that MDS can ONLY be performed on a distance matrix,
and I can therefore reasonably expect that some form of transformation
to a distance matrix has been performed by Statistica prior to the MDS.
It would at least be a first step to understand what exactly Statistica
did with the data.

Regards,

Federico Calboli
#
A few comments:

MDS is normally done on a dissimilarity matrix, not necessarily a distance 
matrix (no need for the triangle inequality to be enforced).

Some MDS software will autmatically map similarity matrices to
corresponding dissimilarity matrices if told to do so (but not all by the
same mapping, usually D = 1-S or D = sqrt(1-S)).  It looks like a
`kinship' matrix is a cousin of a similarity matrix, which usually have
entries between 0 and 1 and with 1 on the diagonal.

The description of MDS in Statistica at

http://www.statsoftinc.com/textbook/stmulsca.html

is entirely in terms of `observed distances', and Kruskal-type MDS.

Note that non-metric MDS is almost impossible to reproduce due to local 
minima, although hopefully one could get a similar solution in a different 
implementation of the same method.

Faced with your example, I would treat it as a covariance matrix, turn it 
into a correlation matrix and take the distances as 1 - correlations, and 
cross my fingers.
On 26 Feb 2004, Federico Calboli wrote:

            

  
    
#
On Thu, 2004-02-26 at 12:35, Christian Hennig wrote:
I am happy with the function "dist" in {mva}, and I know there are other
functions in {cluster}, but it's besides the point. The question that is
nagging me is: is it justified to do a form of MDS on a matrix other
than a distance matrix? the reference I pointed out to do say to use a
distance matrix, but do not explicitely say "all else is wrong", so I
could call it a day.
If I had it... in any case I hoped that the people that used Statistica
in the first place did read the manual before going forth in their
analysis. Now we are stuck in a situation where we do not know what
Statistica is actually doing, and I have to convince people that doing
things with R is going to be a better (= more sensible) option. 
 
Regards,

Federico Calboli
#
On Thu, 2004-02-26 at 17:05, Federico Calboli wrote:
No. You can write a program for NMDS that accepts either similarities or
dissimilarities. This was an option already in KYST (Kruskal - Young -
Shepard - Torgeson) programme that was one of the first available pieces
of software for running NMDS (from early 1970s or late 1960s).
Technically this means that you have either monotone decrease of
monotone increase in your Shepard plot. It doesn't matter. Of course,
you do not need that option, since you can change your similarities into
dissimilarities. Typically this is easy, and you can do something like 1
- similarity or 1 - sqrt(similarity) (the latter is metric for some
cases where the former is semimetric). This translations is trickier in
case like yours where the diagonals vary. However, I guess that
Statistica (or KYST) would not look at the diagonals: if the translation
into dissimilarities is tricky, the handling of similarities is probably
wrong in the software. That is, the software uses only off-diagonal
values at their face value, implying it thinks the diagonal values are
all equal. So it is better that you have to change your similarities
into dissimilarities since then you know how to do that -- NMDS may not
know or even care.

Actually, I think you could port KYST to R if you want to get a function
that accepts similarities, too. However, I think this is not worthwhile,
but Ripley's isoMDS (in MASS) is a better alternative. (It might be
worthwhile, and even easier, to port SINDSCAL, but I am not sure if its
licence allows this.)

Finally, Sammon and Kruskal scaling do not exhaust the alternatives for
NMDS. Actually, I think that the method used in Statistica may be ALSCAL
(many years since I used Statistica), like in the software used as a
model of Statistica. I am pretty sure it wasn't Sammon.

cheers, jari oksanen