cluagg {lmomRFA} | R Documentation |
Hierarchical clustering
Description
Performs cluster analysis by one of several agglomerative hierarchical methods.
Usage
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
|
Details
In agglomerative hierarchical clustering, there are initially n
clusters,
each containing one data point, labeled 1
through n
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 i
th stage of clustering there are n-i
clusters.
To find which data points belong to which clusters, use function
cluinf
.
Value
A list with elements as follows.
merge |
Matrix of dimension |
wgss |
Vector of length |
Note
Clustering is performed internally by function hclust
in the R stats package.
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
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)