Scenario
You have three production lines and want to know if there's a significant difference in their defect rates. Line A has 8 defective items out of 200, Line B has 14 defective items out of 200, and Line C has 6 defective items out of 200. Use a t-test? No, this is count data, not continuous data.
What is the Chi-squared Test?
The Chi-squared (χ²) test is used to analyze relationships between categorical data (Count Data), answering the question:
"Is there a significant difference between the observed data distribution and the expected distribution?"
Three main usages:
Usage One: Goodness of Fit
Question: Does the data distribution conform to the expected proportions?
Example: A product has three grades: A, B, and C, with theoretical proportions of 50%:30%:20%. If 200 units were actually produced, do the proportions match?
H₀: The actual distribution conforms to the expected proportions.
H₁: The actual distribution does not conform to the expected proportions.
Usage Two: Test of Independence
Question: Is there an association between two categorical variables?
Example: Is there a relationship between defect type (out-of-tolerance dimensions, cosmetic defects, functional abnormalities) and production shift (morning shift, night shift)?
Create a Contingency Table:
| Out-of-Tolerance | Cosmetic Defect | Functional Anomaly | Total | |
|---|---|---|---|---|
| Morning Shift | 12 | 8 | 5 | 25 |
| Night Shift | 6 | 15 | 4 | 25 |
| Total | 18 | 23 | 9 | 50 |
H₀: Defect type and shift are independent.
H₁: Defect type and shift are associated.
Usage Three: Test of Homogeneity
Question: Are the categorical distributions of multiple groups the same?
Example: Are the defect rates of the three production lines the same? (This is the question from the scenario above.)
Interpreting Results
- P < 0.05: Reject H₀, indicating a significant difference or association.
- P ≥ 0.05: Fail to reject H₀, meaning the observed difference may be due to random chance.
Prerequisites for Use
| Condition | Description |
|---|---|
| Expected count in each cell ≥ 5 | If not met, combine categories or use Fisher's exact test. |
| Independent samples | The same sample cannot appear in multiple cells. |
| Categorical data | Not applicable to continuous data (use t-test or ANOVA). |
Golden Quote
"When your data involves counting units, not measuring dimensions, Chi-squared is your tool."