Chi-Square Test for Homogeneity: Comprehensive Guide

Master chi-square test for homogeneity: comparing distributions across multiple populations through these 5 detailed exercises.

Chi-Square Test for Homogeneity Fundamentals
χ² = Σ[(O - E)²/E], df = (r-1)(c-1)
Homogeneity Test Formula
Key Definitions:

Homogeneity: Testing whether different populations have the same distribution of categorical variables

Contingency Table: Cross-tabulation of categorical variables from different populations

Expected Frequency: E = (Row Total × Column Total) / Grand Total

Degrees of Freedom: df = (number of rows - 1) × (number of columns - 1)

Null Hypothesis: Populations have the same distribution

Alternative Hypothesis: At least one population has a different distribution

5-Step Procedure:
  1. State hypotheses: H₀: All populations have same distribution
  2. Check conditions: All expected frequencies ≥ 5
  3. Calculate expected frequencies: E = (row total × col total) / grand total
  4. Calculate test statistic: χ² = Σ[(O-E)²/E]
  5. Make decision: Compare p-value to α
Tip 1: Always verify all expected frequencies ≥ 5
Tip 2: Row totals represent population sizes
Tip 3: Column totals represent category totals across populations
When to Use: Comparing distributions across multiple independent populations
Assumptions: Independent random samples, categorical data, adequate expected frequencies
Solution: Exercises 1 to 3
1 College Preference Study
Exercise 1
A survey of college preferences shows: Public 2-Year (Yes: 120, No: 80), Public 4-Year (Yes: 150, No: 50), Private (Yes: 80, No: 70). Test if preference distribution is the same across institution types at α = 0.05.
Problem Setup:

Populations: 3 institution types

Categories: Yes/No preference

Contingency Table: 3×2 table

Test Procedure:

Testing homogeneity of preference distribution across institution types

Step 1: Organize data in contingency table
Yes No Total
Public 2-Year 120 80 200
Public 4-Year 150 50 200
Private 80 70 150
Total 350 200 550
Step 2: State hypotheses

H₀: Preference distribution is the same across all institution types

H₁: At least one institution type has a different preference distribution

Step 3: Calculate expected frequencies

For each cell: E = (Row Total × Column Total) / Grand Total

Public 2-Year Yes: E = (200 × 350) / 550 = 127.27

Public 2-Year No: E = (200 × 200) / 550 = 72.73

Public 4-Year Yes: E = (200 × 350) / 550 = 127.27

Public 4-Year No: E = (200 × 200) / 550 = 72.73

Private Yes: E = (150 × 350) / 550 = 95.45

Private No: E = (150 × 200) / 550 = 54.55

Step 4: Check conditions

All expected frequencies ≥ 5: ✓

Conditions satisfied

Step 5: Calculate test statistic

χ² = [(120-127.27)²/127.27] + [(80-72.73)²/72.73] + [(150-127.27)²/127.27] + [(50-72.73)²/72.73] + [(80-95.45)²/95.45] + [(70-54.55)²/54.55]

χ² = [52.85/127.27] + [53.37/72.73] + [515.55/127.27] + [515.55/72.73] + [238.70/95.45] + [238.70/54.55]

χ² = 0.415 + 0.734 + 4.051 + 7.088 + 2.501 + 4.376 = 19.165

Step 6: Find degrees of freedom

df = (r-1)(c-1) = (3-1)(2-1) = 2 × 1 = 2

Step 7: Find p-value

For χ² = 19.165 and df = 2: p-value < 0.001

Step 8: Make decision

Since p-value < α (0.05), reject H₀

Step 9: Conclusion

There is significant evidence that preference distribution differs across institution types.

Final Answer:

χ² = 19.165, df = 2, p-value < 0.001

Reject H₀: Preference distributions differ significantly across institution types

Applied Rules:

• Expected Calculation: E = (Row Total × Col Total) / Grand Total

• Degrees of Freedom: df = (r-1)(c-1)

• Decision Rule: Reject H₀ if p-value ≤ α

2 Regional Voting Patterns
Exercise 2
Voting preferences across 3 regions: Northeast (Dem: 180, Rep: 120, Ind: 50), South (Dem: 150, Rep: 180, Ind: 70), West (Dem: 120, Rep: 100, Ind: 80). Test at α = 0.01.
Problem Setup:

Populations: 3 regions (Northeast, South, West)

Categories: 3 party affiliations (Dem, Rep, Ind)

Contingency Table: 3×3 table

Step 1: Create contingency table
Democrat Republican Independent Total
Northeast 180 120 50 350
South 150 180 70 400
West 120 100 80 300
Total 450 400 200 1050
Step 2: State hypotheses

H₀: Voting distribution is the same across all regions

