Chi-Squared Test for Goodness-of-Fit Study Notes
Chi-Squared Test for Goodness-of-Fit
Overview of Chi-Squared Test for Goodness-of-Fit
Chi-squared test is a type of hypothesis test used to determine if there is a significant difference between expected frequencies and observed frequencies in categorical data.
The test is typically grounded in probability experiments where different outcomes are expected based on specific hypotheses.
Hypotheses in Chi-Squared Testing:
Null Hypothesis (H0): States that there is no significant difference between the expected and observed probabilities.
For a fair die, the null hypothesis would state that the probability of rolling each side (1 to 6) is equal (i.e., $P = \frac{1}{6}$ for each side).
Alternative Hypothesis (H1): Proposes that there is a significant difference between the expected and observed probabilities.
For example, it might suggest that the die is not fair and the rolls vary from the rough expectation of $P = \frac{1}{6}$.
Understanding Expected Frequencies
Expected frequencies refer to the number of occurrences that would be expected if the null hypothesis were true.
If rolling a die 30 times, the expected frequency for rolling a 1 would be calculated as:
Observed Frequencies
Observed frequencies refer to the actual counts of occurrences from the experiment (the results of the die rolls).
Calculation of Chi-Squared Test Statistic ($\chi^2$)
The formula for calculating the chi-squared value is:
where:$O_i$ = observed frequency of outcome i
$E_i$ = expected frequency of outcome i
The summation is done over all possible outcomes.
Example of computation based on rolling a die:
Browse through the observed and expected values!
Distribution of Chi-Squared Test Statistic
The chi-squared statistic is distributed according to the chi-squared distribution, which is skewed and defined by the degrees of freedom (df).
For a die with 6 faces, degrees of freedom would be calculated as:
Where k = number of outcomes (for a fair die, k=6, thus $df = 6 - 1 = 5$).
Rejecting or Failing to Reject the Null Hypothesis
The rejection criterion involves comparing the calculated chi-squared statistic with a critical value from a chi-squared distribution table based on chosen significance level and degrees of freedom.
For instance, with a significance level of $\alpha = 0.025$ and $df = 5$, the critical value ($\chi_{\alpha}^2$) can be looked up in a table, yielding 12.833.
If the calculated chi-squared statistic exceeds this critical value, we reject the null hypothesis (
If $\chi^2 \geq \chi{\alpha}^2$ then reject $H0$).
Example Experiment
Performing an experiment by rolling a die 36 times; the observed occurrences were:
1: 5
2: 5
3: 6
4: 8
5: 5
6: 7
Calculate observed differences from expected:
E.g. for die rolls: $E = 6$ for each side.
Compute $\chi^2$ using formula:
Sum gives $\chi^2 = 1.33$.
Conclusion
Since calculated chi-squared (1.33) is less than the critical value (12.833), we fail to reject the null hypothesis.
Result suggests that the die is likely fair, as expected frequencies are consistent with observed frequencies based on the rolls.