The Chi-Square Test for Goodness of Fit

 

The test is designed to describe a single population. 

 

It can be used for experiments that have 2 or more outcomes, (Multinomial Experiment)

 

A Multinomial Experiment has the following characteristics:

1.      The experiment consists of a fixed number "n" of trials.

2.      The outcome of each trial can be classified into one of k categories, called cells.

3.      The probability pi that the outcome will fall into cell "i" remains constant for each trial and p1 + p2 + … + pk = 1

4.      Each trial of the experiment is independent of the other trials.

 

As a result of the experiment, we obtain a set of "observed frequencies", o1, o2, …, ok where oi is the observed frequency of outcomes falling into cell i, for i = 1, 2, …, k

 

Because the experiment consists of "n" trials and an outcome must fall into some cell:

o1 + o2 +…+ ok = n

 

Example:

A Lamar student bets on horses.  His current method of assessing probabilities and applying wagering strategy has not been successful (he usually loses).  To improve his winning percentage, he decides to learn whether some post positions are more favorable than others, so that horses starting in these positions win more frequently than horses starting in other positions.  If this is true, he will win more money.  He records the post positions of the winners of 300 randomly selected races.  These data are summarized in the table below.  Using a significance level of 5%, can the Lamar student conclude that some post positions win more frequently than others?

 

Post Position "i"

Observed Frequency "o"

1

44

2

65

3

42

4

60

5

46

6

43

Total

300

 

The parameters of interest are the probabilities p1, p2, …, p6 that post positions 1 to 6 are winning positions.  The probabilities p1, p2, …, p6 are equal to 1/6, thus

 

Ho: p1 = 1/6, p2 = 1/6, …, p6 = 1/6

 

HA: At least one pi is not equal to its specific value

The point of the experiment is to determine whether at least one post position wins more frequently than the others. 

 

Since n = 300, we expect each post position would win 300(1/6) = 50

 

In general, the expected frequency for each post position is given by:

Ei = npi

 

This expression is derived from the formula for the expected value of a binomial random variable:

E(X) = np

 

If the expected frequencies, ei, and the observed frequencies, oi, are quite different, we would conclude that the null hypothesis is false and we would reject it. 

 

If the expected and observed frequencies are similar, we would not reject the null hypothesis. 

 

The test statistic we employ to assess whether the differences between the expected and observed frequencies are large is:

 

 

The sampling distribution of the test statistic is approximately chi-squared distributed with k - 1 degrees of freedom, provided that the sample size is large. 

 

Calculation of the X2 statistic:

Post Position

 

i

Observed Frequency

oi

Expected Frequency

ei

(oi - ei)

(oi - ei)2/ei

1

44

50

-6

.72

12

65

50

15

4.50

3

42

50

-8

1.28

4

60

50

10

2.00

5

46

50

-4

.32

6

43

50

-7

.98

 

 

 

 

X2 = 9.80

 

 

 

 

 

 

Rejection region:

When the expected and observed values are very similar, the test statistic will be small.  Thus, a small X2 supports the null hypothesis. 

 

If some expected values are quite different from their respective observed values, the X2 will be large. 

 

We want to reject the null hypothesis in favor of the alternative hypothesis when X2 is greater than X2 a, k-1  Thus the rejection region is:

 

X2 > X2 a, k-1 

 

For our example:

k = 6

 

The rejection region is:

X2 > X2 a, k-1 = X2 .05, 5 = 11.0705  

 

We know that X2 = 9.80, thus we do not reject Ho. 

 

Show Figure 17.1

 

Thus the Lamar student cannot use the post position to predict a winning horse.

 

 

We may hypothesize a different value for each pi, as long as the sum of the probabilities is 1. 

 

The Goodness of Fit test can also be used to test how well data fit a hypothesized distribution.

 

 

Example:

Two companies, A and B, have recently conducted aggressive advertising campaigns in order to maintain and possibly increase their respective shares of the market for tennis balls.  These two companies enjoy a dominant position in the market.  Before the advertising campaign began, the market share of company A was 45%, while company B had 40% of the market.  Other competitors accounted for the remaining 15%.  To determine whether these market shares changed after the advertising campaigns, a marketing analyst solicited the preferences of a random sample of 200 customers of tennis balls.  Of the 200 customers, 102 indicated a preference for company A's product, 82 preferred company B's product, and the remaining 16 preferred the products of one of the competitors.  Can the analyst infer at a 5% significance level that customer preferences have changed from the levels they were at before the advertising campaign began?

 

The objective of the problem is to describe the population of tennis ball customers.  Because we want to know if the market shares have changed, we specify those pre-campaign market shares in the null hypothesis. 

 

Ho: p1 = .45, p2 = .40, p3 = .15

 

HA: At least one pi is not equal to its specified value

This HA answers the question "have the proportions changed?"

 

Test Statistic:

 

 

Rejection region:

 

X2 > X2 a, k-1 = X2 .05, 2 = 5.99147

 

The expected values are as follows:

e1 = np1 = 200(.45) = 90

 

e2 = np2 = 200(.40) = 80

 

e3 = np3 = 200(.15) = 30

 

The value of the test statistic is:

 

 

8.18 > 5.99

Conclusion: Reject the null hypothesis

 

Rule of Five

The test statistic used for goodness of fit has an approximate chi-square distribution.  The actual distribution of this test statistic is discrete, but is approximated by a continuous chi-square distribution when the sample size is large.  When the sample size is small, this approximation is poor. 

 

The Rule of Five requires that the expected frequency for each cell must be at least 5.  Where necessary, cells should be combined in order to satisfy this condition.