H₁: At least one region has a different voting distribution

Step 3: Calculate expected frequencies

NE Dem: E = (350 × 450) / 1050 = 150

NE Rep: E = (350 × 400) / 1050 = 133.33

NE Ind: E = (350 × 200) / 1050 = 66.67

South Dem: E = (400 × 450) / 1050 = 171.43

South Rep: E = (400 × 400) / 1050 = 152.38

South Ind: E = (400 × 200) / 1050 = 76.19

West Dem: E = (300 × 450) / 1050 = 128.57

West Rep: E = (300 × 400) / 1050 = 114.29

West Ind: E = (300 × 200) / 1050 = 57.14

Step 4: Check conditions

All expected frequencies ≥ 5: ✓

Conditions satisfied

Step 5: Calculate test statistic

χ² = [(180-150)²/150] + [(120-133.33)²/133.33] + [(50-66.67)²/66.67] + [(150-171.43)²/171.43] + [(180-152.38)²/152.38] + [(70-76.19)²/76.19] + [(120-128.57)²/128.57] + [(100-114.29)²/114.29] + [(80-57.14)²/57.14]

χ² = [900/150] + [177.69/133.33] + [277.89/66.67] + [459.24/171.43] + [762.05/152.38] + [38.30/76.19] + [73.44/128.57] + [204.08/114.29] + [524.41/57.14]

χ² = 6 + 1.33 + 4.17 + 2.68 + 5.00 + 0.50 + 0.57 + 1.79 + 9.18 = 31.02

Step 6: Find degrees of freedom

df = (r-1)(c-1) = (3-1)(3-1) = 2 × 2 = 4

Step 7: Find p-value

For χ² = 31.02 and df = 4: p-value < 0.001

Step 8: Make decision

Since p-value < α (0.01), reject H₀

Step 9: Conclusion

There is significant evidence that voting distribution differs across regions.

Final Answer:

χ² = 31.02, df = 4, p-value < 0.001

Reject H₀: Voting distributions differ significantly across regions

Applied Rules:

• Contingency Analysis: 3×3 table with multiple comparisons

• Political Context: Important for electoral analysis

• Large Sample: Adequate expected frequencies guaranteed

3 Educational Background
Exercise 3
Job satisfaction by education level: High School (Satisfied: 60, Neutral: 40, Dissatisfied: 30), College (Satisfied: 80, Neutral: 50, Dissatisfied: 20), Graduate (Satisfied: 45, Neutral: 35, Dissatisfied: 20). Test at α = 0.05.
Problem Setup:

Populations: 3 education levels (HS, College, Graduate)

Categories: 3 satisfaction levels (Satisfied, Neutral, Dissatisfied)

Contingency Table: 3×3 table

Step 1: Create contingency table
Satisfied Neutral Dissatisfied Total
High School 60 40 30 130
College 80 50 20 150
Graduate 45 35 20 100
Total 185 125 70 380
Step 2: State hypotheses

H₀: Satisfaction distribution is the same across all education levels

H₁: At least one education level has a different satisfaction distribution

Step 3: Calculate expected frequencies

HS Satisfied: E = (130 × 185) / 380 = 63.29

HS Neutral: E = (130 × 125) / 380 = 42.76

HS Dissatisfied: E = (130 × 70) / 380 = 24.05

College Satisfied: E = (150 × 185) / 380 = 72.90

College Neutral: E = (150 × 125) / 380 = 49.34

College Dissatisfied: E = (150 × 70) / 380 = 27.63

Graduate Satisfied: E = (100 × 185) / 380 = 48.68

Graduate Neutral: E = (100 × 125) / 380 = 32.89

Graduate Dissatisfied: E = (100 × 70) / 380 = 18.42

Step 4: Check conditions

All expected frequencies ≥ 5: ✓

Conditions satisfied

Step 5: Calculate test statistic

χ² = [(60-63.29)²/63.29] + [(40-42.76)²/42.76] + [(30-24.05)²/24.05] + [(80-72.90)²/72.90] + [(50-49.34)²/49.34] + [(20-27.63)²/27.63] + [(45-48.68)²/48.68] + [(35-32.89)²/32.89] + [(20-18.42)²/18.42]

χ² = [10.82/63.29] + [7.62/42.76] + [35.40/24.05] + [50.41/72.90] + [0.44/49.34] + [58.58/27.63] + [13.47/48.68] + [4.45/32.89] + [2.50/18.42]

χ² = 0.171 + 0.178 + 1.472 + 0.692 + 0.009 + 2.120 + 0.277 + 0.135 + 0.136 = 5.190

Step 6: Find degrees of freedom

df = (r-1)(c-1) = (3-1)(3-1) = 2 × 2 = 4

