Professional Documents
Culture Documents
Chapter 9
Chapter 9
INTRODUCTION TO
STATISTICS & PROBABILITY
➢ Two-Way Tables
➢ Expected Cell Counts
➢ The Chi-Square Statistic
➢ The Chi-Square Distributions
➢ The Chi-Square Test
Objectives:
➢ Given a two-way table, test whether two categorical variables are
associated.
Association arises in two forms:
➢ Compare two or more populations to see if they have the same
distribution of a categorical variable.
➢ Examine two categorical variables of one population to see if they are
independent.
Testing for association of 2 categorical variables
➢ In Section 2.6 by looking at their joint distribution and conditional
distributions.
➢ Here we will perform formal hypothesis tests to determine whether two
categorical variables are associated.
Copyright© Nahid Sultana 2017-2018 1/21/2023
Expected Cell Counts
5
To test this hypothesis, we compare actual counts from the sample data
with expected counts, given the null hypothesis of no relationship.
The expected count in any cell of a two-way table when H0 is true is:
To see if the data give convincing evidence against the null hypothesis,
we compare the observed counts in a two-way table with the counts we
would expect if H0 were true.
The test statistic that makes the comparison is the chi-square statistic.
Expected
c =å 2
∑
(Observed - Expected)2 (30 - 34.22) 2 (39 - 30.56) 2
Expected
=
34.22
+
30.56
+ ...+
(35 - 39.06) 2
39.06
P
= 0.52 + 2.33 + ...+ 0.42 = 18.28
To find the P-value using a chi-square table Df .0025 .001
look in the df = (3-1)(3-1) = 4. 4 16.42 18.47
The small P-value (between 0.001 and 0.0025) gives us convincing evidence
to reject H0 and conclude that there is a difference in the distributions of
chocolate purchases at this store when no music, French music, or Italian music
is played.
Example: Smoking Habits
Student smokes Student doesn’t smoke Row total
14 Both parents smoke 400 1380 1780
One parent smokes 416 1823 2239
Neither parent smokes 188 1168 1356
Column total 1004 4371 5375
M&M milk chocolate candies. Here’s what the company’s Consumer Affairs
Department says about the color distribution of its M&M’S milk chocolate
candies:
On average, the new mix of colors of M&M’S milk chocolate candies will
contain 13 percent of each of browns and reds, 14 percent yellows, 16
percent greens, 20 percent oranges, and 24 percent blues.
➢ The one-way table below summarizes the data from a sample bag of
M&M’S milk chocolate candies. In general, one-way tables display the
distribution of a categorical variable for the individuals in a sample.
The value c 2 =10.180 falls between the critical values 9.24 and 11.07. The
Since our P-value
corresponding areasisinbetween
the right 0.05
tail ofand 0.10,
the chi it is greater
- square thanwith
distribution α= df 0.05.
=5
Therefore,
are 0.10 andwe fail to reject H . We don’t have sufficient evidence to
0.05.
0
conclude that the company’s claimed color distribution is incorrect.
So, the P - value for a test basedNahid
Copyright© on Sultana
our sample data is
2017-2018
22
between 0.05 and 0.10.
1/21/2023
Examples
23
In the table below, we examine the relationship between final grade and the
reported hours per week each student said they studied for the course.
The expected count of those who studied between 5 and 10 hours per week
and earned a B for the course is:
a. 4.672.
13 23
b. 4.266. = 4.671875
64
c. 8.265.
Copyright© Nahid Sultana 2017-2018 1/21/2023
Examples
24
A die is tossed 60 times and the number of dots appearing on the top
face are recorded in the table below.
Top Face 1 2 3 4 5 6
# of occurrences 8 12 13 9 11 7
a. 6
b. 7
c. 10 1/6 * 60
d. 11
Copyright© Nahid Sultana 2017-2018 1/21/2023
Examples
26
A die is tossed 60 times and the number of dots appearing on the top
face are recorded in the table below.
Top Face 1 2 3 4 5 6
# of occurrences 8 12 13 9 11 7
b. 6
c. 10 k -1= 6 -1= 5
d. 12
Copyright© Nahid Sultana 2017-2018 1/21/2023
Examples
27
A die is tossed 60 times and the number of dots appearing on the top
face are recorded in the table below.
Top Face 1 2 3 4 5 6
# of occurrences 8 12 13 9 11 7