TransWikia.com

Correlation between nominal categorical variables

Data Science Asked by sato on February 17, 2021

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.

2 Answers

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

Answered by bradS on February 17, 2021

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.

Answered by Curiousdeveloper on February 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP