cluinf: Provide information about a hierarchical clustering

View source: R/lmomRFA.r

cluinfR Documentation

Provide information about a hierarchical clustering

Description

Agglomerative hierarchical clustering procedures typically produce a list of the clusters merged at each stage of the clustering. cluinf uses this list to construct arrays that explicitly show which cluster a given data point belongs to, and which data points belong to a given cluster.

Usage

cluinf(merge, nclust)

Arguments

merge

Matrix with 2 columns. The ith row contains the labels of the clusters merged at the ith merge.

Can also be the object returned by a call to cluagg.

nclust

Number of clusters.

Value

Information about the clustering that has nclust clusters. It is a list with the following elements:

assign

Vector giving the assignment of items to clusters.

list

List with nclust elements. Each element contains the labels of the items in one cluster.

num

Vector of length nclust, containing the number of items in each cluster.

Author(s)

J. R. M. Hosking jrmhosking@gmail.com

References

Hosking, J. R. M., and Wallis, J. R. (1997). Regional frequency analysis: an approach based on L-moments. Cambridge University Press.

See Also

cluagg

Examples

## Clustering of gaging stations in Appalachia, as in Hosking
## and Wallis (1997, sec. 9.2.3)
data(Appalach)
# Form attributes for clustering (Hosking and Wallis's Table 9.4)
att <- cbind(a1 = log(Appalach$area),
             a2 = sqrt(Appalach$elev),
             a3 = Appalach$lat,
             a4 = Appalach$long)
att <- apply(att, 2, function(x) x/sd(x))
att[,1] <- att[,1] * 3
# Clustering by Ward's method
(cl<-cluagg(att))
# Details of the clustering with 7 clusters
cluinf(cl, 7)

lmomRFA documentation built on Aug. 29, 2023, 9:07 a.m.