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 x^{2 }
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 x^{2 }
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,H_{0}, that theproportions of students failed by the three instructors are the same.The expected frequencies under H_{0} are displayed in the lowerright of each observed count cell. Remember that expected count =(row total)(column total)/
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 | 50_{46.75} | 47_{51.85} | 56_{54.40} | |
Failed | 5_{8.25} | 14_{9.15} | 8_{9.60} | |
TOTALS | 55 | 61 | 64 | |
The calculation of x^{2 }
x^{2} = (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 x^{2 }
Using the TI-83 to calculate a P-value, we havex^{2 }cdf(
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 x^{2 }
| Gemifibozoil | Placebo | TOTALS |
Heart attack | 56_{70.36} | 84_{69.64} | |
No heart attack | 1995_{1980.64} | 1946_{1960.36} | |
TOTALS | 2051 | 2030 | |
On page 685, the calculated z-statistics is shownto be z = -2.47.
The calculated x^{2 }
x^{2} = (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)^{2} = 6.101, illustrating that,in this situation, x^{2 }
The degrees of freedom here is (2-1)(2-1) = 1. TheP-value for x^{2 }
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 x^{2 }