# compute likelihood statistic with permutation test

This question is about hypothesis testing, where we want to use the likelihood ratio statistic with permutations test.

Suppose we sample $$n$$ observations from the distribution $$F_{XY}$$, which is the uniform over the triangle defined by (0,0), (0,1), and (1,0) to get $$S=\{(x_1,y_1),\ldots,(x_n,y_n)\}$$. Note that $$X$$ and $$Y$$ are the regular Cartesian axes. Then we know that $$f_{XY}(x,y)=1/\text{area of triangle}=2$$ if $$(x,y)$$ is within our triangle. Let $$H_1$$ be the hypotehsis that $$S$$ was sampled from $$F_{XY}$$, which we know is true. Let $$H_0$$ be the hypothesis that $$S$$ was sampled in the following way: $$(X_i,Y_i)\sim F_XF_Y$$, where $$F_X,F_Y$$ are the marginals of $$F_{XY}$$. Compute the likelihood ratio test statistic, defined as $$\lambda=\frac{L_{H_1}(S)}{L_{H_0}(S)}$$. Now we want to compute the empirical p-value of this $$\lambda$$ using permutation test. This means (I think): we permuate $$S$$ several times (say $$M$$ times) to get $$S_1,\ldots,S_m$$, compute $$\lambda_1, \ldots, \lambda_m$$, and then $$\hat{p}=\frac{1}{M}\sum_{i=1}^{M}1_{\{\lambda_i>\lambda\}}$$.

Here's what I did, and I may be wrong.

$$f_X(x)=\int_0^{1-x} f_{XY}(x,y)\ dy=2(1-x)$$ and similarly $$f_Y(y)=2(1-y)$$. Then $$L_{H_0}(S)=\prod_{i=1}^n f_X(x_i)f_Y(y_i)=\prod_{i=1}^n 2(1-x_i)\cdot 2(1-y_i)$$ and $$L_{H_1}(S)=\prod_{i=1}^n f_{XY}(x_i,y_i)=\prod_{i=1}^n 2=2^n$$ So $$\lambda=\dfrac{2^n}{\prod_{i=1}^n 2(1-x_i)\cdot 2(1-y_i)}$$.

Here's my problem: I permute $$S$$ in the following way: we have $$2n$$ points, I permute those $$2n$$ points, and simply assign the first $$n$$ numbers to be the $$x_i$$'s and the next $$n$$ numbers to be the $$y_i$$'s to form $$S_i$$ for each permutation. I then compute $$\lambda_i$$ as I did before. The problem is that I get the same $$\lambda$$ every time! that is $$\lambda=\lambda_1= \ldots=\lambda_m$$, since $$X,Y$$ are symmetrical in my calculations. I'm sure I'm doing something wrong. I'd appreciate if you could point out my mistake. Since we know $$H_1$$ is true, we're trying to show that the empirical p-value is small.