Browse By Unit
5 min read•june 18, 2024
Josh Argo
Jed Quiaoit
Josh Argo
Jed Quiaoit
Recall from the previous section that a chi-square goodness of fit test determines if an observed frequency distribution differs significantly from a theoretical expected distribution. It is used to test whether the observed frequencies in one or more categories differ significantly from the expected frequencies in those categories. 💪
The big picture procedure for carrying out a chi-square goodness of fit test goes:
(1) Hypotheses: State the null and alternative hypotheses: The null hypothesis is that the observed frequency distribution is the same as the expected frequency distribution, while the alternative hypothesis is that the observed and expected frequency distributions are significantly different.
(2) Significance Level: Choose a significance level: This is the probability of rejecting the null hypothesis when it is true. Commonly used values are 0.1, 0.05, and 0.01.
(3) Chi-Square Statistic: Calculate the chi-square statistic: The chi-square statistic is calculated using the formula:
(4) DF Analysis: Determine the degrees of freedom: The degrees of freedom is equal to the number of categories minus 1.
(5) Critical Value & Tables: Look up the critical value of chi-square in a chi-square table: The critical value is the value that corresponds to the chosen significance level and degrees of freedom.
(6) Comparisons! Compare the chi-square statistic to the critical value: If the chi-square statistic is greater than the critical value, then the null hypothesis is rejected and the alternative hypothesis is accepted. If the chi-square statistic is less than or equal to the critical value, then the null hypothesis cannot be rejected.
(7) Conclusion: If the null hypothesis is rejected, then the observed frequency distribution is significantly different from the expected frequency distribution. If the null hypothesis is not rejected, then the observed frequency distribution is not significantly different from the expected frequency distribution.
Now that we have checked our necessary conditions and written our hypotheses for our test, it is now time to actually carry out the test! Our test will consist of two mathematical elements: the test statistic (χ2 statistic) and our p-value. 🤖
The first thing we need to calculate in order to finish our test is our χ2 value which is found using the formula found in the image above. We are going to take each of our observed counts, subtract the expected counts, square that difference and then divide by the expected count. After we have done that for all of our counts, we will sum up the total of these and get our χ2 value for that test. 📝
As with our other test statistics when we used z-scores and t-scores, a χ2 value close to 0 will support the null hypothesis, because it shows that there is not much difference between the observed and expected counts. As that difference increases more and more, we get more of an idea that our expected counts are not accurate. Therefore, leading us to reject the null hypothesis in favor of the alternate hypothesis (which states that at least one of the null proportions is incorrect).
For example, let’s return to our happiness survey with this null hypothesis: 😊
We would:
Recall that the p-value is the probability of obtaining a chi-square statistic that is at least as extreme as the one observed, given that the null hypothesis is true. 🅿️
Once you finally get your χ2 value, you calculate your p-value by finding the probability of getting that particular χ2 by random chance. As always, if our p is low, we reject the Ho.
To determine the p-value, you will need to use a chi-square table or a computer program to look up the critical value of chi-square that corresponds to the chosen significance level and degrees of freedom. The p-value is then calculated based on the observed chi-square statistic and the critical value.
Once you have calculated the chi-square statistic and p-value, you can then compare the chi-square statistic to the critical value to determine whether to reject or fail to reject the null hypothesis. If the chi-square statistic is greater than the critical value, then the null hypothesis is rejected and the alternative hypothesis is accepted. If the chi-square statistic is less than or equal to the critical value, then the null hypothesis cannot be rejected.
After calculating our test for the happiness example, this was the calculator output that we got:
Since our p-value (~0) is less than 0.05, we reject the null hypothesis. We have convincing evidence that at least one of the proportions for how people rank on the happiness scale is incorrect. 😔
🎥 Watch: AP Stats Unit 8 - Chi Squared Tests
<< Hide Menu
5 min read•june 18, 2024
Josh Argo
Jed Quiaoit
Josh Argo
Jed Quiaoit
Recall from the previous section that a chi-square goodness of fit test determines if an observed frequency distribution differs significantly from a theoretical expected distribution. It is used to test whether the observed frequencies in one or more categories differ significantly from the expected frequencies in those categories. 💪
The big picture procedure for carrying out a chi-square goodness of fit test goes:
(1) Hypotheses: State the null and alternative hypotheses: The null hypothesis is that the observed frequency distribution is the same as the expected frequency distribution, while the alternative hypothesis is that the observed and expected frequency distributions are significantly different.
(2) Significance Level: Choose a significance level: This is the probability of rejecting the null hypothesis when it is true. Commonly used values are 0.1, 0.05, and 0.01.
(3) Chi-Square Statistic: Calculate the chi-square statistic: The chi-square statistic is calculated using the formula:
(4) DF Analysis: Determine the degrees of freedom: The degrees of freedom is equal to the number of categories minus 1.
(5) Critical Value & Tables: Look up the critical value of chi-square in a chi-square table: The critical value is the value that corresponds to the chosen significance level and degrees of freedom.
(6) Comparisons! Compare the chi-square statistic to the critical value: If the chi-square statistic is greater than the critical value, then the null hypothesis is rejected and the alternative hypothesis is accepted. If the chi-square statistic is less than or equal to the critical value, then the null hypothesis cannot be rejected.
(7) Conclusion: If the null hypothesis is rejected, then the observed frequency distribution is significantly different from the expected frequency distribution. If the null hypothesis is not rejected, then the observed frequency distribution is not significantly different from the expected frequency distribution.
Now that we have checked our necessary conditions and written our hypotheses for our test, it is now time to actually carry out the test! Our test will consist of two mathematical elements: the test statistic (χ2 statistic) and our p-value. 🤖
The first thing we need to calculate in order to finish our test is our χ2 value which is found using the formula found in the image above. We are going to take each of our observed counts, subtract the expected counts, square that difference and then divide by the expected count. After we have done that for all of our counts, we will sum up the total of these and get our χ2 value for that test. 📝
As with our other test statistics when we used z-scores and t-scores, a χ2 value close to 0 will support the null hypothesis, because it shows that there is not much difference between the observed and expected counts. As that difference increases more and more, we get more of an idea that our expected counts are not accurate. Therefore, leading us to reject the null hypothesis in favor of the alternate hypothesis (which states that at least one of the null proportions is incorrect).
For example, let’s return to our happiness survey with this null hypothesis: 😊
We would:
Recall that the p-value is the probability of obtaining a chi-square statistic that is at least as extreme as the one observed, given that the null hypothesis is true. 🅿️
Once you finally get your χ2 value, you calculate your p-value by finding the probability of getting that particular χ2 by random chance. As always, if our p is low, we reject the Ho.
To determine the p-value, you will need to use a chi-square table or a computer program to look up the critical value of chi-square that corresponds to the chosen significance level and degrees of freedom. The p-value is then calculated based on the observed chi-square statistic and the critical value.
Once you have calculated the chi-square statistic and p-value, you can then compare the chi-square statistic to the critical value to determine whether to reject or fail to reject the null hypothesis. If the chi-square statistic is greater than the critical value, then the null hypothesis is rejected and the alternative hypothesis is accepted. If the chi-square statistic is less than or equal to the critical value, then the null hypothesis cannot be rejected.
After calculating our test for the happiness example, this was the calculator output that we got:
Since our p-value (~0) is less than 0.05, we reject the null hypothesis. We have convincing evidence that at least one of the proportions for how people rank on the happiness scale is incorrect. 😔
🎥 Watch: AP Stats Unit 8 - Chi Squared Tests
© 2024 Fiveable Inc. All rights reserved.