cophenetic
Cophenetic Distances for a Hierarchical Clustering
Description
Compute the distances between the leaves of a clustering tree.
Usage
# Generic function
cophenetic(x)
## Default S3 method:
cophenetic(x)
## S3 method for class 'dendrogram':
cophenetic(x)
Arguments
x |
an object represented as a hierarchical clustering.
|
Details
cophenetic is a generic function. The default method and a method
for class "dendrogram" have been implemented in the "stats" package.
Other packages might define methods for other classes.
In the default method, the argument x should be an object of class "hclust"
or any object that could be coerced to an "hclust" object via as.hclust.
The cophenetic distance between two leaves of a tree is the height of
the closest node that leads to both leaves.
Value
returns an object of class "dist", representing the lower triangle of the matrix
of cophenetic distances between the leaves of the clustering object.
Use as.matrix to convert this value to a symmetrix matrix of distances.
The various methods can put the leaves in various orders. Use
the names in dimnames(as.matrix(returnValue)) to identify them.
References
Sneath, P. H. A. and Sokal, R. R. 1973. Numerical Taxonomy: The Principles and Practice of Numerical Classification. San Francisco, CA: Freeman. 278ff.
See Also
Examples
eDst <- dist(Sdatasets::swiss.x[1:6,]) # Euclidean distance
hc <- hclust(eDst)
c1Dst <- cophenetic(hc) # cophenetic.default()
c1Dst
dendr <- as.dendrogram(hc)
c2Dst <- cophenetic(dendr) # cophenetic.dendrogram()
as.matrix(c2Dst)