I've got the problem with Z-test and confidence intervals. Z-test rejects null hipothesis (proportions are equal), but confidence intervals are intersect.

Let us consider 2 companies. The proportion of smokers in company A is p(A)=0.22. And the proportion of smokers in company B is p(B)=0.303. The amount of employees in company A is 403. And the amount of employees in company B is 404.

So, we have the folowing data:



Now let's apply the Z-test by the following forumula for proportions (I've took the formula from https://onlinecourses.science.psu.edu/stat414/node/268):

$$Z= \frac{p(B)-p(A)}{\sqrt{p(1-p)(\frac{1}{n(A)}+\frac{1}{n(b)})}}$$

Where p is $$p=\frac{p(A)n(A)+p(B)n(B)}{n(A)+n(B)}$$

I've made the following computation: $$p=\frac{0.22*403+0.303*404}{403+404}=0.2614$$

$$z= \frac{0.303-0.22}{\sqrt{0.2614(1-0.2614)(\frac{1}{403}+\frac{1}{404})}}=2.6828$$

So, z more than 1.96, it means that we reject the null hipothesis. The proportions p(A) and p(B) are not equal.

But then I've computed the 5% confidence intervals by the following formulas (I've took them form https://onlinecourses.science.psu.edu/stat200/node/48):

$$low=P-1.96 \sqrt{\frac{P*(1-P)}{N}}$$ $$high=P+1.96 \sqrt{\frac{P*(1-P)}{N}}$$ Where P is proportion of smokers in some company and N is amount of employees in this company.

I've computed the interval for company A: $$\text{low}(A)=p(A)-1.96 \sqrt{{p(A)(1-p(A))}{n(A)}}=0.22-1.96\sqrt{\frac{0.22\cdot 0.78}{403}}=0.1796$$ $$\text{high}(A)=p(A)+1.96 \cdot\sqrt{{p(A)(1-p(A))}{n(A)}}=0.22+1.96 \sqrt{\frac{0.22\cdot0.78}{403}}=0.2604$$ So, for $p(A)$ the CI is $(0.1796;0.2696)$.

And finally I've computed the interval for the company B: $$low(B)=p(B)-1.96*\sqrt{{p(B)(1-p(B))}{n(B)}} =0.303-1.96*sqrt{\frac{0.303*0.697}{404}}=0.2581$$ $$high(B)=p(B)+1.96*\sqrt{{p(B)(1-p(B))}{n(B)}} =0.303+1.96*sqrt{\frac{0.303*0.697}{404}}=0.3477$$ For p(B) the confidence interval is (0.2581;0.3477).

And now we see that confidence intervals are intersect, but it contradicts the computations for z-test.

Finally I've used a web service for z-test and CI computing. The service drawed intersection of CI's and rejected the null hipothesis of z-test too.

Please, could you explain me what the cause of the contradiction?


Compute a confidence interval for the difference of the two true proportions and you will see that it does not contain 0. That is a more accurate way to assess whether the two proportions are the same.

That said, such apparent contradictions may occasionally occur because the z-test for differences of proportions is based on the hypothesized null distribution, but confidence intervals are computed from the actual data.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.