Similarities between variables used for clustering are calculated by this function. For each combination of different data types, an appropriate measure for association is chosen, see details.
vector of class
vector of class
The following association measures for respective types of variables are chosen:
quantitative vs quantitative/ordinal: absolute Spearman correlation coefficient
ordinal vs ordinal: absolute Goodman and Kruskal's gamma coefficient (Goodman and Kruskal, 1954)
quantitative/ordinal vs binary: absolute Goodman and Kruskal's gamma coefficient
quantitative vs categorical (>2 categories): The categories of the categorical variable are reordered with respect to average ranks of the quantitative variable within those categories. Then absolute Spearman correlation coefficient is calculated as if it was an ordered factor. To avoid over-optimism, the reordering is only applied if a Kruskal-Wallis pre-test of association yields a significant result (p<0.05).
ordinal vs categorical (>2 categories): as for 'quantitative vs categorical', but instead of Spearman correlation the absolute Goodman and Kruskal's gamma coefficient is calculated
categorical vs categorical: Also in this case the reordering strategy is applied by "diagonalizing" the cross-table between the two factors (see
optile from the
Association is then measured by absolute Goodman and Kruskal's gamma coefficient. To avoid over-optimism, the reordering is only applied if a chi-square pre-test of association yields a significant result (p<0.05).
Estimated value of association between
Goodman LA and Kruskal WH (1954). Measures of association for cross classifications. Journal of the American Statistical Association, 49:732-764.
1 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.