xlab = "k (number of clusters)",
ylab = "Average silhouette width"
)
axis(
1,
k.best,
paste("optimum", k.best, sep = "\n"),
col = "red",
font = 2,
col.axis = "red"
)
points(k.best,
max(asw),
pch = 16,
col = "red",
cex = 1.5)
The not very interesting result k=2 is the best PAM solution with asw = 0.3841.
Our previous choice of k=4 ends up with a poor performance in terms of
silhouette width (asw = 0.2736). Nevertheless, let us compute a PAM for 4
groups:
# PAM for k = 4 clusters
spe.ch.pam <- pam(spe.ch, k = 4, diss = TRUE)
summary(spe.ch.pam)
spe.ch.pam.g <- spe.ch.pam$clustering
spe.ch.pam$silinfo$widths
# Compare with classification from Ward clustering and from k-means
table(spe.ch.pam.g, spech.ward.g)
table(spe.ch.pam.g, spe.kmeans.g)
The PAM result differs markedly from those of the Ward and k-means clusterings.
4.8 Non-hierarchical Clustering
105
ylab = "Average silhouette width"
)
axis(
1,
k.best,
paste("optimum", k.best, sep = "\n"),
col = "red",
font = 2,
col.axis = "red"
)
points(k.best,
max(asw),
pch = 16,
col = "red",
cex = 1.5)
The not very interesting result k=2 is the best PAM solution with asw = 0.3841.
Our previous choice of k=4 ends up with a poor performance in terms of
silhouette width (asw = 0.2736). Nevertheless, let us compute a PAM for 4
groups:
# PAM for k = 4 clusters
spe.ch.pam <- pam(spe.ch, k = 4, diss = TRUE)
summary(spe.ch.pam)
spe.ch.pam.g <- spe.ch.pam$clustering
spe.ch.pam$silinfo$widths
# Compare with classification from Ward clustering and from k-means
table(spe.ch.pam.g, spech.ward.g)
table(spe.ch.pam.g, spe.kmeans.g)
The PAM result differs markedly from those of the Ward and k-means clusterings.
4.8 Non-hierarchical Clustering
105
