This function performs a hierarchical cluster analysis
using a set of dissimilarities for the $n$ objects being
clustered. Initially, each object is assigned to its own
cluster and then the algorithm proceeds iteratively,
at each stage joining the two most similar clusters,
continuing until there is just a single cluster.
At each stage distances between clusters are recomputed
by the Lance--Williams dissimilarity update formula
according to the particular clustering method being used. A number of different clustering methods are provided.
Ward's minimum variance method aims at finding compact,
spherical clusters. The complete linkage method finds
similar clusters. The single linkage method
(which is closely related to the minimal spanning tree)
adopts a `friends of friends' clustering strategy.
The other methods can be regarded as aiming
for clusters with characteristics somewhere between
the single and complete link methods.
If members!=NULL
, then d
is taken to be a
dissimilarity matrix between clusters instead of dissimilarities
between singletons and members
gives the number of observations
per cluster. This way the hierarchical cluster algorithm can be ``started
in the middle of the dendrogram'', e.g., in order to reconstruct the
part of the tree above a cut (see examples). Dissimilarities between
clusters can be efficiently computed (i.e., without hclustglad
itself) only for a limited number of distance/linkage combinations,
the simplest one being squared Euclidean distance and centroid
linkage. In this case the dissimilarities between the clusters are
the squared Euclidean distances between cluster means.
In hierarchical cluster displays, a decision is needed at each merge to
specify which subtree should go on the left and which on the right.
Since, for $n$ observations there are $n-1$ merges,
there are $2^{(n-1)}$ possible orderings for the leaves
in a cluster tree, or dendrogram.
The algorithm used in hclustglad
is to order the subtree so that
the tighter cluster is on the left (the last, i.e. most recent,
merge of the left subtree is at a lower value than the last
merge of the right subtree).
Single observations are the tightest clusters possible,
and merges involving two observations place them in order by their
observation sequence number.