Step 7: Find p-value

For χ² = 5.190 and df = 4: p-value ≈ 0.268

Step 8: Make decision

Since p-value (0.268) > α (0.05), fail to reject H₀

Step 9: Conclusion

There is insufficient evidence to conclude that satisfaction distribution differs across education levels.

Final Answer:

χ² = 5.190, df = 4, p-value ≈ 0.268

Fail to reject H₀: Satisfaction distributions appear similar across education levels

Applied Rules:

• Workplace Application: Important for HR and organizational analysis

• Education Context: Relevant for career counseling and workforce planning

• Conservative Alpha: α = 0.05 balances Type I and II errors

Solution: Exercises 4 to 5
4 Shopping Preferences
Exercise 4
Shopping method preferences by age group: Young Adults (Online: 45, In-store: 35, Both: 20), Middle Age (Online: 30, In-store: 40, Both: 30), Seniors (Online: 15, In-store: 50, Both: 35). Test at α = 0.05.
Problem Setup:

Populations: 3 age groups (Young, Middle, Senior)

Categories: 3 shopping methods (Online, In-store, Both)

Contingency Table: 3×3 table

Step 1: Create contingency table
Online In-store Both Total
Young Adults 45 35 20 100
Middle Age 30 40 30 100
Seniors 15 50 35 100
Total 90 125 85 300
Step 2: State hypotheses

H₀: Shopping method distribution is the same across all age groups

H₁: At least one age group has a different shopping method distribution

Step 3: Calculate expected frequencies

Since all row totals are 100, E = (100 × Column Total) / 300

Each age group Online: E = (100 × 90) / 300 = 30

Each age group In-store: E = (100 × 125) / 300 = 41.67

Each age group Both: E = (100 × 85) / 300 = 28.33

Step 4: Check conditions

All expected frequencies ≥ 5: ✓

Conditions satisfied

Step 5: Calculate test statistic

χ² = [(45-30)²/30] + [(35-41.67)²/41.67] + [(20-28.33)²/28.33] + [(30-30)²/30] + [(40-41.67)²/41.67] + [(30-28.33)²/28.33] + [(15-30)²/30] + [(50-41.67)²/41.67] + [(35-28.33)²/28.33]

χ² = [225/30] + [44.44/41.67] + [69.39/28.33] + [0/30] + [2.78/41.67] + [2.78/28.33] + [225/30] + [69.39/41.67] + [44.44/28.33]

χ² = 7.50 + 1.07 + 2.45 + 0 + 0.07 + 0.10 + 7.50 + 1.67 + 1.57 = 21.93

Step 6: Find degrees of freedom

df = (r-1)(c-1) = (3-1)(3-1) = 2 × 2 = 4

Step 7: Find p-value

For χ² = 21.93 and df = 4: p-value < 0.001

Step 8: Make decision

Since p-value < α (0.05), reject H₀

Step 9: Conclusion

There is significant evidence that shopping method distribution differs across age groups.

Final Answer:

χ² = 21.93, df = 4, p-value < 0.001

Reject H₀: Shopping method distributions differ significantly across age groups

Applied Rules:

• Market Research: Important for targeted marketing strategies

• Age Demographics: Shows generational differences in behavior

• Equal Row Totals: Simplifies expected frequency calculation

5 Hospital Treatment Outcomes
Exercise 5
Treatment outcomes at 2 hospitals: Hospital A (Success: 180, Failure: 20), Hospital B (Success: 150, Failure: 30). Test if success rates are the same at α = 0.05.
Problem Setup:

Populations: 2 hospitals (A and B)

Categories: 2 outcomes (Success, Failure)

Contingency Table: 2×2 table

Step 1: Create contingency table
Success Failure Total
Hospital A 180 20 200
Hospital B 150 30 180
Total 330 50 380
Step 2: State hypotheses

H₀: Treatment success distribution is the same for both hospitals

H₁: Hospitals have different treatment success distributions

Step 3: Calculate expected frequencies

A Success: E = (200 × 330) / 380 = 173.68

A Failure: E = (200 × 50) / 380 = 26.32

B Success: E = (180 × 330) / 380 = 156.32

B Failure: E = (180 × 50) / 380 = 23.68

Step 4: Check conditions

All expected frequencies ≥ 5: ✓

Conditions satisfied

Step 5: Calculate test statistic

χ² = [(180-173.68)²/173.68] + [(20-26.32)²/26.32] + [(150-156.32)²/156.32] + [(30-23.68)²/23.68]

χ² = [40.14/173.68] + [40.14/26.32] + [40.14/156.32] + [40.14/23.68]

χ² = 0.231 + 1.525 + 0.257 + 1.695 = 3.608

