11.2 - Goodness of Fit Test
A chi-square goodness-of-fit test can be conducted when there is one categorical variable with more than two levels. If there are exactly two categories, then a one proportion z test may be conducted. The levels of that categorical variable must be mutually exclusive. In other words, each case must fit into one and only one category.
We can test that the proportions are all equal to one another or we can test any specific set of proportions.
If the expected counts, which we'll learn how to compute shortly, are all at least five, then the chi-square distribution may be used to approximate the sampling distribution. If any expected count is less than five, then a randomization test should be conducted.
- When randomly selecting a card from a deck with replacement, are we equally likely to select a heart, diamond, spade, and club?
- According to one research study, in the United States 2% of adults identify as homosexual, 2% as bisexual, and 96% as heterosexual. Are these proportions different in the population of Penn State students?
- A concessions stand sells blue, red, purple, and green freezer pops. They survey a sample of children and ask which of the four colors is their favorite. They want to know if the colors differ in popularity.
In conducting a goodness-of-fit test, we compare observed counts to expected counts. Observed counts are the number of cases in the sample in each group. Expected counts are computed given that the null hypothesis is true; this is the number of cases we would expect to see in each cell if the null hypothesis were true.
- Expected Cell Value
- \(E=n (p_i)\)
\(n\) is the total sample size
\(p_i\) is the hypothesized proportion of the "ith" group
The observed and expected values are then used to compute the chi-square (\(\chi^2\)) test statistic.
- Chi-Square (\(\chi^2\)) Test Statistic
StatKey has the ability to conduct a randomization test for a goodness-of-fit test. There is an example of this in Section 7.1 of the Lock5 textbook. If all expected values are at least five, then the sampling distribution can be approximated using a chi-square distribution.
Like the t distribution, the chi-square distribution varies depending on the degrees of freedom. Degrees of freedom for a chi-square goodness-of-fit test are equal to the number of groups minus 1. The distribution plot below compares the chi-square distributions with 2, 4, and 6 degrees of freedom.
To find the p-value we find the area under the chi-square distribution to the right of our test statistic. A chi-square test is always right-tailed.