What is the chi-square test of independence?
Let’s say there are two categorical or nominal variables. And we want to know whether the two variables are related. For example, let’s say there is a movie hall. Certain categories of movies are shown there. People go there to watch movies, and they buy snacks sometimes. Now, let’s say the owner of the movie theater wants to determine the number of snacks to buy. So, he wants to know whether the types of movies have any relation to the number of snacks people consume while watching the movies.
We can perform a chi-square test of independence, in this case, to determine whether these two categorical variables – types of movies and consumption of snacks have any relation.
To perform this hypothesis test, we need to create a contingency table that contains the observed counts of each category and summarizes the data. Please note that to perform the chi-square test of independence, we need to meet certain criteria. They are:
1. There should be two categorical variables.
2. There should be two or more groups for each categorical variable.
3. The expected frequencies should be at least five for the majority of the cells.
How to calculate the test statistic in the chi-square test of independence?
Let’s say we are given the following table:
| Types of Movies | Snacks | No Snacks | Row Total |
|---|---|---|---|
| Action | 80 | 120 | 200 |
| Comedy | 70 | 110 | 180 |
| Horror | 40 | 80 | 120 |
| Column Total | 190 | 310 | 500 |
Firstly, we need to calculate the expected frequencies for each cell. The expected frequency of a cell is given by: …








































0 Comments