Suppose I have random variables
$$
W\_i = \begin{cases} w\_1 &\text{with prob. } p\_1, \\ w\_2 &\text{with prob. } p\_2, \\ w &\text{with prob. } 1-p\_1-p\_2,\end{cases} \qquad i = 1, \dots, 2n+1.
$$
The values $w\_1, w\_2$ and $w$ are distinct.
I am interested whether the ordered pair $(w\_1,w\_2)$ occurs unusually often.
Specifically, I would like to test whether
$$
P(W\_i = w\_1, W\_{i+1} = w\_2) = P(W\_i = w\_1) P(W\_{i+1} = w\_2) \quad \text{ for all } i = 1, \dots, 2n.
$$
**Edit:** The null hypothesis is that the $W\_i$ are independent.


My approach is to define the random variables 
$$
X\_i = \begin{cases} 1 &\text{if } W\_i = w\_1 \text{ and } W\_{i+1} = w\_2, \\ 0 &\text{otherwise,} \end{cases} \quad i = 1, \dots, 2n.
$$
Let $p = p\_1 p\_2 = P(W\_i = w\_1) P(W\_{i+1} = w\_2).$ Then (under the null hypothesis) $E[X\_i] = p$ and $\text{Var}(X\_i) = p(1-p).$ 
With $\overline{X} = \frac1{2n} \sum\_{i=1}^{2n} X\_i,$ I can define my $t$-statistic
$$
T = \sqrt{2n} \frac{\overline{X}-p}{\sqrt{p(1-p)}}.
$$
But is it indeed true that $T \xrightarrow{d} \mathcal{N}(0,1)$?
Possibly not! 
To see this, suppose that $X\_i = 1.$ Then $W\_{i+1} = w\_2 \neq w\_1$, which implies $X\_{i+1} = 0.$ Hence neighboring $X\_i$ are not independent, and the (standard) central limit theorem is inapplicable.


**Is it still possible to determine the approximate distribution of $T$?**




---


I had the following idea: Define $\overline{X}\_1 = \frac1n \sum\_{i=1}^{2n} X\_{2i-1}$ and $\overline{X}\_2 = \frac1n \sum\_{i=1}^{2n} X\_{2i}.$
These sums do not contain neighboring random variables, hence the $t$-statistics
$$
T\_1 = \sqrt{n} \frac{\overline{X}\_1 - p}{\sqrt{p(1-p)}} \quad \text{ and } \quad T\_2 = \sqrt{n} \frac{\overline{X}\_2 - p}{\sqrt{p(1-p)}}
$$
satisfy $T\_1, T\_2 \xrightarrow{d} \mathcal{N}(0,1).$ Furthermore, $T = (T\_1 + T\_2) / \sqrt{2}.$


By the arguments above, $P(X\_i = X\_{i+1} = 1) = 0,$ hence
$$
\text{Cov}(X\_i, X\_{i+1}) = E[X\_i X\_{i+1}] - p^2 = - p^2.
$$
Similarly, $\text{Cov}(X\_i, X\_{i-1}) = -p^2.$ All other covariances are zero.
Since every $X\_i$ has two neighbors, except for $X\_1$ and $X\_{2n}$,
$$
\text{Cov}\Big(\frac{T\_1}{\sqrt{2}},\frac{T\_2}{\sqrt{2}}\Big) = \frac1{2np(1-p)} \sum\_{i,j=1}^{2n} \text{Cov}(X\_{2i-1},X\_{2j}) = - \frac{(2n-2)p^2}{2np(1-p)} = - \frac{(n-1)p}{n(1-p)}.
$$


I now thought of the [following result](https://en.wikipedia.org/wiki/Sum_of_normally_distributed_random_variables#Correlated_random_variables): If $A,B \sim \mathcal{N}(0,1),$ then $(A+B)/\sqrt{2} \sim \mathcal{N}(0,1+\rho\_{A,B}),$ where $\rho\_{A,B}$ is the correlation coefficient of $A$ and $B$.


Hence my question:


**Is the distribution of $T / \sqrt{1-\frac{(n-1)p}{n(1-p)}}$ approximately standard normal?**



A $t$-test for ordered pairs
The distribution of $T$ is indeed asymptotically normal, by virtue of any one of the many central theorems for stationary weakly dependent (here, even $2$-independent) random variables (r.v.'s). See e.g. Theorem 0 in [Bradley](http://www.sciencedirect.com/science/article/pii/0047259X81901287/pdf?md5=79d9e376f3e4842f970ebbbdcbeecffe&pid=1-s2.0-0047259X81901287-main.pdf) (due to Ibragimov), the conditions of which are easily verified in your case. 


An idea of how to get such results goes back to Bernstein and is as follows: Partition the sequence of weakly dependent r.v.'s into an alternating sequence of longer and shorter blocks, such that each long block is followed a short one, but the long blocks are still much shorter than the number (say $n$, $n\to\infty$) of the weakly dependent r.v.'s, so that the number of the long blocks is growing to infinity with $n$. Then the contribution of the short blocks will be comparatively small, whereas the long blocks will be nearly independent. In your case, you can take the short blocks just of length $1$, and then the long blocks, of length much greater than $1$ but much less than $n$, will be exactly independent. 


