Solved Exercises on Expected Counts and Conditions for Chi-Square Tests

Master expected counts and conditions: contingency tables, expected frequency calculations, assumptions, validation criteria, and practical applications through these 5 detailed exercises.

Solution: Exercises 1 to 3
1 Basic Expected Count Calculation
Exercise 1
A researcher collected data on pet ownership by housing type in a sample of 200 people:
No Pets Cats Only Dogs Only Other Pets Total
Apartment 30 20 15 5 70
House 40 30 45 15 130
Total 70 50 60 20 200
Calculate all expected counts and verify the conditions for the chi-square test.
Definition:

Expected count: E = (Row Total × Column Total) / Grand Total, assuming independence.

Methodology:
  1. Identify row and column totals
  2. Apply formula: E = (RT × CT) / GT
  3. Calculate expected count for each cell
  4. Verify all expected counts ≥ 5
Step 1: Calculate expected counts for Apartment row

Apartment-No Pets: (70 × 70) / 200 = 24.5

Apartment-Cats Only: (70 × 50) / 200 = 17.5

Apartment-Dogs Only: (70 × 60) / 200 = 21

Apartment-Other Pets: (70 × 20) / 200 = 7

Step 2: Calculate expected counts for House row

House-No Pets: (130 × 70) / 200 = 45.5

House-Cats Only: (130 × 50) / 200 = 32.5

House-Dogs Only: (130 × 60) / 200 = 39

House-Other Pets: (130 × 20) / 200 = 13

Step 3: Verify conditions

All expected counts: 24.5, 17.5, 21, 7, 45.5, 32.5, 39, 13

Minimum expected count = 7 (all ≥ 5) ✓

At least 80% of cells have E ≥ 5 ✓

Step 4: Summary of expected counts

Apartment-No Pets: 24.5 (≥5) ✓

Apartment-Cats Only: 17.5 (≥5) ✓

Apartment-Dogs Only: 21 (≥5) ✓

Apartment-Other Pets: 7 (≥5) ✓

House-No Pets: 45.5 (≥5) ✓

House-Cats Only: 32.5 (≥5) ✓

House-Dogs Only: 39 (≥5) ✓

House-Other Pets: 13 (≥5) ✓

All expected counts ≥ 5, conditions satisfied for chi-square test.
Final answer:

All expected counts are calculated correctly and meet the minimum requirement of 5, satisfying the conditions for the chi-square test.

Applied rules:

• Expected count formula: E = (Row Total × Column Total) / Grand Total

• Minimum condition: All expected counts should be ≥ 5

• Majority condition: At least 80% of cells should have E ≥ 5

Conditions verified:

✓ All expected counts ≥ 5

✓ Chi-square approximation is valid

✓ Test can be performed

2 Condition Violation Analysis
Exercise 2
A small study on exercise preferences by age group yielded the following results:
Running Swimming Weight Training Total
Young (18-25) 12 8 3 23
Middle (26-40) 15 12 5 32
Older (41+) 8 5 2 15
Total 35 25 10 70
Calculate expected counts and identify violations of chi-square test conditions.
Definition:

Condition violation: When expected counts fall below the minimum threshold (typically 5).

Step 1: Calculate expected counts

Young-Running: (23 × 35) / 70 = 11.5

Young-Swimming: (23 × 25) / 70 = 8.21

Young-Weight Training: (23 × 10) / 70 = 3.29

Middle-Running: (32 × 35) / 70 = 16

Middle-Swimming: (32 × 25) / 70 = 11.43

Middle-Weight Training: (32 × 10) / 70 = 4.57

Older-Running: (15 × 35) / 70 = 7.5

Older-Swimming: (15 × 25) / 70 = 5.36

Older-Weight Training: (15 × 10) / 70 = 2.14

Step 2: Identify violations

Violations: Young-Weight Training (3.29), Middle-Weight Training (4.57), Older-Weight Training (2.14)

3 out of 9 cells have E < 5 (33% violating condition)

Step 3: Assess severity

More than 20% of cells have E < 5

Chi-square approximation may not be valid

Step 4: Suggest alternatives

Combine "Weight Training" with another category

Or increase sample size

3 out of 9 cells violate the E ≥ 5 condition (33% violation)
Final answer:

The chi-square test conditions are violated. The expected count for "Older-Weight Training" is 2.14 < 5, which violates the minimum expected count requirement.

Applied rules:

• Violation threshold: More than 20% of cells with E < 5

