[R] cmdscale k=1

Bill Simpson W.Simpson at gcal.ac.uk
Fri Feb 15 11:07:06 CET 2002


In applying multidimensional scaling, it seems to me that sometimes the
underlying dimensionality of the matrix is 1.  However I found a case
where cmdscale failed when I tried k=1. Here it is:

m<-matrix(
c(.5,.81,.23,.47,.61,
.19,.5,.06,.17,.28,
.77,.94,.5,.74,.85,
.53,.83,.26,.5,.64,
.39,.72,.15,.36,.5),
nrow=5)

# BTW I think cmdscale uses only the lower triangle--how to enter only
# that bit and save some data entry?

fit<-cmdscale(dist(m),k=2) #k is number of dimensions
rownames(m,do.NULL=FALSE)
rownames(m)<-c("A","B","C","D","E")

x <- fit[,1]
y <- -fit[,2]
plot(x, y, type="n", xlab="", ylab="")
text(x, y, rownames(m))

#So far so good. Note that y dimension in plot is very small compared to x
#should be able to ditch the y dimension

fit<-cmdscale(dist(m),k=1)
fit
#nothing!

I found for other matrices that I could use k=1 and the result was
sensible. I'm not really sure how cmdscale works. Can someone please tell
me what is going on and if I'm unreasonable to expect k=1 to work?

Thanks!

Bill Simpson

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list