Agglomerative hierarchical cluster tree

`Z = linkage(X)`

`Z = linkage(X,method)`

`Z = linkage(X,method,metric)`

`Z = linkage(X,method,metric,'savememory',value)`

`Z = linkage(X,method,pdist_inputs)`

`Z = linkage(y)`

`Z = linkage(y,method)`

Computing

`linkage(y)`

can be slow when`y`

is a vector representation of the distance matrix. For the`'centroid'`

,`'median'`

, and`'ward'`

methods,`linkage`

checks whether`y`

is a Euclidean distance. Avoid this time-consuming check by passing in`X`

instead of`y`

.The

`'centroid'`

and`'median'`

methods can produce a cluster tree that is not monotonic. This result occurs when the distance from the union of two clusters,*r*and*s*, to a third cluster is less than the distance between*r*and*s*. In this case, in a dendrogram drawn with the default orientation, the path from a leaf to the root node takes some downward steps. To avoid this result, use another method. This figure shows a nonmonotonic cluster tree.In this case, cluster 1 and cluster 3 are joined into a new cluster, and the distance between this new cluster and cluster 2 is less than the distance between cluster 1 and cluster 3. The result is a nonmonotonic tree.

You can provide the output

`Z`

to other functions including`dendrogram`

to display the tree,`cluster`

to assign points to clusters,`inconsistent`

to compute inconsistent measures, and`cophenet`

to compute the cophenetic correlation coefficient.

`cluster`

| `clusterdata`

| `cophenet`

| `dendrogram`

| `inconsistent`

| `kmeans`

| `pdist`

| `silhouette`

| `squareform`