• Invalidation: Chi-square approximation becomes unreliable

• Remedies: Combine categories or increase sample size

Conditions violated:

✗ Young-Weight Training: E = 3.29 < 5

✗ Middle-Weight Training: E = 4.57 < 5

✗ Older-Weight Training: E = 2.14 < 5

Chi-square test not recommended

3 Category Combination Solution
Exercise 3
Using the previous data, combine categories to satisfy chi-square test conditions:
Running Swimming Strength (Combined) Total
Young (18-25) 12 8 3+5=8 23
Middle (26-40) 15 12 5+2=7 32
Older (41+) 8 5 2+2=4 15
Total 35 25 19 70
Recalculate expected counts and verify conditions.
Definition:

Category combination: Merging categories to increase expected counts and satisfy conditions.

Step 1: Calculate new expected counts

Young-Running: (23 × 35) / 70 = 11.5

Young-Swimming: (23 × 25) / 70 = 8.21

Young-Strength: (23 × 19) / 70 = 6.24

Middle-Running: (32 × 35) / 70 = 16

Middle-Swimming: (32 × 25) / 70 = 11.43

Middle-Strength: (32 × 19) / 70 = 8.69

Older-Running: (15 × 35) / 70 = 7.5

Older-Swimming: (15 × 25) / 70 = 5.36

Older-Strength: (15 × 19) / 70 = 4.07

Step 2: Check conditions

Most expected counts now ≥ 5, except Older-Strength: 4.07

Only 1 out of 9 cells has E < 5 (11% violating condition)

Step 3: Assess improved situation

Less than 20% of cells have E < 5

Chi-square approximation is now acceptable

Step 4: Consider final adjustments

Consider combining with another small category if needed

1 out of 9 cells has E < 5 (11%), acceptable for chi-square test
Final answer:

After combining weight training with another strength-based activity, the chi-square test conditions are mostly satisfied with only one cell having an expected count below 5.

Applied rules:

• Combination principle: Combine categories logically

• Condition improvement: Increases expected counts

• Acceptability: Less than 20% of cells with E < 5

Improved conditions:

✓ 8 out of 9 cells have E ≥ 5

✓ Only 11% of cells violate condition

✓ Chi-square test now acceptable

Expected Count Formulas and Conditions
\( E_{ij} = \frac{R_i \times C_j}{N} \)
Expected Count Formula
Degrees of Freedom
\( df = (r-1)(c-1) \)
Where r = rows, c = columns
Minimum Expected
\( E \geq 5 \)
Rule of thumb for validity
Majority Rule
\( 80\% \text{ of cells} \geq 5 \)
Alternative validity condition
Key definitions:

Expected count: The frequency expected in each cell if the null hypothesis of independence is true.

Contingency table: A table showing the distribution of one categorical variable across the categories of another categorical variable.

Independence assumption: The probability of being in a cell is the product of the probabilities of being in the corresponding row and column.

Complete methodology:
  1. Identify structure: Determine rows and columns in contingency table
  2. Calculate marginal totals: Row totals, column totals, and grand total
  3. Apply formula: E = (row total × column total) / grand total
  4. Verify conditions: Check that all expected counts are ≥ 5
  5. Count violations: Determine percentage of cells violating condition
  6. Take action: Combine categories if necessary
Tip 1: Always verify expected counts before proceeding with chi-square test.
Tip 2: Combine categories that are logically similar (e.g., "Strongly Disagree" and "Disagree").
Tip 3: Small samples are more likely to violate expected count conditions.
Tip 4: Expected counts sum to row and column totals just like observed counts.
Common errors: Forgetting to calculate expected counts, misapplying the formula, ignoring conditions.
Exam preparation: Practice calculating expected counts quickly, memorize the formula, understand condition violations.
Conditions to verify:

• Minimum expected count: All E ≥ 5 (preferred)

• Majority condition: At least 80% of cells have E ≥ 5

• Sample size: Generally n ≥ 40 for 2×2 tables

• Random sampling: Data should come from random sample

When conditions fail:

• Combine adjacent categories if meaningful

• Collect more data to increase sample size

• Use Fisher's Exact Test for 2×2 tables

• Consider alternative non-parametric tests

Solution: Exercises 4 to 5
4 Large Contingency Table
Exercise 4
A market research company surveyed 500 customers about their preferred payment method by region:
Cash Credit Debit Mobile Total
North 45 60 55 30 190
South 35 40 35 20 130
East 50 70 60 40 220
West 20 30 25 15 90
Total 150 200 175 105 630
Calculate all expected counts and verify conditions for chi-square test.
Definition:

