agnes.object {cluster} | R Documentation |
The objects of class "agnes"
represent an agglomerative hierarchical clustering of a dataset.
A legitimate agnes
object is a list with the following components:
order |
a vector giving a permutation of the original observations to allow for plotting, in the sense that the branches of a clustering tree will not cross. |
order.lab |
a vector similar to |
height |
a vector with the distances between merging clusters at the successive stages. |
ac |
the agglomerative coefficient, measuring the clustering structure of the dataset. For each observation i, denote by m(i) its dissimilarity to the
first cluster it is merged with, divided by the dissimilarity of the
merger in the final step of the algorithm. The |
merge |
an (n-1) by 2 matrix, where n is the number of observations. Row i
of |
diss |
an object of class |
data |
a matrix containing the original or standardized measurements, depending
on the |
This class of objects is returned from agnes
.
The "agnes"
class has methods for the following generic functions:
print
, summary
, plot
, and
as.dendrogram
.
In addition, cutree(x, *)
can be used to “cut”
the dendrogram in order to produce cluster assignments.
The class "agnes"
inherits from "twins"
.
Therefore, the generic functions pltree
and
as.hclust
are available for agnes
objects.
After applying as.hclust()
, all its methods are
available, of course.
agnes
, diana
,
as.hclust
, hclust
,
plot.agnes
, twins.object
.
data(agriculture)
ag.ag <- agnes(agriculture)
class(ag.ag)
pltree(ag.ag) # the dendrogram
## cut the dendrogram -> get cluster assignments:
(ck3 <- cutree(ag.ag, k = 3))
(ch6 <- cutree(as.hclust(ag.ag), h = 6))
stopifnot(identical(unname(ch6), ck3))