Chi-Square Tests: Theory, Formulas, and Applications

Introduction to Chi-Square χ2\chi^2 Tests

  • Chi-square χ2\chi^2 tests are designed to test hypotheses regarding patterns of outcomes based on frequency counts for categorical random variables.

  • The chapter covers two primary types of chi-square tests:

    • Goodness of Fit Test: This is used to assess how closely the distribution of a single categorical variable matches a specific expected distribution.

      • Example: Determining if the model for student transportation methods (drive, bike, walk, other) has changed from 5 years ago.

    • Test of Independence: This is used to assess whether two categorical variables are independent of one another or if an association exists between them.

      • Example: Investigating if there is an association between gender and smoking habits.

Properties of the Chi-Square Distribution

  • The Chi-Square distribution is not a single distribution but a family of distributions, with a unique curve for each degree of freedom.

  • It possesses only one parameter: the degrees of freedom (dfdf).

  • The distribution is non-symmetrical and skewed to the right (χ2\chi^2 is a skewed distribution).

  • As the degrees of freedom (dfdf) increase, the distribution becomes more symmetrical.

  • The distribution assumes non-negative values only (it starts at zero and extends to positive infinity).

  • The total area under the curve is always equal to 11.

Calculation of the Test Statistic

  • The χ2\chi^2 test statistic can be computed using two equivalent formulas:

    • χ2=∑(O2E)−n\chi^2 = \sum \left( \frac{O^2}{E} \right) - n

    • χ2=∑(O−E)2E\chi^2 = \sum \frac{(O - E)^2}{E}

  • Definitions of variables used in the formulas:

    • OO = observed frequency

    • EE = expected frequency

    • nn = sample size

Rejection Region and Decision Rules

  • For chi-square tests, the rejection region lies exclusively on the right side of the distribution curve.

  • The area of this rejection region is equal to the level of significance (Alpha, α\alpha).

  • Rejection Rule: If the calculated test statistic (χ2\chi^2) lies in the rejection region, reject the null hypothesis (H0H_0) in favor of the alternative hypothesis (H1H_1).

    • Formal condition: Reject H0H_0 if χ2>χdf;α2\chi^2 > \chi^2_{df; \alpha}.

Goodness-of-Fit Test: Example 1 (Age Distribution of Arrests)

  • Scenario: A sample of 100100 people arrested for drunk driving was categorized by age.

  • Data Table:

    • Age 16-20: 25 arrests

    • Age 21-25: 32 arrests

    • Age 26-30: 19 arrests

    • Age 31-35: 16 arrests

    • Age 36-40: 8 arrests

  • Hypotheses:

    • H0H_0: The proportion of people arrested for drunk driving is the same for all age groups.

    • H1H_1: The proportion is not the same for all age groups.

  • Calculation Details:

    • Total sample size n=100n = 100.

    • Expected frequency (EE) for each of the 5 groups if the proportion is the same: 1005=20\frac{100}{5} = 20.

    • Calculation of ∑O2E\sum \frac{O^2}{E}:

      • Group 1: 25220=31.25\frac{25^2}{20} = 31.25

      • Group 2: 32220=51.2\frac{32^2}{20} = 51.2

      • Group 3: 19220=18.05\frac{19^2}{20} = 18.05

      • Group 4: 16220=12.8\frac{16^2}{20} = 12.8

      • Group 5: 8220=3.2\frac{8^2}{20} = 3.2

    • Total Sum: 31.25+51.2+18.05+12.8+3.2=116.531.25 + 51.2 + 18.05 + 12.8 + 3.2 = 116.5

  • Test Statistic:

    • χ2=116.5−100=16.5\chi^2 = 116.5 - 100 = 16.5

  • Critical Value and Conclusion:

    • Level of significance α=0.01\alpha = 0.01.

    • Degrees of freedom df=k−1=5−1=4df = k - 1 = 5 - 1 = 4 (where kk is the number of categories).

    • Critical value χ4;0.012=13.277\chi^2_{4; 0.01} = 13.277.

    • Decision: Since 16.5>13.27716.5 > 13.277, reject H0H_0.

    • Conclusion: There is insufficient evidence to conclude that the proportion of drunk drivers is the same for all age groups.

