2
$\begingroup$

In my stats class, we are talking about the 2 proportion $Z$-test, which compares two sample proportions. The test statistic is given as: $$ Z = \frac{\hat{p_1}-\hat{p_2}}{\sqrt{\hat{p_c}(1-\hat{p_c})\left(\frac{1}{n_1}+\frac{1}{n_2}\right)}} $$

My question is, is there a good way to visualize this operation?

I can understand what the 1 proportion $Z$ interval does, since it basically just standardizes the sample proportion distribution, but I struggle to understand what is going on here. It seems at first glance to have subtracted the two distributions of sample proportions, but on second thought probably isn't the case.

(The visualization could be similar to the diagram for visualizing type I & II errors and power shown below.)

enter image description here

$\endgroup$
2
  • $\begingroup$ If you need more understanding of the test, please look in stats.stackexchange.com/a/173483/3277. The z-test is equivalent to the chi-square test of independence of the 2x2 table. $\endgroup$
    – ttnphns
    Mar 8, 2023 at 10:43
  • $\begingroup$ The "Z" is the number of SDs from the mean you are from the H0 dist'n. On its own doesn't tell you much. If you decide to do a test, you set $\alpha$ - an acceptable proportion of times you would err and declare the null to be false. The crit-val is the boundry that puts $\alpha$ in the tail of the H0 dist-n. H1 is the "truth" which you don't know of course but can guess at. The $\hat{p}$s tend toward normals d/t the CLT. $\endgroup$
    – AdamO
    Mar 9, 2023 at 19:52

1 Answer 1

0
$\begingroup$

If you understand how the 2 sample $t$-test works, the 2 sample $z$-test works the same way. We generally cover this material in introductory stats classes ('stats 101') by starting with the 1 sample $z$-test, where the population SD is known a-priori, and then move to the 1 sample $t$-test, where the SD is estimated from the data, and then to the 2 sample $t$-test, because that's usually the easiest way to learn the ideas. It's also possible to have a 2 sample $z$-test, if the population SD is known a-priori, but since we never really know the population SD a-priori, this is skipped and we just talk about the 1 sample test as part of a series of stepping stones to get people to the point where they can understand the 2 sample $t$-test.

With binomial data (number of heads out of a known total number of coin flips), the SD is a function of the proportion. What that implies is that if you can assume the normal approximation of the binomial sampling distribution holds (by somewhat arbitrary convention, people say this is OK so long as there are at least $5$ of the less commonly occurring outcome), then testing proportions means you can use the $z$-test. But really, the underlying ideas and machinery are the same as for the 2 sample $t$-test.

Regarding the jump from a 1 sample test to a 2 sample test, the extra complexity is that you now have two numbers. So which should you use? The insight is that you get back to a single number via the magic of subtraction. By subtracting the mean of group 2 from the mean of group 1, or subtracting the proportion in group 2 from the proportion in group 1, you get a single number: the mean difference, or the difference in proportions. You can then test that proportion by figuring out the sampling distribution of that difference. To do so, you need to assume a distributional form (e.g., the $t$-distribution, or the normal [i.e., $z$] distribution), and you need to calculate the standard error. So the denominator of the formula you were given for the test statistic is the calculation that gets you the standard error. Moreover, you are assuming a normal distribution for the sampling distribution. And that's it, you're done. As I said, if you understand the 2 sample $t$-test, this is really the same.

Regarding a figure, you can use the one you already have. That shows a normal distribution for the sampling distribution of the difference under the null, and another normal distribution, shifted some amount to the side, for the sampling distribution of the difference under some possible alternative hypothesis. The shaded regions would work the same way.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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