[R] Multidimensional Scaling (MDS) in R

From: Isaac Waisberg <ibergus_at_gmail.com>
Date: Wed 09 Mar 2005 - 04:43:16 EST


Hi;

I am working with the similarity matrix below and I would like to plot a two-dimensional MDS solution such as each point in the plot has a label.

This is what I did:

data <- read.table('c:/multivariate/mds/colour.txt',header=FALSE) similarity <- as.dist(data)
distance <- 1-similarity
result.nmds <- nmds(distance)
plot(result.nmds)

(nmds and plot.nmds as defined at
labdsv.nr.usu.edu/splus_R/lab8/lab8.html; nmds simply calls isoMDS)

Colour.txt, containing the similaity matrix, reads as follows:

 1.0 .86 .42 .42 .18 .06 .07 .04 .02 .07 .09 .12 .13 .16

.86 1.0 .50 .44 .22 .09 .07 .07 .02 .04 .07 .11 .13 .14
.42 .50 1.0 .81 .47 .17 .10 .08 .02 .01 .02 .01 .05 .03

.42 .44 .81 1.0 .54 .25 .10 .09 .02 .01 .01 .01 .02 .04

.18 .22 .47 .54 1.0 .61 .31 .26 .07 .02 .02 .01 .02 .01
.06 .09 .17 .25 .61 1.0 .62 .45 .14 .08 .02 .02 .02 .01
.07 .07 .10 .10 .31 .62 1.0 .73 .22 .14 .05 .02 .02 .01
.04 .07 .08 .09 .26 .45 .73 1.0 .33 .19 .04 .03 .02 .02
.02 .02 .02 .02 .07 .14 .22 .33 1.0 .58 .37 .27 .20 .23
.07 .04 .01 .01 .02 .08 .14 .19 .58 1.0 .74 .50 .41 .28
.09 .07 .02 .01 .02 .02 .05 .04 .37 .74 1.0 .76 .62 .55
.12 .11 .01 .01 .01 .02 .02 .03 .27 .50 .76 1.0 .85 .68
.13 .13 .05 .02 .02 .02 .02 .02 .20 .41 .62 .85 1.0 .76
.16 .14 .03 .04 .01 .01 .01 .02 .23 .28 .55 .68 .76 1.0
 

The first row corresponds to colour 1 (C1), the second to colour 2 (C2), and so on.

First, I'm not sure if this is correct or not. Second, obviously the points in the plot are not labeled. I suppose I must add a labels column and then print the labels together with the results. But, how should I do it?

Many thanks,

Isaac



R-help@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 Received on Wed Mar 09 04:57:10 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:41 EST