4
$\begingroup$

I have a random variable $T$ that takes values in $\{ \text{blue}, \text{green}, \text{red} \}$, and a number of observations of $T$:

|i  |T     |
|:--|:-----|
|1  |red   |
|2  |red   |
|3  |green |
|4  |red   |
|5  |blue  |
|6  |blue  |
|7  |green |
|8  |red   |
|9  |green |

or a matrix that looks like:

|  i| T_blue| T_green| T_red|
|--:|------:|-------:|-----:|
|  1|      0|       0|     1|
|  2|      0|       0|     1|
|  3|      0|       1|     0|
|  4|      0|       0|     1|
|  5|      1|       0|     0|
|  6|      1|       0|     0|
|  7|      0|       1|     0|
|  8|      0|       0|     1|
|  9|      0|       1|     0|

What is the distance between any two rows of this matrix?

I know that, in general, the Jaccard index is recommended for binary data. Is this distance still meaningful when the columns are mutually exclusive across rows? That is, it reduces to an indicator for concordance: $\operatorname{Jaccard}(T_i,T_j) \in \{0, 1\}\ \forall\ i,j$. Is this nonstandard? Is there a better metric I should use?

Background

I would like to find the distance correlation between a categorical variable $T$ and a continuous variable $X$. As far as I can tell, this is conceptually valid because the distance correlation measures the deviation of $f(T,X)$ from $f(T)f(X)$, which has nothing to do with $T$ or $X$ themselves. Moreover, it is defined in terms of pairwise distances "within" variables, so it doesn't run into the messy issue of explicitly defining a distance between a categorical variable and a continuous one.

Do any special considerations arise for my use case?

$\endgroup$
9
  • $\begingroup$ Is the order of observations meaningful? If not, you can regard the data as a one-dimensional contingency table. $\endgroup$ – Kodiologist Mar 10 '15 at 20:26
  • $\begingroup$ @Kodiologist the order is only meaningful insofar as the observations of $X$ and $T$ have the same "case id," but that isn't important because it gets washed out in computing the distance covariance. But I'm afraid I don't see how the contingency table interpretation helps here. $\endgroup$ – shadowtalker Mar 10 '15 at 21:03
  • $\begingroup$ When you compare cases by a single set of dummy variables Jaccard (as well as most other similarity measures for binary data) obviously can take on only values 1 and 0, so what's the use of it? $\endgroup$ – ttnphns Mar 10 '15 at 21:59
  • $\begingroup$ @ttnphns well, it becomes a measure of concordance. My question is whether concordance-as-distance makes sense for computing distance covariance. $\endgroup$ – shadowtalker Mar 10 '15 at 22:26
  • 2
    $\begingroup$ @ssdecontrol I now realize that you asked about distance between rows rather than distance between columns. Sorry, my mistake. In the case of distance between rows of this matrix, the only sensible metric is the discrete metric (1 for rows that are different and 0 for rows that are the same) unless you know something more about the relationship of the possible values of T to each other. So you were right in not being able to find a better metric. $\endgroup$ – Kodiologist Mar 11 '15 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.