Econometrics

# Test for equality of categorical varibles

In the standard statistics case, when you compare two continuous variables, you can use a t-test to determine equality of means.  For instance, you may want to know if LeBron James scores more points on average than Kevin Durant.

However, what if you want to instead compare two categorical variables.  For instance, assume you are living on a desert island with no access to the internet and your only data is the number of games in which each basketball player scores 0-10 points, 11-20 points, 21-30 points, 31-40 points and 40+ points.  In this case, you do not have the average value since you do not observe the average number of points scored within each bucket.  Further, categorical variables may not always be numerical.  Consider a Likert scale where responses are stratified into 5 levels: strongly disagree, disagree, neither agree nor disagree, agree, and strongly agree.  In this case, an average score may or may not be informative.

Thus, to test the equality of categorical variables, one can use a chi-squared test.  Here is a downloadable example of how to use it, drawn from here.