You are on page 1of 26

Chapter 11

Chi-Square Tests

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 1


Objectives

In this chapter, you learn:


▪ How and when to use the chi-square test for
contingency tables

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 2


Contingency Tables
DCOVA

Contingency Tables
◼ Useful in situations comparing multiple
population proportions
◼ Used to classify sample observations according
to two or more characteristics
◼ Also called a cross-classification table.

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 3


Contingency Table Example
DCOVA

Left-Handed vs. Gender


Dominant Hand: Left vs. Right
Gender: Male vs. Female

▪ 2 categories for each variable, so


this is called a 2 x 2 table

▪ Suppose we examine a sample of


300 children

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 4


Contingency Table Example
(continued)
DCOVA
Sample results organized in a contingency table:

Hand Preference
sample size = n = 300:
Gender Left Right
120 Females, 12
were left handed Female 12 108 120
180 Males, 24 were
left handed Male 24 156 180

36 264 300

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 5


2 Test for the Difference Between
Two Proportions DCOVA

H0: π1 = π2 (Proportion of females who are left


handed is equal to the proportion of
males who are left handed)
H1: π1 ≠ π2 (The two proportions are not the same)

◼ If H0 is true, then the proportion of left-handed females should be


the same as the proportion of left-handed males
◼ The two proportions above should be the same as the proportion of
left-handed people overall

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 6


The Chi-Square Test Statistic
DCOVA
The Chi-square test statistic is:
( fo − fe )2
2
χ STAT = 
all cells
fe
◼ where:
fo = observed frequency in a particular cell
fe = expected frequency in a particular cell if H0 is true

2
χ STAT for the 2 x 2 case has 1 degree of freedom

(Assumed: each cell in the contingency table has expected


frequency of at least 5)

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 7


Decision Rule
DCOVA

2
The χ STAT test statistic approximately follows a chi-
squared distribution with one degree of freedom

Decision Rule:
χ 2
If STAT  χ 2
α , reject H0,
otherwise, do not reject 
H0
0
Do not Reject H0 2
reject H0
2α

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 8


Computing the
Overall Proportion
DCOVA

The overall X1 + X2 X
p= =
proportion is: n1 + n2 n

120 Females, 12 Here:


were left handed
12 + 24 36
180 Males, 24 were p= = = 0.12
left handed 120 + 180 300

i.e., based on all 300 children the proportion of left handers is 0.12,
that is, 12%

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 9


Finding Expected Frequencies
DCOVA

◼ To obtain the expected frequency for left handed


females, multiply the average proportion left handed (p)
by the total number of females
◼ To obtain the expected frequency for left handed males,
multiply the average proportion left handed (p) by the
total number of males

If the two proportions are equal, then


P(Left Handed | Female) = P(Left Handed | Male) = .12

i.e., we would expect (.12)(120) = 14.4 females to be left handed


(.12)(180) = 21.6 males to be left handed

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 10


Observed vs. Expected
Frequencies
DCOVA

Hand Preference
Gender Left Right
Observed = 12 Observed = 108
Female 120
Expected = 14.4 Expected = 105.6
Observed = 24 Observed = 156
Male 180
Expected = 21.6 Expected = 158.4

36 264 300

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 11


The Chi-Square Test Statistic
DCOVA
Hand Preference
Gender Left Right
Observed = 12 Observed = 108
Female 120
Expected = 14.4 Expected = 105.6
Observed = 24 Observed = 156
Male 180
Expected = 21.6 Expected = 158.4
36 264 300
The test statistic is:
(f o − f e ) 2
χ 2STAT = 
all cells
fe
(12 − 14.4) 2 (108 − 105.6) 2 (24 − 21.6) 2 (156 − 158.4) 2
= + + + = 0.7576
14.4 105.6 21.6 158.4

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 12


Decision Rule
DCOVA

2
The test statistic is χ STAT = 0.7576 ; χ 02.05 with 1 d.f. = 3.841

Decision Rule:
2
If χ STAT > 3.841, reject H0,
otherwise, do not reject H0

Here,
2 2
0.05 χ STAT = 0.7576< χ 0.05 = 3.841,
so we do not reject H0 and
0 conclude that there is not
Do not Reject H0 2 sufficient evidence that the two
reject H0
20.05 = 3.841 proportions are different at  =
0.05

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 13


2 Test for Differences Among
More Than Two Proportions
DCOVA

◼ Extend the 2 test to the case with more than


two independent populations:

H0: π1 = π2 = … = πc
H1: Not all of the πj are equal (j = 1, 2, …, c)

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 14


