Chapter 26 Comparing Counts with Chi-squared tests

Chapter 26 Comparing Counts with Chi­squared tests
Chapter 26 - Comparing Counts
March 16, 2017
16 and 20 March
Today I will learn to use the Chi Squared distribution to do
hypothesis testing on qualitative data. By the end of class I will
be able to use the Chi-Squared Goodness of Fit, Test of
Homogeneity, and Test for Independence and will do this by
participating in a class exercise for each type followed by an
independent event. I will demonstrate my proficiency by
completing an exit ticket including all 3 types of tests with a
score of 90%.
one
t
h
AP Item No. IV-B-6
nig
Homework - p.628-633
#3,7,9,11/13,16,18,21,22,25,30
Chi-squared Model
- start at zero and positive only
- skewed to the right
- family of curves based on df (just like "t" family)
- mode (peak) is at df-2
- expected value (mean) is at df
- find area under the curve using
1
Chapter 26 Comparing Counts with Chi­squared tests
March 16, 2017
Goodness of Fit Test
- compares the distribution of observed outcomes for a single
categorical variable to the expected outcomes predicted by a
probability model to see if the model is viable.
Preconditions
- random sample
- independence
- less than 10% of population
- data must be "counts" of qualitative variables
- model should "expect" a count of at least 5 in each cell
-minor deviations allowed with comment
Hypothesis (written in English rather than symbolic)
Ho: the expected "model" is correct
Ha: the expected "model" is not correct
Test Statistic:
Degrees of Freedom - number of cells minus one
Example: Denbigh is supposed to be 50% black, 30% white and 20%
"other". You take a sample of 100 students and find you have 56 blacks
students, 27 white students and 17 "other" students. Does this make you
doubt the 50/30/20 model? Use a level of confidence of .95 (
)
Race Observed Expected
2
Chapter 26 Comparing Counts with Chi­squared tests
March 16, 2017
You Do: M&M Mars advertises that the ratio of colors in a
standard bag of M&Ms is 13% brown, 14% yellow, 13% red, 24%
blue, 20% orange, and 16% green. Use the bag of M&Ms to
determine if there is a reason to doubt these numbers.
Exit Ticket -
3
Chapter 26 Comparing Counts with Chi­squared tests
March 16, 2017
Chi-squared test of homogeneity (same-ness)
- used to determine if two (or more) groups are drawn from populations
that have the same distribution model
Preconditions - the same as before with the following exceptions:
- don't need a random sample if we are looking at specific groups (but
can't extend our findings to a larger population)
Hypothesis
Ho: the distributions are the same (put in context)
Ha: the distributions are not the same (in context)
Computation:
- Combine all your data on a contingency table
- Determine "expected" values by combining all groups and working out
proportions for the whole set then work back to counts.
- test statistic is computed the same way, combining all cells
Degrees of Freedom - (rows-1)x(columns-1)
Example - We want to compare our Denbigh Sample with a sample
from Woodside to see if the same racial make-ups are different.
A sample of students from WHS produced 89 black students, 77
white students, and 34 "other" students.
Denbigh
Woodside Total
Black
54
89
143
White
31
77
108
Other
15
34
49
Total
100
200
300
4
Chapter 26 Comparing Counts with Chi­squared tests
March 16, 2017
You Do: Over the years, have Denbigh students' post-high
school plans changed? The following table shows what happened
to 3 graduating classes. Can they be considered different?
Disclaimer ­ these are not the actual numbers!
1990
2000
2010
Totals
College
320
245
288
853
Job
98
24
17
139
Military 18
19
5
42
Nothing 17
2
5
24
Totals
290
315
1058
453
Calculator - how can I use the calculator to make my life easier?
Very carefully!
5
Chapter 26 Comparing Counts with Chi­squared tests
March 16, 2017
If we reject the null hypothesis then we want to determine what
has in fact changed. (Don't do this if you fail to reject!)
Find the standardized residuals for each cell and place on
contingency table.
1990
2000
2010
Totals
College
320
245
288
853
Job
98
24
17
139
Military 18
19
5
42
Nothing 17
2
5
24
Totals
290
315
1058
453
cell residual =
6
Chapter 26 Comparing Counts with Chi­squared tests
March 16, 2017
Chi-Squared Test for Independence - cross-categorizes one group
on two variables to see if there is an association between them.
Pre-conditions
- Independent and random Sample
- Count-type data
- Expect at least 5 per cell
Hypothesis:
Ho: the variables are independent
Ha: the variables are dependent
Computation and degrees of freedom - same as previous test
Are eye color and handedness independent of each other? We
sampled 114 people at random and got the following results
Eye
color
Left
Right
Total
Handed Handed
Brown
6
36
42
Blue
7
26
33
Green
2
21
23
Other
4
12
16
Total
19
95
114
7
Chapter 26 Comparing Counts with Chi­squared tests
March 16, 2017
TI-84 Matrix Method for Chi-Squared Tests
8