Hi all, I'm trying to perform an MDS of some data that I have. When I use cmdscale everything is fine and I get some interesting results however, the tends to be low. What I wnat to do is compare this with the Non-Metric MDS using isoMDS or sammon. However, when I try using these I get the following message. Error in isoMDS(x.dist) : zero or negative distance between objects 2 and 4 I am using as.dist to convert my full dissimilarity matrix. Some of the dissimilarities, other than the diagonal, are zero which is causing this, is there anything I can do to resolve this. Below is a sample dissimilarity matrix 0 0 0.0694153 0.187033 0.193339 0 0 0.0146605 0.36829 0.563406 0.0694153 0.0146605 0 0.347965 0.187033 0.36829 0.347965 0 Thanks Adam
On Fri, 2004-03-26 at 15:02, Adam Tee wrote:> Hi all, > > > I'm trying to perform an MDS of some data that I have. When I use > cmdscale everything is fine and I get some interesting results however, > the tends to be low. > > What I wnat to do is compare this with the Non-Metric MDS using isoMDS > or sammon. However, when I try using these I get the following message. > > Error in isoMDS(x.dist) : zero or negative distance between objects 2 > and 4 >The error message is clear: You have some identical sites so that their distance is zero. I think the canonical solution is to remove the duplicate cases from the data before calculating the dissimilarities. If your data frame is called X: Xuniq <- unique(X) x.dist <- dist(Xuniq) (or, as a one-liner: x.dist <- dist(unique(X)) A dirty solution is to lie to isoMDS. The following will do: isoMDS(x.dist + 1e-5) But you better not tell anybody that you did this dirty trick. cheers, jari oksanen -- Jari Oksanen <jarioksa at sun3.oulu.fi>
On 03/26/04 14:07:30, Jari Oksanen wrote:> The error message is clear: You have some identical sites so that > theirdistance is zero. I think the canonical solution is to remove > the duplicate cases from the data before calculating the > dissimilarities. If your data frame is called X: > > Xuniq <- unique(X) > x.dist <- dist(Xuniq) > > (or, as a one-liner: x.dist <- dist(unique(X)) >One of the difficulties is that it is significant that some of the data is identical as I am comparing musical sequences. The above does not work as I am not dealing with the raw data. I am using my own dissimilarity measure output by a separate program. The reason for using MDS is to visualise the data based on the developed dissimilarity measure. Would it be better to use PCA ?? Adam