Step 6: Find degrees of freedom

df = (r-1)(c-1) = (2-1)(2-1) = 1 × 1 = 1

Step 7: Find p-value

For χ² = 3.608 and df = 1: p-value ≈ 0.057

Step 8: Make decision

Since p-value (0.057) > α (0.05), fail to reject H₀

Step 9: Conclusion

There is insufficient evidence to conclude that success rates differ between hospitals.

Final Answer:

χ² = 3.608, df = 1, p-value ≈ 0.057

Fail to reject H₀: Success rates appear similar between hospitals

Applied Rules:

• Medical Context: Important for healthcare quality assessment

• 2×2 Table: Single degree of freedom, simpler interpretation

• Marginally Significant: p-value close to α suggests need for larger study

Comprehensive Chi-Square Homogeneity Guide
χ² = Σ[(O - E)²/E], E = (Row Total × Col Total)/Grand Total, df = (r-1)(c-1)
Complete Formula
Test Statistic
χ² = Σ[(O-E)²/E]
Measures deviation from expected
Expected Frequency
E = (RT × CT)/GT
Under H₀
Degrees of Freedom
df = (r-1)(c-1)
Independent comparisons
Key Homogeneity Concepts:

Independent Populations: Each population sampled independently

Categorical Variables: Both row and column variables must be categorical

Same Response Categories: All populations must have same outcome categories

Random Sampling: Each sample must be randomly selected

Independence: Observations must be independent within and between populations

Conditions and Assumptions:

Random Sampling: Independent random samples from each population

Independence: No relationship between samples

Expected Frequency Rule: All E ≥ 5 (at least 80% of cells)

Categorical Data: Both variables must be categorical

Fixed Margins: Row totals determined by sampling design

Memory Tip: "Homogeneity = Same distribution across populations"
Memory Tip: "Expected = Row × Col / Grand Total"
Memory Tip: "df = (rows-1) × (cols-1)"
Common Mistakes: Confusing with independence test, miscalculating expected frequencies, ignoring conditions
Applications: Market research, medical studies, educational comparisons, quality control

Questions & Answers

Question: What's the difference between chi-square test for homogeneity and chi-square test for independence? When should I use each?

Answer: The key difference lies in the study design:

Chi-Square Test for Homogeneity:

  • Multiple populations: Different samples from different populations
  • Same variable: Same categorical variable measured in each population
  • Question: Do the populations have the same distribution?
  • Example: Comparing voting patterns across different states

Chi-Square Test for Independence:

  • Single population: One sample with two categorical variables
  • Two variables: Both variables measured on same individuals
  • Question: Are the variables independent?
  • Example: Gender vs. political affiliation in one sample

Key Distinction:

  • Homogeneity: Different populations, same variable
  • Independence: Same population, different variables

The calculations are identical, but the interpretation and sampling design differ significantly.

Question: How do I interpret a significant result from a homogeneity test? What does it tell me about the specific differences between populations?

Answer: A significant result indicates that at least one population has a different distribution, but it doesn't tell you which specific populations differ:

What It Tells You:

  • At least one population has a different distribution of the categorical variable
  • The differences are statistically significant (unlike due to chance)
  • Not all populations have the same distribution

What It Doesn't Tell You:

  • Which specific populations differ from each other
  • Which specific categories show the differences
  • The magnitude of the differences

Post-Hoc Analysis:

  • Examine residuals: Look at (O-E) values to see which cells contribute most to χ²
  • Pairwise comparisons: Conduct additional tests between specific populations
  • Effect size: Calculate Cramér's V or phi coefficient
  • Practical significance: Consider the real-world importance of differences

The homogeneity test is a global test that indicates whether differences exist, not where they occur.

Question: Why do we use (Row Total × Column Total) / Grand Total for expected frequencies? What's the mathematical reasoning?

Answer: The formula comes from the probability rule under the null hypothesis:

Under H₀: The probability of being in a particular row is independent of being in a particular column.

Mathematical Derivation:

  • P(in Row i AND Column j) = P(in Row i) × P(in Column j)
  • P(in Row i) = (Row i Total) / (Grand Total)
  • P(in Column j) = (Column j Total) / (Grand Total)
  • P(in Row i AND Column j) = (Row i Total) × (Column j Total) / (Grand Total)²
  • Expected count in cell (i,j) = Grand Total × P(in Row i AND Column j)
  • Expected count = (Row i Total × Column j Total) / Grand Total

Intuitive Reasoning:

  • If row and column are independent, the proportion in each column should be the same across all rows
  • Row total × Column proportion = Expected count for that cell
  • This formula ensures that row and column totals are preserved

The formula reflects the multiplicative law of probability under independence.