[R] isoMDS and 0 distances

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Apr 19 08:46:27 CEST 2006


Short answer: you cannot compare distances including NAs, so there is no 
way to find a monotone mapping of distances.

If the data really are identical for two rows, you can easily drop one of 
them whilst doing MDS, and then assign the position found for one to the 
other.

On Tue, 18 Apr 2006, Tyler Smith wrote:

> Hi,
>
> I'm trying to do a non-metric multidimensional scaling using isoMDS.
> However, I have some '0' distances in my data, and I'm not sure how to
> deal with them. I'd rather not drop rows from the original data, as I am
> comparing several datasets (morphology and molecular data) for the same
> individuals, and it's interesting to see how much morphological
> variation can be associated with an identical genotype.
>
> I've tried replacing the 0's with NA, but the isoMDS appears to stop on
> the first iteration and the stress does not improve:
>
> distA # A dist object with 13695 elements, 4 of which == 0
> cmdsA <- cmdscale(distA, k=2)
>
> distB <- distA
> distB[which(distB==0)] <- NA
>
> isoA <- isoMDS(distB, cmdsA)
> initial  value 21.835691
> final  value 21.835691
> converged
>
> The other approach I've tried is replacing the 0's with small numbers.
> In this case isoMDS does reduce the stress values.
>
> min(distA[which(distA>0)])
> [1] 0.02325581
>
> distC <- distA
> distC[which(distC==0)] <- 0.001
> isoC <- isoMDS(distC)
> initial  value 21.682854
> iter   5 value 16.862093
> iter  10 value 16.451800
> final  value 16.339224
> converged
>
> So my questions are: what am I doing wrong in the first example? Why
> does isoMDS converge without doing anything? Is replacing the 0's with
> small numbers an appropriate alternative?
>
> Thanks for your time,
>
> Tyler
> R 2.2.1
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list