OVERVIEW: Sometimes one wants tocompare proportions from two or more groups. One can use thechi-square test to do this. Basically, the null hypothesis statesthat all the population proportions are equal. The alternatehypothesis is that they are not, which means that there appears to bea significant difference between at least two of the populationproportions.
If the null hypothesis is true, the expected countfor a cell in a two-way table is
expected count
= (row total)(column total) /(table total). The x2
statistic is x
2 = sum[(observed count -expected count)2/(expected count)]. The degrees offreedom is (number of rows - 1)(number ofcolumns - 1).
You can use x2
when all expected cell counts are at least 1, and no morethan 20% are less than 5.
Example:
The table displays the number of students passedand failed by each of three instructors who teach IntroductoryStatistics at a specific university.
| Instructor #1 | Instructor #2 | Instructor #3 | TOTALS |
Passed | | | | |
Failed | | | | |
TOTALS | | | | |
Suppose we wish to examine the null hypothesis,H0, that theproportions of students failed by the three instructors are the same.The expected frequencies under H
46.75 = (55)(153)/ 180.
Note also that all expected counts are more than5, and that degrees of freedom = (2-1)(3-1) = 2.
| Instructor #1 | Instructor #2 | Instructor #3 | TOTALS |
Passed | 5046.75 | 4751.85 | 5654.40 | |
Failed | 58.25 | 149.15 | 89.60 | |
TOTALS | 55 | 61 | 64 | |
The calculation of x2
x2 = (50-46.75)2/46.75 +(47-51.85)2/51.85 + (56-54.40)2/54.40 +(5-8.25)2/8.25 + (14-9.15)2/9.15 +(8-9.60)2/9.60 = 4.84
Using the x2
Using the TI-83 to calculate a P-value, we havex
On page 735, the authors note that the chi-squaretest and the z-test "agree" when you have a 2-by-2 table situation.In this situation, the chi-square statistic is the square of thez-statistic, and the P-value for x2
| Gemifibozoil | Placebo | TOTALS |
Heart attack | 5670.36 | 8469.64 | |
No heart attack | 19951980.64 | 19461960.36 | |
TOTALS | 2051 | 2030 | |
On page 685, the calculated z-statistics is shownto be z = -2.47.
The calculated x2
x2 = (56-70.36)2/70.36 +(84-69.64)2/69.64 + (1995-1980.64)2/1980.64 +(1946-1960.36)2/1960.36 = 6.101.
Note that (-2.47)
The degrees of freedom here is (2-1)(2-1) = 1. TheP-value for x2
On page 685, the authors give a 1-sided P-value(for the z-statistic) of .0068. Note that 2(.0068) = .0136, or about1.36%, further illustrating what the authors are saying in theircomparison of x2