# z-test of proportions vs chi-squared

A 2-sample z-test of proportions and a chi-squared test can both be used to analyze a $$2\times 2$$ contingency table. In fact, for $$2\times 2$$, $$\chi^2=z^2$$. Why can the same table, being used with two interchangeable tests, only meet the conditions, i.e., expected $$>5$$, for one test and not the other, i.e., $$np>5$$?

For example: $$\begin{array}{rcc} &X &Y \\ A &32 &3 \\ B &3 &65 \\ \end{array}$$

• You have quoted only one half of the second test: it is that both $np$ and $n(1-p)$ ought to equal or exceed $5$ in both groups. Note that this is a rule of thumb, not an absolute requirement, applied to help determine when the chi-squared distribution may return a reliable p-value. Your example is a little mysterious, because (assuming the null hypothesis is independence), all cell expectations are well above $5.$ – whuber Oct 9 '18 at 18:43
• @whuber Yes. But np and nq are not both greater than 5 for both groups. – user223085 Oct 9 '18 at 19:52
• They are all greater than 5 under the null hypothesis, which is what you must use for computing those estimates. If one proceeded as you have, then in extreme cases like this one, where many cells have small expectations under the alternate hypothesis, the very fact that it is extreme makes it obvious there's an effect. It wouldn't make sense to claim the effect cannot be detected because it is so obvious! – whuber Oct 9 '18 at 20:08