association: Function to calculate a measure for association between two... In CluMix: Clustering and Visualization of Mixed-Type Data

Description

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.

Usage

 `1` ```association(x, y) ```

Arguments

 `x` vector of class `numeric`, `factor`, `ordered`, or `logical` `y` vector of class `numeric`, `factor`, `ordered`, or `logical`

Details

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 `extracat` package). 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).

Value

Estimated value of association between `x` and `y`

Manuela Hummel

References

Goodman LA and Kruskal WH (1954). Measures of association for cross classifications. Journal of the American Statistical Association, 49:732-764.

`similarity.variables`, `dist.variables`,
 ```1 2 3``` ```x <- rnorm(100) y <- as.factor(sample(1:3, 100, replace=TRUE)) association(x, y) ```