library(seriation)

We use the Ruspini data set with 4 clusters

data("ruspini", package="cluster")
d <- dist(ruspini)

Original data (dissimilarity matrix shading)

Look for dark blocks (small distances) along the diagonal

pimage(d)

Reorder using cluster labels = coarse seriation

Ruspini has 4 clusters but we use incorrectly 10!

l <- kmeans(ruspini, 10)$cluster
dissplot(d, method = NA, labels = l)

With reordering

dissplot(d, labels = l)

The plot reassembles the four clusters # Using too few clusters

l <- kmeans(ruspini, 3)$cluster

dissplot(d, labels = l)

dissplot(d, labels = l, zlim= c(0,40))

Note that one cluster consists of 2 clusters (two dark blocks)!

Use different seriation methods (see ? seriate)

Gradient measure

dissplot(d, labels= l, method = list(intra="ARSA", inter="ARSA"))

Hamiltonian path

dissplot(d, labels= l, method = list(intra="TSP", inter="TSP"))

Hierarchical clustering

dissplot(d, labels= l, method = list(intra="HC_average", inter="HC_average"))

dissplot(d, labels= l, method = list(intra="OLO", inter="OLO"))

Scaling and others

dissplot(d, labels= l, method = list(intra="MDS", inter="MDS"))

dissplot(d, labels= l, method = list(intra="R2E", inter="R2E"))

dissplot(d, labels= l, method = list(intra="Spectral", inter="Spectral"))

dissplot(d, labels= l, method = list(intra="Spin", inter="Spin"))

Clusterability

Using Dissplot

dissplot(d)

dissplot(d, zlim=c(0,40))

dissplot(d, col=bluered(100, bias=1))