0
$\begingroup$

I have two arrays, whose values are nominal categorical variables. Each element represents a zone of a city: in the first vector we have the class each zone belongs to (so these might also be seen as ordinal, since values span from 0 to 3, with 3 being the upper class -let's say richest- and 0 the poorest, but I am not sure about this). The second vector is made of names: each item is the name of the candidate who won the Presidential elections in that particular zone.

I would like to calculate the correlation between the two vectors, to find whether there is some kind of relationship between the class of the zone and the winning candidate (i.e. candidate X systematically won in the poorest zones), but I am not sure on how to calculate correlation between nominal variables. I found this question somewhat helpful, but the example provided in the answer does not match with my case.

$\endgroup$

2 Answers 2

1
$\begingroup$

The Chi-Squared test of independence (and subsequent Cramer's V test) give an indication of the relationship between two categorical variables.

$\endgroup$
0
$\begingroup$

Chi-Square is used to check whether any two categorical variables are independent. Ordinal is also categorical, so we can use it for the same. You can find my answer to a similar question here.

The only difference will be that you will change the $O_{ij}$ (Observed count of data points with the $i$th category of the first variable and $j$th category of the second variable) in the contingency table and corresponding $E_{ij}$ will change accordingly.

Once you have the contingency table, you can use R to find the association between those two variables.

$\endgroup$
1
  • $\begingroup$ Careful using this for ordinal variables. There are better alternatives. $\endgroup$
    – jiggunjer
    Commented Jun 3, 2019 at 10:17

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.