# Correlation between scale and categorical variable [duplicate]

This question already has an answer here:

I am trying to find the correlation or association between a categorical variable - classes from 1 -4 from a GIS (geographic information system) classification - and a continuous variable with values between 0 and 9. What would be the best test to use for this?

## marked as duplicate by kjetil b halvorsen, mdewey, gung♦, Peter Flom♦May 22 '17 at 12:22

• Is your continuous variable really continuous or discrete? That is, can it take values such as 2.5, or only 0, 1, 2, ...? – Stephan Kolassa Aug 23 '13 at 8:02
• The values can range anywhere between 0 - 9, ie values of 1.6, 1.65, 1.7. – Bee Aug 23 '13 at 8:18

1. Perform an analysis of variance (ANOVA) on the continuous variable separated into the modalities of the categorical variable. The idea is to look at the variance of the continuous variable within each class $s_i$ and compare it to the total variance $s_t$. The correlation coefficient for one class compared to the total is then $\eta_i = \sqrt{s_i / s_t}$