[R] isoMDS and 0 distances

Tyler Smith tyler.smith at mail.mcgill.ca
Thu Apr 20 03:11:28 CEST 2006


Thanks all!

 From Christian's explanation I think I will be alright adding small 
values to my zero distances. In my application my distances are limited 
by the number of primer pairs I use, and it is reasonable to expect that 
adding primer pairs would eventually reveal some small genetic 
difference among plants collected from locations many hundreds of miles 
apart. I've also found that using Jari's metaMDSiter() function from the 
vegan package gets me out of the local minimum traps that troubled me 
earlier.

Cheers,

Tyler

Christian Hennig wrote:

> About replacing the zeroes with tiny numbers:
> isoMDS works with the rankings of the distances. Therefore replacing 
> zeroes by tiny values gives them a rank above the "real" zeroes 
> (distance to same observation) and below all the non-zero distances. 
> If this makes sense in your application (in my experience it usually 
> does), you can do it.
>
> Sometimes the classical MDS solution is a local optimum of the isoMDS 
> criterion. In these cases isoMDS "converges" in one step (rather it 
> gives you the classical MDS solution). This may happen with and 
> without zero or NA distances.
>
> Best,
> Christian
>
> 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
>>
>
> *** --- ***
> Christian Hennig
> University College London, Department of Statistical Science
> Gower St., London WC1E 6BT, phone +44 207 679 1698
> chrish at stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche
>




More information about the R-help mailing list