Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Lesson 25
Section 3.3
The Goodness of Fit Test
1
Goodness of Fit Test
Suppose that you want to determine whether
observed sample frequencies differ significantly
from expected frequencies specified in the null
hypothesis.
This test can be addressed using the chi-square
goodness of fit test.
2
The Hypotheses
In the goodness of fit test, the counts in each bin of
the observed data are compared to the counts in
each bin some expected distribution. That is,
H0: The data is behaving according to the
expected distribution.
HA: The data is not behaving according to the
expected distribution.
3
The Hypotheses
In statistical notation, the hypotheses are
H0 : pcategory 1 p1
pcategory 2 p2
pcategory k pk
5
Example 1
A bag of Hershey's Miniatures was opened and the
number of each candy was counted. If there were
132 candies total, then how many of each of the
four candies should you expect if each candy was
equally likely?
Brand Observed Expected
Krackel 33
Mr. Goodbar 32
Milk Chocolate 37
Dark Chocolate 30
Total 132 132 6
Chi-Square Test for One-Way Table
7
Chi-Square Test for One-Way Table
O1 E1 O2 E2 Ok Ek
2 2 2
2
E1 E2 Ek
8
Example 2
Calculate the chi-square test statistic.
10
Chi-Square Test for One-Way Table
The p-value for this test statistic can be found with the
2cdf command to find the area of the upper tail of this
chi-square distribution. We consider the upper tail
because larger values of 2 would provide greater
evidence against the null hypothesis.
p-value 2cdf 2 -test statistic, BIG, df
df stands for the degrees of freedom and, for this
test, is the number of groups minus one: df = k 1.
11
Example 3
a) State the hypotheses for testing if the four
candies are uniformly distributed in the bag.
b) Check the conditions and calculate p-value.
Based on the p-value, what is your conclusion?
13
Example 4 continued
a) State the hypotheses for testing if the
professor's predictions were inaccurate.
b) How many students did the professor expect to
buy the book, print the book, and read the book
exclusively online?
Observed Expected
purchase a hard copy 71
print it out 30
read it online 25
Total 126
14
Example 4 continued
c) This is an appropriate setting for a chi-square
test. List the conditions required for a test and
verify they are satisfied.
d) Calculate the chi-squared statistic, the degrees
of freedom associated with it, and the p-value.
Observed Expected
purchase a hard copy 71 75.6
print it out 30 31.5
read it online 25 18.9
Total 126 126
15
Example 4 continued
e) Based on the p-value calculated in part (d),
what is the conclusion of the hypothesis test?
Interpret your conclusion in this context.
Observed Expected
purchase a hard copy 71
print it out 30
read it online 25
Total 126
16
Example 5
Absenteeism of college students from math classes is
a major concern to math instructors because missing
class appears to increase the drop rate. Three
statistics instructors wondered whether the absentee
rate was the same for every day of the school week.