The Chi-Square Test Statistic
DCOVA
The Chi-square test statistic is:
( fo − fe )2
2
χ STAT = 
all cells
fe
◼ Where:
fo = observed frequency in a particular cell of the 2 x c table
fe = expected frequency in a particular cell if H0 is true

χ 2STAT for the 2 x c case has (2 - 1)(c - 1) = c - 1 degrees of freedom

(Assumed: each cell in the contingency table has expected


frequency of at least 1)

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 15


Computing the
Overall Proportion
DCOVA

The overall X1 + X2 +  + Xc X
p= =
proportion is: n1 + n2 +  + nc n

◼ Expected cell frequencies for the c categories


are calculated as in the 2 x 2 case, and the
decision rule is the same:
Where 2 is from the chi-
Decision Rule: squared distribution with
2
If χ STAT  χ α2 , reject H0, c – 1 degrees of freedom
otherwise, do not reject H0

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 16


2 Test of Independence
DCOVA

◼ Similar to the 2 test for equality of more than


two proportions, but extends the concept to
contingency tables with r rows and c columns

H0: The two categorical variables are independent


(i.e., there is no relationship between them)
H1: The two categorical variables are dependent
(i.e., there is a relationship between them)

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 17


2 Test of Independence
(continued)

The Chi-square test statistic is: DCOVA

( fo − fe )2
2
χ STAT = 
all cells
fe
◼ where:
fo = observed frequency in a particular cell of the r x c table
fe = expected frequency in a particular cell if H0 is true

χ 2STAT for the r x c case has (r - 1)(c - 1) degrees of freedom

(Assumed: each cell in the contingency table has expected


frequency of at least 1)

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 18


Expected Cell Frequencies
DCOVA

◼ Expected cell frequencies:

row total  column total


fe =
n

Where:
row total = sum of all frequencies in the row
column total = sum of all frequencies in the column
n = overall sample size

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 19


Decision Rule
DCOVA

◼ The decision rule is

2
If χ STAT  χ α2 , reject H0,

otherwise, do not reject H0

Where 2 is from the chi-square distribution with (r – 1)


(c – 1) degrees of freedom

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 20


Example
DCOVA

◼ The meal plan selected by 200 students is shown below:

Number of meals per week


Class
Standing 20/week 10/week none Total
Fresh. 24 32 14 70
Soph. 22 26 12 60
Junior 10 14 6 30
Senior 14 16 10 40
Total 70 88 42 200

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 21


Example DCOVA
(continued)

◼ The hypothesis to be tested is:

H0: Meal plan and class standing are independent


(i.e., there is no relationship between them)
H1: Meal plan and class standing are dependent
(i.e., there is a relationship between them)

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 22


Example:
Expected Cell Frequencies
(continued)
Observed: DCOVA
Number of meals
Class per week
Expected cell
Standing 20/wk 10/wk none Total
Fresh. 24 32 14 70
frequencies if H0 is true:
Soph. 22 26 12 60 Number of meals
Junior 10 14 6 30 Class per week
Senior 14 16 10 40 Standing 20/wk 10/wk none Total
Total 70 88 42 200 Fresh. 24.5 30.8 14.7 70
Soph. 21.0 26.4 12.6 60
Example for one cell:
row total  column total Junior 10.5 13.2 6.3 30
fe =
n Senior 14.0 17.6 8.4 40

30  70 Total 70 88 42 200
= = 10.5
200
Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 23
Example: The Test Statistic
(continued)
DCOVA
◼ The test statistic value is:

( f o − f e )2
2
χ STAT = 
all cells
fe
( 24 − 24.5 ) 2 ( 32 − 30.8 ) 2 ( 10 − 8.4 ) 2
= + ++ = 0.709
24.5 30.8 8 .4

2
0.05 = 12.592 from the chi-square distribution
with (4 – 1)(3 – 1) = 6 degrees of freedom

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 24


Example:
Decision and Interpretation DCOVA
(continued)

2
The test statistic is χ STAT = 0.709 ; χ 02.05 with 6 d.f. = 12.592

Decision Rule:
2
χ
If STAT > 12.592, reject H0,
otherwise, do not reject H0

0.05 Here,
2 2
χ STAT = 0.709 < χ 0.05 = 12.592,
so do not reject H0
0
Do not Reject H0 2 Conclusion: there is not
reject H0 sufficient evidence that meal
20.05=12.592 plan and class standing are
related at  = 0.05
Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 25
Chapter Summary

In this chapter we discussed:


▪ How and when to use the chi-square test for
contingency tables

Copyright © 2016 Pearson Education, Ltd. Chapter 11, Slide 26

You might also like