3
$\begingroup$

I know that if we use categorical variables in cluster analysis we would assume that the scale is continuous and we don't have this concept of distance between two adjacent categories. But what is the difference when you use dummy variables? The zeros and ones will be used anyway to calculate the distances in the cluster analysis. In a nutshell, why don't 0's and 1's have this same issue? Any references about it? Thanks

$\endgroup$

2 Answers 2

6
$\begingroup$

If you transform the category attribute to a 0-1 vector, you are in fact measuring the distance as "same = 0, different = 1", with no interim values. It doesn't gain you much actually, but it is at least less misleading. I strongly advise to control your results and algorithms with respect to this, as e.g. k-means will also produce "means" which are not sensible for binary attributes.

It harms less, because any two categories have the same difference. Say you have three categories, "red", "green", "blue":

category  continuous    dummy
red           0         1 0 0
green         1         0 1 0
blue          2         0 0 1

When represented using a continuous variable, the distance "blue-red" is twice as large as "blue-green". The algorithm will thus consider these to be more different! This does not happen with the dummy variables, here the distance is in fact binary. You can achieve the same effect with a trivial categorial distance function

$$\text{dist}(c_1, c_2) = \begin{cases}0 & \text{if } c_1=c_2 \\ 1 & \text{otherwise}\end{cases}$$

$\endgroup$
0
2
$\begingroup$

Binary variables 0 (absent) vs 1 (present) misleadingly look like scale (metrical) variables while in fact they aren't. At best, one could classify them as ordinal. Logically, in order to venture label a scale interval or ratio the scale must have at least 3 levels. In dichotomous scale, we have just 2, so we never have clues to speak on how much "present" is greater than "absent". Since that, no sensible univariate or multivariate mean can be ever computed with binary attributes (as @Anony-Mousse said already).

Since it is inappropriate to compute means with binary variables it is inappropriate to use clustering methods which engage with cluster centroids (such as K-means or Ward). Still, any clustering that base itself on counting presence or absense is justified. There is a great number of proximity measures specially designed for binary data to be used in clustering. Even euclidean distance could be used unless cluster centroids are computed.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.