Skip to main content

Section 9.2 One-Way Tables
 1 
This section is adapted from David M. Lane. "One-Way Tables (Testing Goodness of Fit)." Online Statistics Education: A Multimedia Course of Study. https://onlinestatbook.com/2/chi_square/one-way.html

The Chi Square distribution can be used to test whether observed data differ significantly from theoretical expectations. For example, for a fair six-sided die, the probability of any given outcome on a single roll would be 1/6. The data in Table 9.2.1 were obtained by rolling a six-sided die 36 times. However, as can be seen in Table 9.2.1, some outcomes occurred more frequently than others. For example, a “3” came up nine times, whereas a “4” came up only two times. Are these data consistent with the hypothesis that the die is a fair die? Naturally, we do not expect the sample frequencies of the six possible outcomes to be the same since chance differences will occur. So, the finding that the frequencies differ does not mean that the die is not fair. One way to test whether the die is fair is to conduct a significance (hypothesis) test. The null hypothesis is that the die is fair. This hypothesis is tested by computing the probability of obtaining frequencies as discrepant or more discrepant from a uniform distribution of frequencies as obtained in the sample. If this probability is sufficiently low, then the null hypothesis that the die is fair can be rejected.
Table 9.2.1. Outcome Frequencies from a Six-Sided Die.
Outcome Frequency
1 8
2 5
3 9
4 2
5 7
6 5
The first step in conducting the significance test is to compute the expected frequency for each outcome given that the null hypothesis is true. For example, the expected frequency of a “1” is 6 since the probability of a “1” coming up is 1/6 and there were a total of 36 rolls of the die.
Expected frequency = (1/6)(36) = 6
Note that the expected frequencies are expected only in a theoretical sense. We do not really “expect” the observed frequencies to match the “expected frequencies” exactly.
The calculation continues as follows. Letting E be the expected frequency of an outcome and O be the observed frequency of that outcome, compute
\begin{equation*} \frac{(E-O)^2}{E} \end{equation*}
for each outcome. Table 9.2.2 shows these calculations.
Table 9.2.2. Outcome Frequencies from a Six-Sided Die.
Outcome E O \(\frac{(E-O)^2}{E}\)
1 6 8 0.667
2 6 5 0.167
3 6 9 1.500
4 6 2 2.667
5 6 7 0.167
6 6 5 0.167
Next we add up all the values in Column 4 of Table 9.2.2.
\begin{equation*} \sum{\frac{(E-O)^2}{E}}=5.333 \end{equation*}
This sampling distribution of
\begin{equation*} \sum{\frac{(E-O)^2}{E}} \end{equation*}
is approximately distributed as Chi Square with k-1 degrees of freedom, where k is the number of categories (in our example, the six possible values we might get from a die roll). Therefore, for this problem the test statistic is
\begin{equation*} \chi^2_5=5.333 \end{equation*}
which means the value of Chi Square with 5 degrees of freedom is 5.333.
From a Chi Square calculator
 2 
it can be determined that the probability of a Chi Square of 5.333 or larger is 0.377. Therefore, the null hypothesis that the die is fair cannot be rejected.
This Chi Square test can also be used to test other deviations between expected and observed frequencies. The following example shows a test of whether the variable “University GPA” in the “SAT and College GPA” case study
 3 
(used previously to demonstrate regression) is normally distributed.
The first column in Table 9.2.3 shows the standard normal distribution divided into four ranges. The second column shows the proportions of a standard normal distribution falling in the ranges specified in the first column. For example, we see that for the range 0 to 1, the proportion is 0.341 (or 34.1%). This follows directly from what we learned in Chapter 5; 68% of the area under the standard normal distribution lies between -1 and 1, so naturally 34% (half of 68%) will be covered by [0, 1]. The expected frequencies (E) are calculated by multiplying the number of scores (105) by the proportion expected according to the standard normal distribution. The final column shows the observed number of scores (O) in each range, after standardizing the University GPA variable so that it will map onto the standard normal distribution (see Subsection 5.2.3). It is clear from the table that the observed frequencies vary greatly from the expected frequencies. Note that if the distribution were normal, we would expect only about 35 scores between 0 and 1, whereas 60 were observed.
Table 9.2.3. Expected and Observed Scores for 105 University GPA Scores.
Range Proportion E O
Above 1 0.159 16.695 9
0 to 1 0.341 35.805 60
-1 to 0 0.341 35.805 17
Below -1 0.159 16.695 19
The test of whether the observed scores deviate significantly from the expected scores is computed using the familiar calculation.
\begin{equation*} \chi^2_3=\sum\frac{(E-O)^2}{E}=30.09 \end{equation*}
The subscript “3” means there are three degrees of freedom. As before, the degrees of freedom is the number of outcomes (in our example, the number of ranges listed in Table 9.2.3) minus 1, which is 4 - 1 = 3 in this example. A Chi Square distribution calculator shows that p \(\lt\) 0.001 for this Chi Square. Therefore, the null hypothesis that the scores are normally distributed can be rejected.