The chi-square goodness of fit test is a statistical test used to determine whether there is a significant difference between the expected and observed frequencies in one or more categories. It is often applied when dealing with categorical data and is useful for assessing whether the distribution of observed categorical data differs from a theoretical or expected distribution.
Chi-Square Goodness of Fit Test Formula:
The chi-square statistic (�2χ2) is calculated using the following formula:
�2=∑(��−��)2��χ2=∑Ei(Oi−Ei)2
where:
- ��Oi is the observed frequency in category �i,
- ��Ei is the expected frequency in category �i,
- ∑∑ indicates the sum across all categories.
Chi-Square Goodness of Fit Test Steps:
- Formulate Hypotheses:
- Null Hypothesis (�0H0): The observed frequencies are consistent with the expected frequencies.
- Alternative Hypothesis (��Ha): There is a significant difference between the observed and expected frequencies.
- Choose Significance Level (�α):
- Common choices are 0.05 or 0.01.
- Determine Degrees of Freedom (��df):
- ��=Number of Categories−1df=Number of Categories−1
- Calculate Expected Frequencies:
- Based on a theoretical distribution or hypothesis.
- Calculate Chi-Square Statistic:
- Use the formula mentioned above.
- Compare with Critical Value or P-value:
- If using critical values, compare �2χ2 with the critical value from the chi-square distribution table.
- If using p-values, compare the p-value with the chosen significance level.
- Make a Decision:
- If �2χ2 is greater than the critical value or if the p-value is less than �α, reject the null hypothesis.
Example:
Let’s say you have survey data on the favorite color of people in a town and you want to test whether the distribution matches a hypothesized distribution.
- Observed Frequencies:
- Red: 25
- Blue: 30
- Green: 15
- Yellow: 10
- Expected Frequencies (Hypothesized Distribution):
- Red: 20
- Blue: 25
- Green: 20
- Yellow: 15
- Degrees of Freedom (��df): ��=4−1=3df=4−1=3 (four color categories)
- Calculate Chi-Square:
- Use the formula to calculate the chi-square statistic.
- Compare with Critical Value or P-value:
- Refer to the chi-square distribution table or use statistical software to find the critical value or p-value.
- Make a Decision:
- If the chi-square statistic is greater than the critical value or the p-value is less than the significance level, reject the null hypothesis.
The chi-square goodness of fit test is applicable when you are comparing observed and expected frequencies in categorical data, and it is crucial to ensure that the assumptions of the test are met, such as the data being independent and the expected frequencies in each category being reasonably large.