# [R] Multidimensional scaling and distance matrices

Christian Hennig fm3a004 at math.uni-hamburg.de
Thu Feb 26 13:35:54 CET 2004

```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:

> 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:
>
> > test
>            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)
> > isoMDS(test)
> Error in isoMDS(test) : NAs/Infs not allowed in d
> > sammon(test)
> 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
> --
>
>
>
> =================================
>
> Federico C. F. Calboli
>
> Dipartimento di Biologia
> Via Selmi 3
> 40126 Bologna
> Italy
>
> tel (+39) 051 209 4187
> fax (+39) 051 251 208
>
> f.calboli at ucl.ac.uk
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

***********************************************************************
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

```

More information about the R-help mailing list