Perform the following steps to compute the silhouette information:
- Use kmeans to generate a k-means object, km:
> set.seed(22) > km = kmeans(customer, 4)
- You can then compute the silhouette information:
> kms = silhouette(km$cluster,dist(customer)) > summary(kms) Output Silhouette of 60 units in 4 clusters from silhouette.default(x =
km$cluster, dist = dist(customer)) : Cluster sizes and average silhouette widths: 8 11 16 25 0.5464597 0.4080823 0.3794910 0.5164434 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.1931 0.4030 0.4890 0.4641 0.5422 0.6333
- Next, you can plot the silhouette information:
> plot(kms)
The silhouette plot of the k-means clustering result