Goodness-of-Fit Test: Example 2 (Bokomo Cereal Sales)

  • Scenario: Bokomo breakfast cereal sells in three sizes: Large, Medium, and Small. The national sales ratio is 3:5:23:5:2. Sales in the Limpopo region are tracked to see if they match the national pattern.

  • Limpopo Observed Sales (O): Large = 190, Medium = 250, Small = 100. Total cases (nn) = 540.

  • Hypotheses:

    • H0H_0: The Limpopo region’s pattern of sales is the same as the national sales pattern.

    • H1H_1: The Limpopo region’s pattern of sales is not the same as the national sales pattern.

  • Calculations:

    • National ratio total: 3+5+2=103 + 5 + 2 = 10 parts.

    • Expected frequencies (EE):

      • Large: 540×310=162540 \times \frac{3}{10} = 162

      • Medium: 540×510=270540 \times \frac{5}{10} = 270

      • Small: 540×210=108540 \times \frac{2}{10} = 108

    • Calculation of O2E\frac{O^2}{E}:

      • Large: 1902162≈222.84\frac{190^2}{162} \approx 222.84

      • Medium: 2502270≈231.48\frac{250^2}{270} \approx 231.48

      • Small: 1002108≈92.59\frac{100^2}{108} \approx 92.59

    • Total ∑O2E=546.91\sum \frac{O^2}{E} = 546.91

  • Test Statistic:

    • χ2=546.91−540=6.91\chi^2 = 546.91 - 540 = 6.91

  • Critical Value and Conclusion:

    • Level of significance α=0.05\alpha = 0.05.

    • Degrees of freedom df=k−1=3−1=2df = k - 1 = 3 - 1 = 2.

    • Critical value χ2;0.052=5.991\chi^2_{2; 0.05} = 5.991.

    • Decision: Since 6.91>5.9916.91 > 5.991, reject H0H_0.

    • Conclusion: There is insufficient evidence to conclude that the Limpopo region’s pattern of sales is the same as the national sales pattern.

Test of Independence

  • This test determines association or dependence between two variables arranged in a contingency table.

  • Expected Frequency Formula: For each cell in the table, the expected frequency is calculated as:

    • E=row total×column totalgrand totalE = \frac{\text{row total} \times \text{column total}}{\text{grand total}}

  • Degrees of Freedom: For a contingency table, the degrees of freedom are determined by:

    • df=(r−1)(c−1)df = (r - 1)(c - 1), where rr is the number of rows and cc is the number of columns.

Test of Independence: Example (Gender and TV Watching)

  • Scenario: A sample of 9090 adults is classified by gender and weekly television watching time.

  • Observed Data (OO):

    • Male: 27 (Under 25 hours), 15 (Over 25 hours). Total males = 42.

    • Female: 19 (Under 25 hours), 29 (Over 25 hours). Total females = 48.

    • Row totals: Under 25 hours = 46; Over 25 hours = 44. Grand total (nn) = 90.

  • Hypotheses:

    • H0H_0: Gender and time spent watching TV are independent.

    • H1H_1: Gender and time spent watching TV are dependent.

  • Calculated Expected Frequencies (EE):

    • Cell 1 (Male/Under 25): E=46×4290=21.47E = \frac{46 \times 42}{90} = 21.47

    • Cell 2 (Female/Under 25): E=46×4890=24.53E = \frac{46 \times 48}{90} = 24.53

    • Cell 3 (Male/Over 25): E=44×4290=20.53E = \frac{44 \times 42}{90} = 20.53

    • Cell 4 (Female/Over 25): E=44×4890=23.47E = \frac{44 \times 48}{90} = 23.47

  • Calculated Values for O2E\frac{O^2}{E}:

    • Cell 1: 27221.47=33.95\frac{27^2}{21.47} = 33.95

    • Cell 2: 19224.53=14.72\frac{19^2}{24.53} = 14.72

    • Cell 3: 15220.53=10.96\frac{15^2}{20.53} = 10.96

    • Cell 4: 29223.47=35.83\frac{29^2}{23.47} = 35.83

    • Total ∑O2E=95.46\sum \frac{O^2}{E} = 95.46

  • Test Statistic:

    • χ2=95.46−90=5.46\chi^2 = 95.46 - 90 = 5.46

  • Critical Value and Conclusion:

    • Level of significance α=0.01\alpha = 0.01.

    • Degrees of freedom df=(2−1)(2−1)=1df = (2 - 1)(2 - 1) = 1.

    • Critical value χ1;0.012=6.635\chi^2_{1; 0.01} = 6.635.

    • Decision: Since 5.64<6.6355.64 < 6.635 (Note: The transcript calculates 5.46 but cites 5.64 in the decision summary), the test statistic does not lie in the rejection region. Do not reject H0H_0.

    • Conclusion: There is insufficient evidence to conclude that the time spent watching TV is dependent on gender.