Goodness of Fit Test
In this chapter we compare the distribution of a nominal outcome to that of an external standard distribution. The frequency of various
outcomes is tallied with a FREQ command. As an example, the frequency of war in the 432 years between 1500 and 1931 is shown below:
|Number of Wars Initiated in the Year||Observed Frequency (oi)|
(Source: Richardson, 1944).
We want to compare the observed distribution to what would be expected under a random (Poisson) distribution. We calculate the
distribution under the Poisson model (see any standard statistics test for information about how to fit a Poisson distribution) and find
the following expected frequencies:
|Number of Wars Initiated in the Year||Expected Frequency (ei)|
The expected frequency appears to parallel the observed distribution well. We want to test the fit of the model. This is accomplished by comparing the observed distribution to a multinomial trial in which there are n identical independent trials, with the outcome of each trial falling into one of k categories. The probabilities associated with the k categories, denoted p1, p2, ..., pk, are assumed to remain constant from trial to trial, and the sum of the probabilities is 1. A goodness-of-fit test can now be used to evaluate whether the difference between the observed frequencies (oi) and the expected frequencies (ei) can be explained by multinomial variability.
The null and alternative hypotheses are:
H0: pi are those predicted by the multinomial model
H1: at least one of the pis does not suit the model
The fit can be tested with Pearson's chi-square statistic:
c2stat = S [(oi - ei)2 / ei]
where oi represents observed frequencies and ei represents expected frequencies. The chi-square statistic for the illustrative example = [(223 - 216.69)2 / 216.69 + (142 - 149.52)2 / 149.52 + (48 - 51.58)2 / 51.58 + (15 - 11.88)2 / 11.88 + (4 - 2.38)2 / 2.38] = 2.73.
The test is right-tailed with k - 1 degrees of freedom (where k represents the number of categories). The illustrative example has 5 - 1 = 4 degrees of freedom. Epi Info will perform this goodness-of-fit test by clicking Programs > EpiTable > Compare > Proportions > Goodness of Fit.
Class Observed Expected
Nº1 223 216.6900
Nº2 142 149.5200
Nº3 48 51.5800
Nº4 15 11.8800
Nº5 4 2.3800
10.0 % of expected value < 5
Degrees of freedom 4
Since the observed frequencies closely parallel the expected frequencies, and the goodness of fit test derives p = .60, H0 will be retained. Wars appear to be randomly distributed over time.
(1) PRUSSIAN: Fatal Horse Kicks in the Prussian Army (Bortkiewicz, 1898). A famous historical application of the Poisson model investigated fatal horse kicks in the Prussian army corps in the years between 1875 and 1894. Ten army corps were observed for 20 years (n = 200). Data, along with expected probabilities and frequencies under the Poisson model, are shown in the table below. Determine whether these Poisson probabilities fit the data.
|No. of Fatalities (xi)||Observed Frequency (oi)||Poisson Probability (pi)||Expected Frequency (ei)|
(2) FEV.ZIP: Gender distribution is an adolescent sample (Rosner, 1990). The file FEV.REC contains data from a respiratory health survey in children and adolescents from East Boston, MA. One of its variables in this data set is SEX, coded 0 = female, 1 = male. Determine the frequency of boys and girls in the sample. If there were an equal number of boys and girls in the population from which the sample was drawn, how many boys would be expected in the sample? How many girls? Put this data along with the observe frequencies into an observed and expected frequency table, like the ones used in this chapter. Use a goodness-of-fit test to help determine whether there is an equal number of boys and girls in the study population.
Bortkiewicz, L von. (1898). Das Gesetz Der Kleinen Zahlen. Leipzig: Teubner.
Richardson, L. F. (1944). The Distribution of Wars in Time (in Miscellanea). Journal of the Royal Statistical Society, B., 107 (No. 3/4), 242-250.
Rosner, B. (1990). Fundamentals of Biostatistics (3rd ed.) Boston: PWS-Kent Publishing.