The chi-square (χ2) test is a statistical test used to determine whether there is a significant association between categorical variables or whether the observed frequencies differ significantly from the expected frequencies.
Example 1: A study investigates the relationship between eye color (blue, brown, green) and hair color (blonde, brunette, redhead). The following data is collected:
Eye Color | Blonde | Brunette | Redhead | Total |
|---|---|---|---|---|
Blue | 30 | 50 | 20 | 100 |
Brown | 40 | 30 | 10 | 80 |
Green | 20 | 10 | 10 | 40 |
Total | 90 | 90 | 40 | 220 |
Step 1: Hypotheses
H₀: Eye color and hair color are independent
H₁: They are associatedStep 2: Expected Frequencies
Using
E = \frac{(\text{Row Total} \times \text{Column Total})}{\text{Grand Total}} Blue: (40.91, 40.91, 18.18) {color: blonde,brunette,redhead }
Brown: (32.73, 32.73, 14.55)
Green: (16.36, 16.36, 7.27)Step 3: Chi-Square Calculation
\chi^2 = \sum \frac{(O - E)^2}{E} \approx 12.67 Step 4: Degrees of Freedom
df = (3 − 1)(3 − 1) = 4
Step 5: Decision
Critical value (α = 0.05, df = 4) = 9.488
Since 12.67 > 9.488 → Reject H₀
There is a significant association between eye color and hair color
Example 2: 100 flips of a coin are performed. The coin is fair, with an equal chance of heads and tails, according to the null hypothesis. 55 heads and 45 tails are the observed findings.
Step 1: Hypotheses
H₀: Coin is fair
H₁: Coin is not fairStep 2: Expected Values
Heads = 50, Tails = 50
Step 3: Chi-Square Calculation
\chi^2 = \frac{(55-50)^2}{50} + \frac{(45-50)^2}{50} = 1 Step 4: Degrees of Freedom
df = 1
Step 5: Decision
Critical value (α = 0.05) = 3.84
Since 1 < 3.84 → Fail to reject H₀
The coin is likely fair
Practice Problems
Q1. Market Research on Beverages
A company conducts a survey to determine whether there's a relationship between age groups and preferred beverages. The data collected is as follows:
Age Group | Coffee | Tea | Soft Drinks | Water |
|---|---|---|---|---|
18-25 | 30 | 20 | 25 | 15 |
26-35 | 25 | 30 | 20 | 25 |
36-45 | 20 | 25 | 30 | 25 |
46-55 | 15 | 20 | 25 | 40 |
Use a chi-square test to determine if there is an association between age groups and preferred beverages.
Q2. Student Performance
A teacher wants to find out if there is a relationship between study habits and grades. The data collected is as follows:
Study Habits | A | B | C | D | F |
|---|---|---|---|---|---|
Regular | 15 | 20 | 25 | 10 | 5 |
Occasional | 10 | 15 | 20 | 15 | 10 |
Rare | 5 | 10 | 15 | 20 | 25 |
Perform a chi-square test to determine if study habits and grades are associated.
Q3. Gender and Major
A university wants to see if there is an association between gender and chosen major. The data collected is:
Major | Male | Female |
|---|---|---|
Engineering | 60 | 30 |
Business | 40 | 50 |
Arts | 20 | 40 |
Sciences | 30 | 30 |
Conduct a chi-square test to examine if gender and chosen major are related.
Q4. Voting Preferences
A political analyst wants to know if there is a relationship between gender and voting preference. The data is:
Preference | Male | Female |
|---|---|---|
Candidate A | 80 | 90 |
Candidate B | 70 | 60 |
Undecided | 50 | 40 |
Test the hypothesis that gender and voting preference are independent.