I am trying to get to grips with Clustering and Visualisation.

I have a set of data (a matrix) that I want to cluster (using R) and then visualise (HTML5 Canvas).

So, I can use MDS to get the coordinates of a matrix, for example:

cells <- c(1, 1, 2, 1, 4, 3, 5, 4)
rnames <- c("A", "B", "C", "D")
cnames <- c("X", "Y")
x <- matrix(cells, nrow=4, ncol=2, byrow=TRUE, dimnames=list(rnames, cnames))
d <-dist(x)
m <- cmdscale(d,eig=TRUE, k=3)
m <- cmdscale(d,eig=TRUE, k=2)

But, should I first cluster this data (using something like k-means) or should I cluster the output of MDS? Or can I just cluster (and get the coordinates using some other method) and ignore MDS?

What is the relationship between MDS and K-means, if any?

I am unsure what is the best way to approach?

Any suggestions?



  • $\begingroup$ Why do you think you need MDS - your data matrix are already pairwise distances rather than original cases X variables? $\endgroup$ – ttnphns Jan 25 '12 at 15:01
  • $\begingroup$ Thanks for the comment. I think this is what I am trying to figure out? So, if I cluster (suing kmeans for example) I should get a pairwise matrix in return, how do I access the coordinates (or points) of that matrix. This is probably a very rudimentary question but I just want to make sure I understand it correctly. Thanks again. $\endgroup$ – slotishtype Jan 25 '12 at 15:14

Basically, with MDS you create a 2D map for your data with one icon for one data point. With clustering algorithm you color icons with different colors (or cluster labels). MDS and clustering algorithm should be used independently from each other. It does not make much sense to apply clustering algorithm on the X,Ys created with MDS.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.