| Like | Dislike | Total | |
|---|---|---|---|
| Male | 60 | 40 | 100 |
| Female | 70 | 30 | 100 |
| Total | 130 | 70 | 200 |
Chi-square test for independence: Tests whether two categorical variables are independent (not associated).
- State null and alternative hypotheses
- Calculate expected frequencies
- Compute the test statistic
- Determine degrees of freedom
- Find critical value or p-value
- Make a decision
H₀: Gender and preference are independent
H₁: Gender and preference are dependent
Expected frequency = (Row total × Column total) / Grand total
Male-Like: (100 × 130) / 200 = 65
Male-Dislike: (100 × 70) / 200 = 35
Female-Like: (100 × 130) / 200 = 65
Female-Dislike: (100 × 70) / 200 = 35
χ² = Σ [(Observed - Expected)² / Expected]
χ² = [(60-65)²/65] + [(40-35)²/35] + [(70-65)²/65] + [(30-35)²/35]
χ² = 25/65 + 25/35 + 25/65 + 25/35 = 0.385 + 0.714 + 0.385 + 0.714 = 2.198
df = (rows - 1) × (columns - 1) = (2-1) × (2-1) = 1
α = 0.05, df = 1 → Critical value = 3.841
Since 2.198 < 3.841, we fail to reject H₀
We fail to reject the null hypothesis. There is no significant association between gender and soft drink preference at α = 0.05.
• Independence assumption: Expected frequency ≥ 5 for all cells
• Test statistic: χ² = Σ [(O-E)²/E]
• Decision rule: Reject H₀ if χ² > critical value
| Voted | Did Not Vote | Total | |
|---|---|---|---|
| High School | 80 | 40 | 120 |
| College | 100 | 30 | 130 |
| Graduate | 40 | 10 | 50 |
| Total | 220 | 80 | 300 |
Expected frequency: E = (Row total × Column total) / Grand total
High School - Voted: (120 × 220) / 300 = 88
High School - Did Not Vote: (120 × 80) / 300 = 32
College - Voted: (130 × 220) / 300 = 95.33
College - Did Not Vote: (130 × 80) / 300 = 34.67
Graduate - Voted: (50 × 220) / 300 = 36.67
Graduate - Did Not Vote: (50 × 80) / 300 = 13.33
χ² = [(80-88)²/88] + [(40-32)²/32] + [(100-95.33)²/95.33] + [(30-34.67)²/34.67] + [(40-36.67)²/36.67] + [(10-13.33)²/13.33]
χ² = 0.727 + 2.000 + 0.229 + 0.633 + 0.303 + 0.833 = 4.725
df = (3-1) × (2-1) = 2
α = 0.01, df = 2 → Critical value = 9.210
Since 4.725 < 9.210, we fail to reject H₀
We fail to reject the null hypothesis. There is no significant association between education level and voting behavior at α = 0.01.
• Assumptions: All expected frequencies should be ≥ 5
• Degrees of freedom: df = (r-1)(c-1)
• Decision rule: Compare calculated χ² with critical value
| Good GPA | Poor GPA | Total | |
|---|---|---|---|
| Regular Study | 85 | 15 | 100 |
| Irregular Study | 120 | 30 | 150 |
| Total | 205 | 45 | 250 |
P-value approach: Reject H₀ if p-value ≤ α
Regular-Good: (100 × 205) / 250 = 82
Regular-Poor: (100 × 45) / 250 = 18
Irregular-Good: (150 × 205) / 250 = 123
Irregular-Poor: (150 × 45) / 250 = 27
χ² = [(85-82)²/82] + [(15-18)²/18] + [(120-123)²/123] + [(30-27)²/27]
χ² = 9/82 + 9/18 + 9/123 + 9/27 = 0.110 + 0.500 + 0.073 + 0.333 = 1.016
df = (2-1) × (2-1) = 1
With χ² = 1.016 and df = 1, p-value ≈ 0.313
Since p-value (0.313) > α (0.05), we fail to reject H₀
We fail to reject the null hypothesis. There is no significant association between study habits and academic performance at α = 0.05.
• P-value method: Compare p-value with significance level
• Decision rule: Reject H₀ if p-value ≤ α
• Interpretation: Larger p-value indicates weaker evidence against H₀
Contingency table: Displays frequency distribution of two categorical variables
Expected frequency: Frequency expected under independence assumption
Observed frequency: Actual frequency from sample data
- Set up hypotheses: H₀: Independent vs H₁: Dependent
- Construct contingency table: Organize observed data
- Calculate expected frequencies: E = (Row total × Col total) / Grand total
- Compute test statistic: χ² = Σ[(O-E)²/E]
- Determine df: df = (r-1)(c-1)
- Find critical value or p-value
- Make decision: Reject H₀ if test statistic > critical value
- Draw conclusion: Interpret in context
• Data type: Categorical variables only
• Independence: Observations are independent
• Expected frequencies: All E ≥ 5 (at least 80% should be ≥ 5)
• Sample size: Sufficiently large sample
| Business | Technology | Healthcare | Total | |
|---|---|---|---|---|
| Engineering | 45 | 75 | 30 | 150 |
| Liberal Arts | 60 | 40 | 50 | 150 |
| Science | 45 | 35 | 20 | 100 |
| Total | 150 | 150 | 100 | 400 |
Three-by-three contingency table: Requires careful calculation of expected frequencies.
Using E = (Row total × Column total) / Grand total:
Engineering-Business: (150 × 150) / 400 = 56.25
Engineering-Technology: (150 × 150) / 400 = 56.25
Engineering-Healthcare: (150 × 100) / 400 = 37.5
Liberal Arts-Business: (150 × 150) / 400 = 56.25
Liberal Arts-Technology: (150 × 150) / 400 = 56.25
Liberal Arts-Healthcare: (150 × 100) / 400 = 37.5
Science-Business: (100 × 150) / 400 = 37.5
Science-Technology: (100 × 150) / 400 = 37.5
Science-Healthcare: (100 × 100) / 400 = 25
χ² = Σ[(O-E)²/E] for all 9 cells
= [(45-56.25)²/56.25] + [(75-56.25)²/56.25] + [(30-37.5)²/37.5] + [(60-56.25)²/56.25] + [(40-56.25)²/56.25] + [(50-37.5)²/37.5] + [(45-37.5)²/37.5] + [(35-37.5)²/37.5] + [(20-25)²/25]
= 2.25 + 6.25 + 1.5 + 0.25 + 4.69 + 4.17 + 1.5 + 0.17 + 1.0 = 21.78
df = (3-1) × (3-1) = 4
α = 0.05, df = 4 → Critical value = 9.488
Since 21.78 > 9.488, we reject H₀
We reject the null hypothesis. There is a significant association between major field of study and career choice at α = 0.05.
• Large table: Carefully calculate all expected frequencies
• Decision rule: Reject H₀ if χ² > critical value
• Interpretation: Significant association exists
| Sweet | Salty | Spicy | Total | |
|---|---|---|---|---|
| 18-25 | 40 | 35 | 25 | 100 |
| 26-40 | 50 | 45 | 30 | 125 |
| 41-60 | 45 | 35 | 20 | 100 |
| Over 60 | 30 | 25 | 10 | 65 |
| Total | 165 | 140 | 85 | 390 |
Critical value method: Compare test statistic with critical value from table.
All expected frequencies using E = (RT × CT)/GT:
Row 1: 42.31, 35.90, 21.79
Row 2: 53.13, 45.13, 27.44
Row 3: 42.31, 35.90, 21.79
Row 4: 27.25, 23.07, 14.08
χ² = Σ[(O-E)²/E] for all 12 cells
= [(40-42.31)²/42.31] + [(35-35.90)²/35.90] + [(25-21.79)²/21.79] + ... + [(10-14.08)²/14.08]
= 0.127 + 0.023 + 0.473 + 0.106 + 0.013 + 0.235 + 0.127 + 0.023 + 0.146 + 0.969 + 0.307 + 1.179 = 3.728
df = (4-1) × (3-1) = 6
α = 0.01, df = 6 → Critical value = 16.812
Since 3.728 < 16.812, we fail to reject H₀
We fail to reject the null hypothesis. There is no significant association between age group and product preference at α = 0.01.
• Critical value method: Compare calculated χ² with table value
• Decision rule: Fail to reject if χ² < critical value
• Conclusion: No significant association found
Contingency table: A table showing the distribution of one categorical variable across the categories of another categorical variable.
Chi-square distribution: A probability distribution used in hypothesis testing, characterized by its degrees of freedom.
Independence: Two variables are independent if knowing the value of one does not provide information about the value of the other.
- Formulate hypotheses: H₀: Variables are independent vs H₁: Variables are dependent
- Organize data: Create a contingency table with observed frequencies
- Calculate marginal totals: Row totals, column totals, and grand total
- Calculate expected frequencies: E = (row total × column total) / grand total
- Verify assumptions: Check that all expected frequencies are ≥ 5
- Calculate test statistic: χ² = Σ[(observed - expected)²/expected]
- Determine degrees of freedom: df = (number of rows - 1) × (number of columns - 1)
- Find critical value or p-value: Based on significance level and df
- Make decision: Compare test statistic with critical value
- Draw conclusion: State in context of the problem
• Test statistic: χ² = Σ[(O - E)²/E]
• Degrees of freedom: df = (r-1)(c-1)
• Expected frequency: E = (row total × column total) / grand total
• Decision rule: Reject H₀ if calculated χ² > critical χ² value
• Assumption: All expected frequencies should be ≥ 5