cluagg function

Hierarchical clustering

Hierarchical clustering

Performs cluster analysis by one of several agglomerative hierarchical methods.

cluagg(x, method="ward")

Arguments

  • x: A numeric matrix (or a data frame with all numeric columns, which will be coerced to a matrix). Contains the data: each row should contain the attributes for a single point.
  • method: Clustering method. Any method valid for hclust may be used.

Details

In agglomerative hierarchical clustering, there are initially nn clusters, each containing one data point, labeled 11 through nn

in the same order as the data points. At each stage of clustering, two clusters are merged. Their labels are saved in the merge array. The smaller of the two labels is used as the label of the merged cluster. After the iith stage of clustering there are nin-i clusters. To find which data points belong to which clusters, use function cluinf.

Returns

A list with elements as follows. - merge: Matrix of dimension (nrow(x)-1,2). The iith row contains the labels of the clusters merged at the iith merge.

  • wgss: Vector of length nrow(x)-1. The iith element is the total within-cluster dispersion after the iith merge.

References

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

Author(s)

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

Note

Clustering is performed internally by function hclust

in the stats package.

See Also

cluinf to get details of the clusters at a particular stage of the merging.

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)
  • Maintainer: J. R. M. Hosking
  • License: Common Public License Version 1.0
  • Last published: 2024-09-30

Useful links