Chi-Square Goodness of Fit Test Examples and Procedures

Overview of Chi-Square Goodness of Fit Test Examples

  • The Chi-Square Goodness of Fit test is used to determine how well observed data fits an expected distribution.

  • There are two primary ways to determine expected proportions:

    • Assuming all categories are equal: This treats every category as having the same probability of occurrence.

    • Based on previous research: This uses existing data or historical statistics to define what the proportions should be today.

Example 1: Assuming All Categories are Equal (The Fair Die)

  • Problem Context: A gambler wants to know if a six-sided die is fair.

  • Definition of a Fair Die: A die is considered "fair" if it rolls all six sides equally. This is analogous to a "fair coin" providing heads and tails with equal frequency.

  • Data Collection: The gambler throws the die a total of n=50n = 50 times.

  • Observed Frequencies (fof_o): These are the actual data points collected from the experiment.

    • Side 1: 88

    • Side 2: 66

    • Side 3: 1010

    • Side 4: 99

    • Side 5: 66

    • Side 6: 1111

    • Total observations (nn): 5050.

Step 1: State the Null Hypothesis (H0H_0)

  • H0H_0: The die is fair.

  • In a Chi-Square test, H0H_0 states the expected proportions. For a fair six-sided die, the proportion for each side is expected to be 1/61/6.

  • Individual Expected Proportions: P1=1/6,P2=1/6,P3=1/6,P4=1/6,P5=1/6,P6=1/6P_1 = 1/6, P_2 = 1/6, P_3 = 1/6, P_4 = 1/6, P_5 = 1/6, P_6 = 1/6.

  • Alternative Hypothesis (H1H_1): The die is not fair (at least one side is not rolled 1/61/6 of the time).

Step 2: Calculate Expected Frequencies (fef_e) and Chi-Square Obtained (χobt2\chi^2_{obt})

  • Formula for Expected Frequency: fe=n×expected proportionf_e = n \times \text{expected proportion}.

  • Calculation: 50×(1/6)=50/6=8.3350 \times (1/6) = 50/6 = 8.33.

  • Because we assume all categories are equal, the fef_e for every side is 8.338.33.

  • Self-Check: The sum of the expected frequencies must equal the sample size (nn).

    • 8.33×6=49.988.33 \times 6 = 49.98.

    • The discrepancy (off by 0.020.02) is due to rounding error from using two decimal places instead of infinity. For the purpose of the test, this is considered equal to 5050.

  • Formula for Chi-Square Obtained: χ2=(fefo)2fe\chi^2 = \sum \frac{(f_e - f_o)^2}{f_e}

  • Calculations for each category:

    • Side 1: (8.338)28.33=0.01\frac{(8.33 - 8)^2}{8.33} = 0.01

    • Side 2: (8.336)28.33=0.65\frac{(8.33 - 6)^2}{8.33} = 0.65

    • Side 3: (8.3310)28.33=0.34\frac{(8.33 - 10)^2}{8.33} = 0.34

    • Side 4: (8.339)28.33=0.05\frac{(8.33 - 9)^2}{8.33} = 0.05

    • Side 5: (8.336)28.33=0.65\frac{(8.33 - 6)^2}{8.33} = 0.65

    • Side 6: (8.3311)28.33=0.85\frac{(8.33 - 11)^2}{8.33} = 0.85

  • Total χobt2\chi^2_{obt}: Adding these six values gives 2.552.55.

  • Calculator Warning: When squaring values, always ensure you handle negatives correctly (e.g., using parentheses) so the result is positive; a squared number cannot be negative.

Step 3: Find Degrees of Freedom (dfdf) and Chi-Square Critical (χcrit2\chi^2_{crit})

  • Degrees of Freedom formula: df=c1df = c - 1, where cc is the number of categories.

  • Calculation: 61=56 - 1 = 5.

  • Decision Criteria: Use alpha (α\alpha) = 0.050.05.

  • Looking at the distribution table for df=5df = 5 and α=0.05\alpha = 0.05, the critical value is 11.0711.07.

Step 4: Decision and Conclusion

  • Comparison: Is \chi^2_{obt} > \chi^2_{crit}?

  • 2.55 > 11.07 is False.

  • Decision: Fail to reject H0H_0.

  • Retain Hypothesis: We keep H0H_0, meaning there is no significant evidence to suggest the die is unfair. We did not "prove" it is fair, but we failed to find evidence to throw the assumption out.

  • Conclusion: The die is rolled 1/61/6 of the time for each side; the die is fair.

  • APA Format: \chi^2(5, n = 50) = 2.55, p > 0.05 (Note: p > 0.05 because we failed to reject the null hypothesis).

Example 2: Proportions from Previous Research (Student Major Trends)

  • Problem Context: 15 years ago, the Chaffey Psychology Department surveyed Social Science 10 students and found specific proportions of majors. An instructor today wants to see if these proportions have changed.

  • Past Research Proportions (1515 years ago):

    • Psychology: 70%70\%

    • Sociology: 20%20\%

    • All other majors: 10%10\%

  • Current Data (n=30n = 30 students):

    • Psychology observed: 1212

    • Sociology observed: 1010

    • Other observed: 88

  • Objective: Use α=0.05\alpha = 0.05 to see if student major distributions have changed.

Step 1: State the Null Hypothesis (H0H_0)

  • H0H_0: The proportions today are the same as they were 15 years ago (70%,20%,10%70\%, 20\%, 10\%).

  • This implies the status quo has not changed over the passage of time.

Step 2: Calculate Expected Frequencies (fef_e) and Chi-Square Obtained (χobt2\chi^2_{obt})

  • Calculate fef_e based on the sample size (n=30n=30):

    • Psych: 30×0.70=2130 \times 0.70 = 21

    • Sociology: 30×0.20=630 \times 0.20 = 6

    • Other: 30×0.10=330 \times 0.10 = 3

  • Verification: 21+6+3=3021 + 6 + 3 = 30. The total expected equals the total observed.

  • Initial Observation: Comparing observed (12,10,812, 10, 8) to expected (21,6,321, 6, 3), there appear to be large differences. We observe fewer Psych majors and more "Other" majors than expected.

  • Chi-Square Calculation:

    • Psych: (2112)221=3.86\frac{(21 - 12)^2}{21} = 3.86

    • Sociology: (610)26=2.67\frac{(6 - 10)^2}{6} = 2.67

    • Other: (38)23=8.33\frac{(3 - 8)^2}{3} = 8.33

  • Total χobt2\chi^2_{obt}: 3.86+2.67+8.33=14.863.86 + 2.67 + 8.33 = 14.86.

Step 3: Find Degrees of Freedom (dfdf) and Chi-Square Critical (χcrit2\chi^2_{crit})

  • Categories (cc) = 3 (Psych, Soc, Other).

  • df=31=2df = 3 - 1 = 2.

  • For α=0.05\alpha = 0.05 and df=2df = 2, consult the table: χcrit2=5.99\chi^2_{crit} = 5.99.

Step 4: Decision and Conclusion

  • Comparison: Is \chi^2_{obt} > \chi^2_{crit}?

  • 14.86 > 5.99 is True.

  • Decision: Reject H0H_0.

  • Conclusion: The proportions of majors today are significantly different from the past research 15 years ago. Specifically, the distribution of Psych, Sociology, and Other majors in Social Science 10 has changed.

  • APA Format: \chi^2(2, n = 30) = 14.86, p < 0.05 (Note: Speaker clarifies that the APA string should list sample size as n=30n = 30 rather than repeating dfdf).

  • Since the null hypothesis was rejected, we use p < 0.05 to indicate significance.