0
$\begingroup$

I've been searching for some time for a correlation metric analogous to the Pearson correlation value for numerical vs numerical features, or Cramér's V for categorical vs categorical features, but this time for categorical vs numerical features.

This is my toy data example in Python, where the categorical variable is not ordinal and notice that the number of observations per class of the categorical feature is not the same:

pd.DataFrame({'numerical': np.array([19, 27, 31, 26, 39, 43, 32, 29, 19, 19, 27, 31]), 
              'categorical': np.array(['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C', 'C'])})

I've seen a lot of answers referring Interclass Correlation (but I don't have a square matrix and also I don't have subjects being analysed by several judges...). Also, I've seen that the use of one-way ANOVA is also frequent, but it does not solve the problem because it does not translate in a clear strength of association coefficient as Pearson.

Can you suggest a metric or it is impossible to have one for this case?

$\endgroup$
5
  • 1
    $\begingroup$ As written this doesn't make much sense to me. Correlation by definition assumes that there is a paired ordering between your variables. So if $X$ increases, then $Y$ tends to increase too, when considered simultaneously. In your example, I don't see any indication of such a pairing: you just have a list of categorical variables along with their values. So what do you mean by correlation here? $\endgroup$ – Alex R. Oct 19 '17 at 18:51
  • 2
    $\begingroup$ @AlexR. For instance, Cramér's V does not assume any ordering (right?) and nevertheless it is an association metric. I was wondering if there is something like it for this case. $\endgroup$ – the_owl Oct 19 '17 at 18:59
  • 1
    $\begingroup$ Cramer's V also has simultaneous pairings. It looks at $n_{ij}$ which is the number of occurances of $(A_i,B_j)$. Again, if you want to understand associations between two variables, you need to look at their joint occurrences, which is not clear from your setup. $\endgroup$ – Alex R. Oct 19 '17 at 19:07
  • 1
    $\begingroup$ Ok. I hope to made it clear now. It is pairwise occurances $\endgroup$ – the_owl Oct 19 '17 at 21:42
  • $\begingroup$ Cramér's V is for two nominal variables. $\endgroup$ – SmallChess Oct 20 '17 at 0:11