Construct agglomerative clusters from linkages

`T = cluster(Z,'cutoff',c)`

T = cluster(Z,'cutoff',c,'depth',d)

T = cluster(Z,'cutoff',c,'criterion',`criterion`

)

T = cluster(Z,'maxclust',n)

`T = cluster(Z,'cutoff',c)`

constructs
clusters from the agglomerative hierarchical cluster tree, `Z`

,
as generated by the `linkage`

function. `Z`

is
a matrix of size (`m`

– 1)-by-3, where `m`

is
the number of observations in the original data. `c`

is
a threshold for cutting `Z`

into clusters. Clusters
are formed when a node and all of its subnodes have `inconsistent`

value less than `c`

.
All leaves at or below the node are grouped into a cluster. `t`

is
a vector of size `m`

containing the cluster assignments
of each observation.

If `c`

is a vector, `T`

is
a matrix of cluster assignments with one column per cutoff value.

`T = cluster(Z,'cutoff',c,'depth',d)`

evaluates
inconsistent values by looking to a depth `d`

below
each node. The default depth is `2`

.

`T = cluster(Z,'cutoff',c,'criterion',`

uses
the specified criterion for forming clusters, where `criterion`

)`criterion`

is
one of the strings `'inconsistent'`

(default) or `'distance'`

.
The `'distance'`

criterion uses the distance between
the two subnodes merged at a node to measure node height. All leaves
at or below a node with height less than `c`

are
grouped into a cluster.

`T = cluster(Z,'maxclust',n)`

constructs
a maximum of `n`

clusters using the `'distance'`

criterion. `cluster`

finds
the smallest height at which a horizontal cut through the tree leaves `n`

or
fewer clusters.

If `n`

is a vector, `T`

is
a matrix of cluster assignments with one column per maximum value.

Compare clusters from Fisher iris data with species:

load fisheriris d = pdist(meas); Z = linkage(d); c = cluster(Z,'maxclust',3:5); crosstab(c(:,1),species) ans = 0 0 2 0 50 48 50 0 0 crosstab(c(:,2),species) ans = 0 0 1 0 50 47 0 0 2 50 0 0 crosstab(c(:,3),species) ans = 0 4 0 0 46 47 0 0 1 0 0 2 50 0 0

`clusterdata`

| `cophenet`

| `inconsistent`

| `linkage`

| `pdist`

Was this topic helpful?