Skip to content
Prev 1303 / 7420 Next

some MDS and R problems

Hi Arnaldo,

You ask several disjointed question that I don't really follow (esp your
last point about unique), but in response to:
No, nMDS only cares about trying to position points in a k dimensional
space such that the distance between points in this k dimensional space
best represents the rank ordering of the original dissimilarities. If
two samples have 0 dissimilarity, they should occupy the same location
on the plot (in the k dimensional space); one does not influence the
other. Hence simply deleting one of the pair of samples that have zero
distance to one another is appropriate.

As for the code I wrote in the email you cite:

minDij <- min(Dij[Dij > 0]) / 2
Dij[Dij <= 0] <- minDij

We assume Dij is the object containing your distance matrix. In your
example code, it would be

Dij <- as.matrix(dissim1)

for example.

The first line of my code calculates half the smallest observed
dissimilarity. If we break it down, the code in that first line does the
following [there was a missing `]` in the version you quote and probably
in my original]:

Dij[Dij > 0] subsets Dij so that we only work with the dissimilarities
that are positive. This way of indexing the matrix Dij results in a
vector of positive dissimilarities. We then apply the min( ) function to
this vector of positive dissimilarities to return the smallest positive
dissimilarity observed. We then halve this minimum value and store it in
the object minDij.

The second line of my code uses this dissimilarity value (minDij) to
replace the observed dissimilarities in Dij that are less than or equal
to 0.

Hope this is of use. If you still can't get this to work, post back and
let us know.

All the best,

G
On Tue, 2010-06-15 at 08:34 -0300, Arnaldo Russo wrote: