cluagg | R Documentation |
Performs cluster analysis by one of several agglomerative hierarchical methods.
cluagg(x, method="ward")
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
|
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
.
A list with elements as follows.
merge |
Matrix of dimension |
wgss |
Vector of length |
Clustering is performed internally by function hclust
in the R stats package.
J. R. M. Hosking jrmhosking@gmail.com
Hosking, J. R. M., and Wallis, J. R. (1997).
Regional frequency analysis: an approach based on L
-moments.
Cambridge University Press.
cluinf
to get details of the clusters
at a particular stage of the merging.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.