# Comparing two proportions asymptotic distribution

Let $X_1, \ldots, X_{n_X}$ and $Y_1, \ldots, Y_{n_Y}$ be $n_x$ and $n_Y$ iid observations from two independent Bernoulli populations with probabilities of success $p_X$ and $p_Y$. Define the statistics $T_X = \sum_{i=1}^{n_X}X_i$ and $T_Y = \sum_{i=1}^{n_Y}Y_i$. I am testing the hypothesis:

$$H_0 : p_X = p_Y \ \ \ \text{and} \ \ \ H_1 : p_X \neq p_Y$$

Consider the test statistic:

$$T = \dfrac{\hat{p}_X-\hat{p}_Y}{\sqrt{\hat{p}(1-\hat{p})\left(\frac{1}{n_X}+\frac{1}{n_Y}\right)}}$$

where $\hat{p}_X = \frac{T_X}{n_X}$ and $\hat{p}_Y = \frac{T_Y}{n_Y}$, and $\hat{p} = \frac{T_X+T_Y}{n_X+n_Y}$.

I would like to derive the asymptotic distribution of $T$ under $H_0$ as both $n_X$ and $n_Y$ go to infinity that is that under the null: $$T = \dfrac{\hat{p}_X-\hat{p}_Y}{\sqrt{\hat{p}(1-\hat{p})\left(\frac{1}{n_X}+\frac{1}{n_Y}\right)}} \to_D N(0,1)$$

Now this question has been asked before see: How to derive the asymptotic distribution of the test statistic of a large sample test for equality of two binomial populations?

However the answer given there is wrong because it gives a justification based on the continuous mapping theorem. The continuous mapping theorem says that for random variables $X_n$ and $X$ such that $X_n$ converges in distribution to $X$ and if $g$ is a continuous function, then $g(X_n)$ converges in distribution to $g(X)$. However $g$ cannot be a function of $n$.

The function $\varphi$ used in the answer is itself dependent on $n_X$ and $n_Y$ and so the continuous mapping theorem doesn't apply.

In which case how do you find the asymptotic distribution?

• This question is identical to the one it's derived from. It then asserts, incorrectly, that the continuous mapping theorem does not apply. You likely have a different conception of that theorem than the one invoked in the existing answer. If you would like to ask explicitly about that, then please edit your post to include a statement of the continuous mapping theorem you are thinking of, as well as an argument concerning why you think it does not apply. – whuber Jul 27 '17 at 14:50
• @whuber Hi sorry for the identical question I wasn't sure exactly how to ask it, I'll try and rephrase it in a different question. However the function involved is $\varphi$ which is dependent on $n_X$ and $n_Y$. The continous mapping theorem: see en.wikipedia.org/wiki/Continuous_mapping_theorem for instance is about g(X_n) converging in distribution to g(X) for some rv X and some cts function g and requires that $g$ not be dependent on $n$. So I don't understand why you say I have a different conception of the CMT, perhaps you could point me towards your version of the CMT? – Sam Davenport Jul 27 '17 at 15:38
• I see what you mean. The answer in the duplicate has a logical gap because of that dependence, unless it is implicitly invoking a more powerful version of the CMT than quoted in Wikipedia. Ordinarily we would try to hash this out in comments to the original answer, but the nature of this argument is such that it might be more helpful to address this specific issue in a new thread, so I will correct my error and reopen your question. – whuber Jul 27 '17 at 15:50
• @whuber, okay thanks. Should I edit my question to make things clearer in any way or leave it as it is? – Sam Davenport Jul 27 '17 at 15:54
• I appreciate your offer to clarify. Because your comment helped me appreciate what you are asking, I suspect that including some version of that comment within your question might help other readers, too. – whuber Jul 27 '17 at 15:55

Thanks for pointing out the earlier, crucial (and pretty bad) mistake. Hopefully the following answer is more or less correct...

Suppose, for the moment, that $n_Y = \lceil c n_X \rceil$, for some $c > 0$.

Define $$\theta_X = \frac {\hat p_X - p} { \sqrt{ \left(\frac 1 {n_X} + \frac 1 {n_Y}\right) p(1-p)}} \quad \mbox{and} \quad \theta_Y = \frac {\hat p_Y - p} { \sqrt{ \left(\frac 1 {n_X} + \frac 1 {n_Y}\right) p(1-p)}},$$ so that $$T = \sqrt{\frac{p(1-p)}{\hat p(1 - \hat p)}} (\theta_X - \theta_Y).$$

Now $\theta_X$ converges in distribution to $N\left(0,\frac c {1+c} \right)$, whereas $\theta_Y$ converges in distribution to $N\left(0, \frac 1 {1 + c} \right)$, and jointly they converge to the independent product of these two distributions.

It follows that $\theta_X - \theta_Y$ converges (using the continuous mapping theorem, hopefully correctly this time) to a $N(0,1)$ distribution. Since $\hat p(1-\hat p) \rightarrow p(1-p)$ almost surely, it follows that $T \stackrel{d}{\rightarrow} N(0,1)$.

In a similar way, when e.g. $n_Y = n_X^2$ you can find that $\theta_X \stackrel{d}{\rightarrow} N(0,1)$ and $\theta_Y \stackrel{a.s.}{\rightarrow} 0$, so that again $T \stackrel{d}{\rightarrow} N(0,1)$.

Unfortunately I don't see how to avoid making some assumption on the relative growth of $n_X$ and $n_Y$, but perhaps a more general argument is possible.