# Correlation between nominal categorical variables

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.

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.