BPS - 5th Ed.
Chapter 22
Two Categorical Variables:
The Chi-Square Test
Chapter 22 1
Chi-Square Goodness of Fit Test
X A variation of the Chi-square statistic can be used to test a different kind of null hypothesis: that a single categorical variable has a specific distribution
X The null hypothesis specifies the probabilities
( p i
) of each of the k possible outcomes of the categorical variable
X The chi-square goodness of fit test compares the observed counts for each category with the expected counts under the null hypothesis
BPS - 5th Ed.
Chapter 22 2
Chi-Square Goodness of Fit Test
X H o
: p
1
= p
1o
, p
2
= p
2o
, …, p k
= p ko
X H a
: proportions are not as specified in H o
X For a sample of n subjects, observe how many subjects fall in each category
X Calculate the expected number of subjects in each category under the null hypothesis: expected count = n
× p i for the i th category
BPS - 5th Ed.
Chapter 22 3
Chi-Square Goodness of Fit Test
X Calculate the chi-square statistic (same as in previous test):
X
2 = k
i
=
1
( observed count
− expected count expected count
)
2
X The degrees of freedom for this statistic are df = k
−
1 (the number of possible categories minus one)
X Find P -value using Table D
BPS - 5th Ed.
Chapter 22 4
Chi-Square Goodness of Fit Test
BPS - 5th Ed.
Chapter 22 5
Case Study
Births on Weekends?
National Center for Health Statistics, “Births: Final
Data for 1999,” National Vital Statistics Reports ,
Vol. 49, No. 1, 1994.
A random sample of 140 births from local records was collected to show that there are fewer births on Saturdays and
Sundays than there are on weekdays
BPS - 5th Ed.
Chapter 22 6
Case Study
Births on Weekends?
Data
Day Sun. Mon. Tue. Wed. Thu.
Fri.
Sat.
Births 13 23 24 20 27 18 15
Do these data give significant evidence that local births are not equally likely on all days of the week?
BPS - 5th Ed.
Chapter 22 7
Case Study
Births on Weekends?
Null Hypothesis
Day
Probability
Sun.
Mon.
Tue.
Wed.
Thu.
Fri.
Sat.
p
1 p
2 p
3 p
4 p
5 p
6 p
7
H o
: probabilities are the same on all days
H o
: p
1
= p
2
= p
3
= p
4
= p
5
= p
6
= p
7
=
1
7
BPS - 5th Ed.
Chapter 22 8
Case Study
Births on Weekends?
Expected Counts
Expected count = n
× p i
=140
×
(1/7) = for each category (day of the week)
20
Day
Observed births
Expected births
Sun. Mon. Tue. Wed. Thu.
Fri.
Sat.
13
20
23
20
24
20
20
20
27
20
18
20
15
20
BPS - 5th Ed.
Chapter 22 9
Case Study
Births on Weekends?
Chi-square statistic
X
2 =
= i
7
=
1
( observed count
⎡
⎢
(
13
−
20
) (
23
20
20
−
20
−
20
)
2
20
)
2
+ L +
(
15
−
20
)
2
⎤
⎥
20
=
2.45
+
0.45
+ L +
1.25
=
7.60
BPS - 5th Ed.
Chapter 22 10
Case Study
Births on Weekends?
P -value, Conclusion
X 2 = 7.60
df = k
−
1 = 7
−
1 = 6
P-value = Prob( X 2 > 7.60):
X 2 = 7.60 is smaller than smallest entry in df =6 row of Table D, so the P -value is > 0.25.
Conclusion: Fail to reject H o
– there is not significant evidence that births are not equally likely on all days of the week
BPS - 5th Ed.
Chapter 22 11
Example
Police may use minor violations such as not wearing a seat belt to stop motorists for other reasons. A large study in Michigan first studied the population of drivers not wearing seat belts during daylight hours by observation at more than 400 locations around the state. The researchers then looked at court records and called a random sample of 803 drivers who had actually been cited by police for not wearing a seat belt. Does the age distribution of people cited differ significantly from the distribution of ages of all seat belt violators?
BPS - 5th Ed.
Chapter 22 12