A chi-square test is a statistical tool used to test for independence or dependence (or goodness-of-fit) between random variables taken from different populations. A chi-square test could also be used for testing for goodness between an observed frequency distribution and an expected frequency distribution. With the chi-square test you are comparing a target variance with an observed variance. It is used to test the independence of two nominal variables. Remember that nominal variables are names or categories only. Nominal variables could be a scale of numbers, symbols, or names to designate different subclasses. For example, colors.
When using the chi-square test of association/independence you are going to calculate a chi-square test statistic. And, you are going to compare that test statistic with the chi-square critical value taken from a table, from the internet, or from software. Like other tests such as the F-test and the t-test, you are either going to reject the null hypothesis or you were going to fail to reject the null hypothesis. Either way, you are going to learn something. If you reject the null hypothesis, you will conclude that there is sufficient evidence to conclude that there is dependence between the two random variables. If, on the other hand, you fail to reject the null, your conclusion will be that there is insufficient evidence to conclude that the two random variables are significantly different from one another. In other words, the two random variables appear to not be dependent upon each other.
Use: It’s human nature to want to know whether something is better, or worse, or simply just different from each other. Perhaps you can think of a time when you found something to be ironic. You thought that it was one way, and it turned out to be different. Maybe you walked up behind someone on the street thinking it was a friend and when they turned around, much to your surprise, it is someone you don’t even know. The chi-square test of association/independence is for checking for these anomalies. You might start off thinking that two random variables taken from two different populations would be dependent upon each other – and maybe it turns out that they are dependent upon each other. Other times, you might think two random variables from different populations are independent from each other, and you find out that they are not independent (in other words, DEPENDENT). The chi-square test using the chi-square distribution can sort this out for you.