>>>>> "LS" == Linda Smith <lsmithingm at
gmail.com>
>>>>> on Mon, 3 Mar 2008 00:57:49 -0800 writes:
LS> Dear All,
LS> Is there any existing code for plotting silhouette for kmeans
clustering
LS> results?
Yes. Have you tried at all?
Anyway, here's some commented example code
(with a largish data) :
library(cluster)
data(xclara)
plot(xclara) # 3000 observations; a bit large for dissimilarity plotting
km <- kmeans(xclara,3)
## Now the silhouette concept builds on dissimilarities
## e.g.
dissE <- daisy(xclara) #-> large (!) 3000 x 3000 / 2
sk <- silhouette(km$cl, dissE)
plot(sk)
## but kmeans is rather equivalent to work with {D_ij}^2,
## hence this better corresponds:
dE2 <- dissE^2
sk2 <- silhouette(km$cl, dE2)
plot(sk2)
LS> Many thanks!
LS> Linda
you're welcome.
Martin Maechler, ETH Zurich