Statistics Toolbox    
cluster

Construct clusters from linkage output

Syntax

Description

T = cluster(Z,'cutoff',c) constructs clusters from the hierarchical cluster tree, Z, 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 inconsistent values are less than c. See the inconsistent function for more information. The output T is a vector of size m that contains the cluster number for each observation in the original data.

T = cluster(Z,'maxclust',n) specifies n as the maximum number of clusters to form from the hierarchical tree in Z.

T = cluster(...,'criterion','crit') uses the specified criterion for forming clusters, where crit is either 'inconsistent' or 'distance'.

T = cluster(...,'depth',d) evaluates inconsistent values to a depth of d in the tree. The default is d = 2. An inconsistency coefficient computation compares a link between two objects in the cluster tree with neighboring links up to the specified depth. See the inconsistent function for more information.

Example

The example uses the pdist function to calculate the distance between items in a matrix of random numbers and then uses the linkage function to compute the hierarchical cluster tree based on the matrix. The example passes the output of the linkage function to the cluster function. The 'maxclust' value 3 indicates that you want to group the items into three clusters. The find function lists all the items grouped into cluster 1.

See Also

clusterdata, cophenet, inconsistent, linkage, pdist


  classify clusterdata