Chi-Square Test
What is the Chi-Square Test?
The Chi-Square (χ²) test is a non-parametric statistical test used to determine if there is a significant association between two categorical variables or if a categorical variable follows a specific distribution.
✅ Types of Chi-Square Tests
1. Chi-Square Test for Independence
Used to determine if two categorical variables are independent or related.
Example: Is there a relationship between gender and preference for a product?
2. Chi-Square Goodness-of-Fit Test
Used to determine whether a single categorical variable follows a hypothesized distribution.
Example: Does a die roll show numbers uniformly?
Assumptions of the Chi-Square Test
-
Data are frequencies or counts (not percentages or means).
-
Categories are mutually exclusive.
-
Observations are independent.
-
Expected frequency in each cell should be ≥ 5 (or use Fisher's exact test if < 5).
General Formula
Where:
-
= Observed frequency
-
= Expected frequency
-
The sum is over all categories or cells
📊 1. Chi-Square Test for Independence – Example
Question: Is there an association between gender and ice cream preference?
Ice Cream | Male | Female | Total |
---|---|---|---|
Vanilla | 20 | 30 | 50 |
Chocolate | 25 | 25 | 50 |
Total | 45 | 55 | 100 |
Step 1: Hypotheses
-
H₀: Gender and ice cream preference are independent.
-
H₁: Gender and ice cream preference are associated.
Step 2: Calculate Expected Frequencies
Ice Cream | Male (Expected) | Female (Expected) |
---|---|---|
Vanilla | ||
Chocolate |
Step 3: Apply Chi-Square Formula
Step 4: Degrees of Freedom
Critical value at α = 0.05 and df = 1 ≈ 3.841
Step 5: Conclusion
Since χ² = 1.01 < 3.841 → Fail to reject H₀
✅ Conclusion: No significant association between gender and ice cream preference.
📊 2. Chi-Square Goodness-of-Fit – Example
Question: A die is rolled 60 times. Observed frequencies:
[10, 11, 8, 9, 12, 10]. Is the die fair?
Step 1: Hypotheses
-
H₀: Die is fair → all faces have equal probability.
-
H₁: Die is not fair.
Step 2: Expected Frequency
If fair:
Step 3: Calculate χ²
Step 4: Degrees of Freedom
Critical value at α = 0.05, df = 5 ≈ 11.07
Step 5: Conclusion
Since χ² = 1.0 < 11.07 → Fail to reject H₀
✅ Conclusion: The die appears to be fair.
📌 Summary Table
Test Type | Use Case | df |
---|---|---|
Goodness-of-Fit | One categorical variable vs. expected values | |
Test for Independence | Relationship between 2 categorical variables |
Comments
Post a Comment