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?
 A: 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.
