Math 37 - Lecture 29
Inference for Two-Way Tables (Ch. 9)
One-way Table: Goodness of Fit Tests (M&Ms)
Two-way Tables
Goals: 1) Comparing several population proportions
2) Testing for association between two categorical variables
1) COMPARING PROPORTIONS FOR SEVERAL POPULATIONS
Example 3x2 Two Way Table:
|
|
Child Smokes |
Child does not |
|
|
Both Parents smoke |
400 |
1380 |
1780 |
|
One Parent |
416 |
1823 |
2239 |
|
Neither Parent |
188 |
1168 |
1356 |
1004 4371 | 5375
What percent of students smoke?
Does this vary among the 3 groups of parental smoking?
How test if the proportions in the three groups are significantly different?
Graphical - Bar Plot Numerical - Conditional percents
Inference - Could do three separate two-sample hypothesis tests
Problem:
Want an overall test
H0: Ha:
One-sided or two-sided?
If Ho is true, how many counts would you expect to be in each cell?
Expect about of the children in each group to smoke if the three groups are equal/no difference among them.
|
|
Observed |
|
Expected |
||
|
|
Smoke |
No smoke |
|
Smoke |
No smoke |
|
Both |
400 |
1380 |
Both |
|
|
|
One |
416 |
1823 |
One |
|
|
|
Neither |
188 |
1168 |
Neither |
|
|
Test Statistic Want to compare the observed cell counts to the expected cell counts. If the differences are large, consider that evidence against the null hypothesis.
p-value How often would we expect to find a value of the test statistic this extreme or more extreme?
How does this test statistic behave?
Checking the validity of using the chi-square procedure
For a 2x2 table: Procedure is valid if all 4 expected cell counts
5
More than 2x2: Procedure is valid if the average of the expected counts
5 and the smallest count
1
2) TESTING FOR RELATIONSHIPS
Example Are smoking habits related to Social Economic Status (SES)?
|
|
SES |
|||
|
Smoking |
High |
Mid |
Low |
Total |
|
Current |
51 |
22 |
43 |
116 |
|
Former |
92 |
21 |
28 |
141 |
|
Never |
68 |
9 |
22 |
99 |
|
Total |
211 |
52 |
93 |
356 |
Same idea! Compare the observed counts to expected counts =
(row total*column total/n), see if the differences are large.
H0: Ha:
In general, use chi-squares tests when
1) Independent SRSs from several populations with each individual classified according to one categorical variable (other variable indicates which group the subject comes from)
2) A single SRS or one population with each individual classified according to both of two categorical variables. Are the categorical variables independent?
Note: When comparing only two proportions can use either a Chi-Square test or a two-sample z-test.