Large contingency table: 4×4 table requiring systematic calculation of 16 expected counts.

Step 1: Calculate expected counts for North region

North-Cash: (190 × 150) / 630 = 45.24

North-Credit: (190 × 200) / 630 = 60.32

North-Debit: (190 × 175) / 630 = 52.78

North-Mobile: (190 × 105) / 630 = 31.67

Step 2: Calculate expected counts for South region

South-Cash: (130 × 150) / 630 = 30.95

South-Credit: (130 × 200) / 630 = 41.27

South-Debit: (130 × 175) / 630 = 36.11

South-Mobile: (130 × 105) / 630 = 21.67

Step 3: Calculate expected counts for East region

East-Cash: (220 × 150) / 630 = 52.38

East-Credit: (220 × 200) / 630 = 69.84

East-Debit: (220 × 175) / 630 = 61.11

East-Mobile: (220 × 105) / 630 = 36.67

Step 4: Calculate expected counts for West region

West-Cash: (90 × 150) / 630 = 21.43

West-Credit: (90 × 200) / 630 = 28.57

West-Debit: (90 × 175) / 630 = 25

West-Mobile: (90 × 105) / 630 = 15

Step 5: Verify conditions

All expected counts: 45.24, 60.32, 52.78, 31.67, 30.95, 41.27, 36.11, 21.67, 52.38, 69.84, 61.11, 36.67, 21.43, 28.57, 25, 15

Minimum expected count = 15 (all ≥ 5) ✓

All 16 cells have E ≥ 5 ✓

All 16 expected counts ≥ 5, conditions fully satisfied
Final answer:

All expected counts are greater than 5, satisfying the conditions for the chi-square test. The test can be performed with confidence.

Applied rules:

• Systematic calculation: Apply formula to each cell

• Verification: Check all expected counts

• Acceptance: All conditions met for chi-square test

5 Critical Condition Analysis
Exercise 5
A political scientist surveyed 180 voters on their party affiliation by education level:
Democrat Republican Independent Total
High School 25 30 5 60
College 40 35 10 85
Graduate 20 15 0 35
Total 85 80 15 180
Analyze expected counts and recommend solutions for condition violations.
Definition:

Critical violation: When expected counts are extremely low or zero, indicating severe condition failure.

Step 1: Calculate expected counts

HS-Democrat: (60 × 85) / 180 = 28.33

HS-Republican: (60 × 80) / 180 = 26.67

HS-Independent: (60 × 15) / 180 = 5

College-Democrat: (85 × 85) / 180 = 40.14

College-Republican: (85 × 80) / 180 = 37.78

College-Independent: (85 × 15) / 180 = 7.08

Graduate-Democrat: (35 × 85) / 180 = 16.53

Graduate-Republican: (35 × 80) / 180 = 15.56

Graduate-Independent: (35 × 15) / 180 = 2.92

Step 2: Identify critical violations

Graduate-Independent: E = 2.92 < 5 (critical violation)

HS-Independent: E = 5 (borderline)

Step 3: Recommend solutions

Combine "Independent" with "Republican" since both are conservative-leaning

Or collect more data to increase sample size

Step 4: Alternative approaches

Use Fisher's Exact Test for 3×2 table

Consider Bayesian approaches

Graduate-Independent E = 2.92 < 5, violates condition
Final answer:

The expected count for Graduate-Independent is 2.92 < 5, violating the minimum expected count condition. The chi-square test cannot be reliably applied without modifications.

Applied rules:

• Critical identification: Find the lowest expected counts

• Remedial action: Combine categories or use alternatives

• Validation: Recheck conditions after modification

Critical violations:

✗ Graduate-Independent: E = 2.92 < 5

✗ Chi-square test not recommended

✓ Combine categories or use alternatives

Comprehensive Expected Counts and Conditions Guide
\( E_{ij} = \frac{\text{Row}_i \times \text{Column}_j}{\text{Grand Total}} \)
Expected Count Formula
Key definitions:

Expected count: The theoretical frequency in each cell of a contingency table under the assumption that the two categorical variables are independent.

Contingency table: A cross-tabulation showing the joint distribution of two categorical variables, with rows representing one variable and columns representing another.

Independence: Two variables are independent if the conditional probability of one variable does not depend on the value of the other variable.

Chi-square approximation: The use of the chi-square distribution to approximate the sampling distribution of the test statistic.

