You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
The t-tests from the previous lesson compare one or two group means. But what if you need to compare three or more groups, or analyse categorical data? This lesson introduces two powerful families of tests: chi-squared tests for categorical data and ANOVA for comparing multiple group means.
The chi-squared (χ²) test is used when data consists of counts or frequencies in categories.
Tests whether the observed frequencies of a categorical variable match an expected distribution.
Hypotheses:
H₀: The observed frequencies match the expected distribution
H₁: The observed frequencies do not match the expected distribution
Test Statistic:
χ² = Σ (Oᵢ − Eᵢ)² / Eᵢ
Where:
Degrees of freedom: df = k − 1, where k is the number of categories
Example: A die is rolled 60 times. If fair, each face should appear 10 times.
| Face | Observed | Expected |
|---|---|---|
| 1 | 8 | 10 |
| 2 | 12 | 10 |
| 3 | 7 | 10 |
| 4 | 14 | 10 |
| 5 | 9 | 10 |
| 6 | 10 | 10 |
χ² = (8−10)²/10 + (12−10)²/10 + (7−10)²/10 + (14−10)²/10 + (9−10)²/10 + (10−10)²/10
= 0.4 + 0.4 + 0.9 + 1.6 + 0.1 + 0.0
= 3.4
With df = 5 and α = 0.05, the critical value is 11.07. Since 3.4 < 11.07, we fail to reject H₀ — no evidence the die is unfair.
Tests whether two categorical variables are associated.
Hypotheses:
H₀: The two variables are independent
H₁: The two variables are associated
Expected frequency for each cell:
Eᵢⱼ = (Row total × Column total) / Grand total
Degrees of freedom: df = (r − 1)(c − 1), where r = rows, c = columns
Example: Is there an association between gender and preference for tea or coffee?
| Tea | Coffee | Total | |
|---|---|---|---|
| Male | 30 | 45 | 75 |
| Female | 40 | 35 | 75 |
| Total | 70 | 80 | 150 |
Expected values: E₁₁ = (75 × 70)/150 = 35, etc.
The test statistic and p-value then determine whether gender and beverage preference are independent.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.