flatVShier
carries out the comparison and visualisation of the
relationships between a hierarchical and a flat clusterings. The
hierarchical one is shown either as a complete or pruned tree, whose
collapsed branches are nodes on the left hand side layer of a bi-graph. The
flat clusters are represented on the right hand side. Branches and flat
clusters are connected with edges, whose thickness represents the number of
elements common to both sets. The number of edge crossings is minimised
using the barycentre algorithm on the right hand side; also, the children
corresponding to the last split in the dendrogram when exploring it by
depth-first search are swapped if this decreases the number of crossings.flatVShier(tree, flat.clustering, flat.order = NULL, max.branches = 100, look.ahead = 2, pausing = TRUE, verbose = TRUE, h.min = 0.04, line.wd = 3, greedy = TRUE, greedy.colours = NULL, score.function = "crossing", expanded = FALSE, labels = NULL, cex.labels = 1, main = NULL)
hclust
object, or structure that can be converted
to hclust object, corresponding to a data set of size N.SCmapping
. # simulated data
set.seed(0)
dataset <- rbind(matrix(rnorm(20), 5, 4), sweep(matrix(rnorm(24), 6, 4),
2, 1:4, "+"))
tree <- hclust(dist(dataset))
# two clusters
flat <- kmeans(dataset,2)$cluster
collapsed1 <- flatVShier(tree, flat, pausing = FALSE)
# four clusters
flat<-kmeans(dataset, 4)$cluster
collapsed2 <- flatVShier(tree, flat)
## expanded tree
expanded1 <- flatVShier(tree, flat, pausing = FALSE, score.function = "it",
expanded = TRUE)
Run the code above in your browser using DataLab