Step-by-step methodology:
  1. Construct contingency table: Organize observed data with row and column totals
  2. Calculate marginal totals: Sum rows and columns to get totals
  3. Apply expected count formula: E = (row total × column total) / grand total
  4. Calculate for all cells: Systematically compute expected count for each cell
  5. Verify conditions: Check that all expected counts are ≥ 5
  6. Count violations: Determine how many and what percentage of cells violate the condition
  7. Evaluate severity: Assess if violations are critical or manageable
  8. Take corrective action: Combine categories, increase sample size, or use alternatives
  9. Re-verify conditions: Confirm that new table meets requirements
Tip 1: Expected counts always sum to the same row and column totals as observed counts.
Tip 2: The expected count represents what would happen if there's no association between variables.
Tip 3: Small expected counts occur when there's a small sample or rare categories.
Tip 4: When combining categories, ensure they're logically similar or related.
Tip 5: Always re-calculate expected counts after combining categories.
Common applications: Market research, medical studies, social sciences, quality control, survey analysis.
Limitations: Assumes random sampling, sensitive to sample size, only detects associations not causation.
Key formulas and rules:

• Expected count: E = (row total × column total) / grand total

• Minimum condition: All expected counts should be ≥ 5 (preferred)

• Majority condition: At least 80% of cells should have E ≥ 5

• Severity: More than 20% of cells with E < 5 is problematic

• Alternative: Fisher's Exact Test for 2×2 tables with small expected counts

Remedial actions for violations:

1. Combine adjacent categories that are logically similar

2. Increase sample size if feasible

3. Use Fisher's Exact Test for 2×2 tables

4. Consider Monte Carlo simulation methods

5. Apply Yates' continuity correction for 2×2 tables

6. Use Bayesian approaches when appropriate

Questions & Answers

Question: Why do we require expected counts to be at least 5 for the chi-square test? What happens if we ignore this condition?

Answer: The expected count condition is crucial because the chi-square test relies on the chi-square distribution as an approximation to the actual sampling distribution of the test statistic. Here's why:

  • The chi-square distribution is continuous, but our data is discrete (counts)
  • When expected counts are small, the discrete nature of the data causes the approximation to break down
  • Small expected counts can lead to inflated Type I error rates (rejecting H₀ when it's true)
  • The test becomes unreliable and conclusions may be invalid

If you ignore this condition, you risk getting misleading p-values and making incorrect statistical decisions. The test statistic may not follow the assumed chi-square distribution, leading to inaccurate probability calculations.

The rule of thumb (E ≥ 5) ensures that the normal approximation underlying the chi-square distribution is reasonably accurate. Some statisticians suggest E ≥ 1 is sufficient if no more than 20% of cells violate the condition.

Question: When combining categories to meet the expected count condition, how do I decide which categories to combine?

Answer: Category combination should be done thoughtfully, considering both statistical and substantive reasons:

  • Logical similarity: Combine categories that are conceptually related (e.g., "Strongly Disagree" and "Disagree")
  • Proximity in meaning: Adjacent categories on a scale are often good candidates
  • Similar proportions: Categories with similar observed proportions can be combined
  • Research context: Consider the research question and what makes sense theoretically

Avoid combining categories that are fundamentally different (e.g., "Democratic" and "Republican" unless studying a broader "Political" vs "Independent" distinction).

After combining, always recalculate expected counts and verify that the new table meets the conditions. Also, consider whether the combined categories still answer your research question meaningfully.

Remember that combining reduces the degrees of freedom (df = (r-1)(c-1)), which might affect the power of your test.

Question: Are there any alternatives to combining categories when expected counts are too small?

Answer: Yes, there are several alternatives to combining categories:

  • Fisher's Exact Test: For 2×2 tables, this provides exact p-values without relying on the chi-square approximation
  • Monte Carlo simulation: Uses computational methods to estimate p-values by simulating the distribution
  • Yates' continuity correction: For 2×2 tables, applies a correction factor to make the test more conservative
  • Bayesian approaches: Use prior distributions to handle small sample sizes
  • Bootstrap methods: Resample from the observed data to estimate the distribution

Fisher's Exact Test is particularly useful for 2×2 tables and is available in most statistical software packages. It's computationally intensive for larger tables but provides exact results.

Monte Carlo methods can handle larger tables and provide accurate p-values even with small expected counts. They're especially useful when combining categories isn't appropriate.

The choice depends on your specific situation, the size of your table, and the software available to you.