Introducing Chi-Square Test of Independence
Overview
Andy Baker introduces the chi-square test of independence as a method for checking whether two categorical variables are associated by comparing observed frequencies with counts expected under independence. Using 80 students grouped by major and study location, he calculates χ² = 11.42 with 1 degree of freedom, exceeds the 0.05 critical value of 3.84, and concludes that major and preferred study location are related.
Key takeaways
- A chi-square test of independence assesses whether two categorical variables are associated by comparing observed cell frequencies with frequencies expected if the variables were independent.
- For each contingency-table cell, the expected frequency is the row total multiplied by the column total and divided by the grand total.
- In the 80-student example, the observed counts are 30, 10, 15, and 25, while the expected counts under independence are 22.5, 17.5, 22.5, and 17.5.
- The chi-square statistic for the major and study-location example is approximately 11.42, with 1 degree of freedom.
- At the 0.05 significance level, χ² = 11.42 exceeds the 1-degree-of-freedom critical value of 3.84, supporting an association between major and study location.
Chapters
- The chi-square test of independence examines associations between two categorical, or nominal, variables using frequency counts.
- The example compares STEM versus non-STEM majors with library versus campus coffee shop study locations.
- The null hypothesis says major and study location are independent; the alternative says they are related.
- The observed 2-by-2 table contains 30 STEM and 15 non-STEM students in the library, and 10 STEM and 25 non-STEM students at the coffee shop.
- Row totals are 40 for each major group, column totals are 45 for the library and 35 for the coffee shop, and the grand total is 80.
- Expected counts under independence are calculated as row total × column total ÷ grand total, producing 22.5, 17.5, 22.5, and 17.5.
- For each cell, the calculation adds (observed − expected)² ÷ expected; the four contributions are approximately 2.50, 3.21, 2.50, and 3.21.
- The contributions sum to χ² ≈ 11.42; the 2-by-2 table has (2 − 1)(2 − 1) = 1 degree of freedom.
- At α = 0.05, the critical value for 1 degree of freedom is 3.84, so 11.42 exceeds the threshold and the null hypothesis is rejected.
Transcript excerpt
0:05 The chi-square test of independence, which is what we're working on here, it analyzes associations between two categorical variables. Categorical, what's that? That's nominal data. So finally we get to use nominal data again. And so a chi-square, it is a test of proportions or if we go back to the second week of the semester, it's all about frequencies. Do you remember the term from the second week, frequency? And so the chi-square test of independence is going to help us check whether two categories of things are connected or happen just by chance. So I have an idea, a theory. And that that we have STEM students and non-STEM students. And so based on your uh your major of choice, whether it's
0:53 STEM, so that's science, technology, engineering, and math or non-STEM, which we're going to call that liberal arts, business, law, and such. I notice different patterns in terms of where students study. STEM students, they seem to be more in the library. I see them more in the library. And that makes sense because uh it's closer to a lot of their buildings, a lot of their classrooms, uh but also they're, you know, more looking at formulas and uh reading books. Uh whereas the non-STEM students, liberal arts, law, business, uh I sit tend to see them more in the uh the campus center coffee shop. That area, you know, right around the
1:42 coffee shop on the second floor. And the idea is, well that makes sense, more of the buildings, education majors, uh uh liberal arts majors. I know it's far from the business school, but uh these are more likely where we want to talk to people, interact, and so maybe study more in a public place. Um so let's see. And I have two
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Andy Baker.