Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I'm using R to do K-means clustering. I'm using 14 variables to run K-means

  • What is a pretty way to plot the results of K-means?
  • Are there any existing implementations?
  • Does having 14 variables complicate plotting the results?

I found something called GGcluster which looks cool but it is still in development. I also read something about sammon mapping, but didn't understand it very well. Would this be a good option?

share|improve this question
If for some reason you are concerned with the present solutions for this very practical problem, please consider adding comments to existing replies or update your post with more context. Working with 40,000 cases is an important information here. – chl Jun 27 '12 at 19:57

2 Answers

up vote 4 down vote accepted

I'd push the silhouette plot for this, because it's unlikely that you'll get much actionable information from pair plots when the number of dimension is 14.

library(cluster)
library(HSAUR)
data(pottery)
km <- kmeans(pottery,3)
dissE <- daisy(pottery) 
dE2 <- dissE^2
sk2 <- silhouette(km$cl, dE2)
plot(sk2)

This approach is highly cited and well known (see here for an explanation).

Rousseeuw, P.J. (1987) Silhouettes: A graphical aid to the interpretation and validation of cluster analysis. J. Comput. Appl. Math., 20, 53-65.

share|improve this answer
I like this. I'll look further into it. Thank you. – JEquihua Jun 25 '12 at 20:39

Here an example that can helps you:

library(cluster)
library(fpc)

data(iris)
dat <- iris[, -5] # without known classification 
# Kmeans clustre analysis
clus <- kmeans(dat, centers=3)
# Fig 01
plotcluster(dat, clus$cluster)

# More complex
clusplot(dat, clus$cluster, color=TRUE, shade=TRUE, 
         labels=2, lines=0)

# Fig 03
with(iris, pairs(dat, col=c(1:3)[clus$cluster])) 

Based on the latter plot you could decide which of your initial variables to plot. Maybe 14 variables are huge, so you can try a principal component analysis (PCA) before and then use the first two or three components from the PCA to perform the cluster analysis.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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