In goodness-of-fit tests, chi-square analysis is applied for the purpose of examining whether sample data could have been drawn from a population having a specified probability distribution. For example, we may wish to determine from sample data (1) whether a random number table differs significantly from its hypothesized discrete uniform distribution, (2) whether a set of data could have come from a population having a normal distribution, or (3) whether the distribution of contributions to a local public television station differs significantly from those for such stations across the nation. With regard to item 2, we have already discussed a number of techniques which assume that sample data have come from a population that is either normally distributed or approximately so. This section provides an Excel-based, chi-square goodness-of-fit test designed specifically to examine whether sample data could have come from a normally distributed population.
( 13.3 )
Procedure
The procedure first requires that we arrange the sample data into categories that are mutually exclusive and exhaustive. We then count the number of data values in each of these categories and use these counts in constructing the table of observed frequencies. In the context of the general procedure shown in Figure 13.2, this table of observed frequencies will have one row and k columns. Since there is just one row, we will simply refer to each observed frequency as Oj, with j 5 1 through k.
The null and alternative hypotheses are the key to the next step. Again, these are
H0: The sample is from the specified population.
H1: The sample is not from the specified population.
Under the assumption that the null hypothesis is true, we construct a table of expected frequencies (Ej, with j 5 1 through k) that are based on the probability distribution from which the sample is assumed to have been drawn. The test sta- tistic, 2, is a measure of the extent to which these tables differ. From an intuitive standpoint, a large amount of discrepancy between the frequencies that are ob- served and those that are expected tends to cause us to reject the null hypothesis.
The test statistic is calculated as follows:
Chi-square test for goodness-of-fit:
Calculated 25 o
j51
k
(Oj2 Ej)2
wwwww Ej where k 5 number of categories, or cells in the table Oj5 observed frequency
in cell j
Ej5 expected frequency in cell j
and df 5 k 2 1 2 m, with m 5 the number of population parameters (e.g., or ) that must be estimated from sample data in order to carry out the goodness-of-fit test.
The test is upper-tail, and the critical value of 2 will be that associated with the level of significance () and degrees of freedom (df ) for the test. Regarding the determination of df, the (k 2 1) portion of the df expression is required because we have already lost one degree of freedom by arranging the frequen- cies into categories. Since we know the total number of observations in all cells (the sample size), we need only know the contents of (k 21) cells to determine the count in the kth cell. We must also further reduce df by 1 for each popula- tion parameter that has been estimated in order to carry out the test. Each such estimation represents additional help in our construction of the table of expected frequencies, and the purpose of the reductions beyond (k 21) is to correct for this assistance. This aspect of the df determination will be further discussed in the context of the examples that follow.
As a rule of thumb, it is important that the total sample size and selection of categories be such that each expected frequency (Ej) is at least 5. This is because the chi-square distribution is continuous, while the counts on which the test sta- tistic is based are discrete, and the approximation will be unsatisfactory whenever
one or more of the expected frequencies is very small. There are two ways to avoid this problem: (1) use an overall sample size that is large enough that each expected frequency will be at least 5, or (2) combine adjacent cells so that the result will be a cell in which the expected frequency is at least 5.
EXAMPLE
Poisson Distribution
Automobiles leaving the paint department of an assembly plant are subjected to a detailed examination of all exterior painted surfaces. For the most recent 380 automobiles produced, the number of blemishes per car is summarized here—for example, 242 of the automobiles had 0 blemishes, 94 had 1 blemish, and so on.
The underlying data are in file CX13BLEM.
Blemishes per car: 0 1 2 3 4
Number of cars: 242 94 38 4 2
Using the 0.05 level of significance, could these data have been drawn from a population that is Poisson distributed?
SOLUTION
Formulate the Null and Alternative Hypotheses
The null hypothesis is H0: the sample was drawn from a population that is Poisson distributed. The alternative hypothesis is that it was not drawn from such a population.
Specify the Level of Significance (␣) for the Test The 5 0.05 level has been specified.
Construct the Table of Observed Frequencies, Oj
The observed frequencies are as listed earlier and are repeated below.
Blemishes per car: 0 1 2 3 4
Observed frequency, Oj: 242 94 38 4 2 380 Assuming the Null Hypothesis to Be True, Construct the Table of Expected Frequencies, Ej
To construct the table of expected frequencies, we must first use the mean of the sample data to estimate the mean of the Poisson population that is being hypoth- esized. The sample mean is simply the total number of blemishes divided by the total number of cars, or:
}x 5 0(242) 1(94) 2(38) 3(4) 4(2) blemishes wwwwwwwwwwwwwwwwwwwwww380 cars and }x 5 190y380 5 0.5 blemishes per car
Using }x 5 0.5 blemishes per car as our estimate of the true population mean (), we now refer to the “ 5 0.5” portions of the individual and cumulative tables of
EXAMPLE EXAMPLE EXAMPLE EXAMPLE EXAMPLE EXAMPLE EXAMPLE EXAMPLE EXA M
474 Part 4: Hypothesis Testing Poisson probabilities in Appendix A. For a Poisson distribution with 5 0.5, and x 5the number of blemishes per car:
x 5 number Expected number
of blemishes P(x) ? n of cars with x blemishes
0 0.6065 ?380 5 230.470
1 0.3033 ?380 5 115.254
2 0.0758 ?380 5 28.804
3 0.0126 ?380 5 4.788
4 0.0016 ?380 5 0.608
5 or more 0.0002 ?380 5 0.076
1.0000 380.000
The final three categories (x 53, x 54, and x $ 5 blemishes) have expected fre- quencies that are less than 5.0. To satisfy the requirement that all expected frequen- cies be at least 5.0, we will combine these into a new category called “3 or more blemishes,” and it will have an expected frequency of 4.788 10.608 10.076, or 5.472 cars. After this merger, the expected frequencies will be as shown below.
Blemishes per car: 0 1 2 $3
Expected frequency, Ej: 230.470 115.254 28.804 5.472 380.000 The observed frequencies must be based on the same categories used in the ex- pected frequencies, so we need to express the observed frequencies in terms of the same categories (0, 1, 2, and $3) used above. The observed frequencies can now be as shown below.
Blemishes per car: 0 1 2 $3
Observed frequency, Oj: 242 94 38 6 380 Determine the Calculated Value of the 2 Test Statistic
Over the k 54 cells, the calculated chi-square is 7.483, computed as follows:
Calculated 2 5 o
j51
k
(Oj 2 Ej)2 wwwww Ej 5 (242 2 230.470)2