returns the inconsistency coefficient for each link of the hierarchical cluster tree
Y = inconsistent(
Z generated by the
inconsistent calculates the
inconsistency coefficient for each link by comparing its height with the average
height of other links at the same level of the hierarchy. The larger the
coefficient, the greater the difference between the objects connected by the link.
For more information, see Algorithms.
Inconsistency Coefficient Calculation
Examine an inconsistency coefficient calculation for a hierarchical cluster tree.
examgrades data set.
Create a hierarchical cluster tree.
Z = linkage(grades);
Create a matrix of inconsistency coefficient information using
inconsistent. Examine the information for the 84th link.
Y = inconsistent(Z); Y(84,:)
ans = 1×4 7.2741 0.3624 3.0000 0.5774
The fourth column of
Y contains the inconsistency coefficient, which is computed using the mean in the first column of
Y and the standard deviation in the second column of
Because the rows of
Y correspond to the rows of
Z, examine the 84th link in
ans = 1×3 190.0000 203.0000 7.4833
The 84th link connects the 190th and 203rd clusters in the tree and has a height of
7.4833. The 190th cluster corresponds to the link of index , where 120 is the number of observations. The 203rd cluster corresponds to the 83rd link.
inconsistent uses two levels of the tree to compute
Y. Therefore, it uses only the 70th, 83rd, and 84th links to compute the inconsistency coefficient for the 84th link. Compare the values in
Y(84,:) with the corresponding computations by using the link heights in
mean84 = mean([Z(70,3) Z(83,3) Z(84,3)])
mean84 = 7.2741
std84 = std([Z(70,3) Z(83,3) Z(84,3)])
std84 = 0.3624
inconsistent84 = (Z(84,3)-mean84)/std84
inconsistent84 = 0.5774
Compute Inconsistency Coefficient
Create the sample data.
X = gallery('uniformdata',[10 2],12); Y = pdist(X);
Generate the hierarchical cluster tree.
Z = linkage(Y,'single');
Generate a dendrogram plot of the hierarchical cluster tree.
Compute the inconsistency coefficient for each link in the cluster tree Z to depth 3.
W = inconsistent(Z,3)
W = 9×4 0.1313 0 1.0000 0 0.1386 0 1.0000 0 0.1463 0.0109 2.0000 0.7071 0.2391 0 1.0000 0 0.1951 0.0568 4.0000 0.9425 0.2308 0.0543 4.0000 0.9320 0.2395 0.0748 4.0000 0.7636 0.2654 0.0945 4.0000 0.9203 0.3769 0.0950 3.0000 1.1040
Z — Agglomerative hierarchical cluster tree
Agglomerative hierarchical cluster tree, specified as a numeric matrix
Z is an (m – 1)-by-3 matrix, where m is the number of
observations. Columns 1 and 2 of
Z contain cluster
indices linked in pairs to form a binary tree.
contains the linkage distances between the two clusters merged in row
d — Depth
2 (default) | positive integer scalar
Depth, specified as a positive integer scalar. For each link
inconsistent calculates the
corresponding inconsistency coefficient using all the links in the tree
d levels below k.
Y — Inconsistency coefficient information
Inconsistency coefficient information, returned as an (m – 1)-by-4 matrix, where the (m – 1) rows correspond to the rows of
This table describes the columns of
Mean of the heights of all the links included in the calculation
Standard deviation of the heights of all the links included in the calculation
Number of links included in the calculation
For each link k, the inconsistency coefficient is calculated as
For links that have no further links below them, the inconsistency coefficient is set to 0.
 Jain, A., and R. Dubes. Algorithms for Clustering Data. Upper Saddle River, NJ: Prentice-Hall, 1988.
 Zahn, C. T. “Graph-theoretical methods for detecting and describing Gestalt clusters.” IEEE Transactions on Computers. Vol. C-20, Issue 1, 1971, pp. 68–86.
Introduced before R2006a