# Conditional Testing of Two-way Contingency Independence

I am reading about testing independence in two-way contingency tables from Mood Graybill and Boes's Introduction to the Theory of Statistics and is confused about testing independence.

We have a two-way contingency table. We assume that the cells in the table follow a multinomial distribution with parameters $$n$$ (known) and $$p_{i,j}$$ (unknown) for $$1 \leqslant i \leqslant r$$ and $$1 \leqslant j \leqslant s$$ where $$p_{i,j}$$ is the probability of getting cell $$(i,j)$$ for a single trial. Let $$N_{i,j}$$ be the random variable representing the number in cell $$i,j$$.

We want to use the generalised likelihood-ratio $$\Lambda$$ to test $$H_0:p_{i,j} = p_{i}p_{j}$$

$$\Lambda$$ turns out to equal $$\frac{(\prod_{i} {n_{i.}}^{n_{i.}})(\prod_{j} {n_{.j}}^{n_{.j}})}{n^n \prod_{i,j} {n_{i,j}}^{n_{i,j}}}$$, (the $$n_{i.}$$ and the $$n_{.j}$$ are the marginal totals) the distribution of this under $$H_0$$ is not unique, since $$H_0$$ is composite and $$\Lambda$$ involves the unknown parameters; this makes formulating a test with a fixed Type-I error size difficult.

What the book does is to use the marginals $$N_{i.}$$ and $$N_{.j}$$. The book computes the joint probability mass function of the $$N_{i,j}$$ under $$H_0$$ which is $$\frac{n!}{\prod_{i,j} {n_{i,j}!}}(\prod_{i} {p_{i.}}^{n_{i.}})(\prod_{j} {p_{.j}}^{n_{.j}})$$. Then it computes the joint probability mass function of the marginals $$N_{i.}$$ and $$N_{.j}$$ under $$H_0$$ which is $$\frac{(n!)^2}{(\prod {n_{i.}!})(\prod {n_{.j}!})}(\prod_{i} {p_{i.}}^{n_{i.}})(\prod_{j} {p_{.j}}^{n_{.j}})$$. Then it computes the conditional distribution of the $$N_{i,j}$$ given the marginals $$N_{i.}$$ and $$N_{.j}$$ which turns out to be $$\frac{(\prod {n_i. !})(\prod {n_.j !})}{n! \prod_{i,j} {n_{i,j}!}}$$

The marginals are therefore (jointly) sufficient. Write $$T$$ for the marginals $$N_{i.}$$ and $$N_{.j}$$. The book then explains how for each $$t$$ (which would be a specific set of marginals in this instance) we can find $$\lambda_0 (t)$$ that satisfies $$\int_{0}^{\lambda_0 (t)} f_{\Lambda | T=t}(\lambda | t) = 0.05$$ because $$f_{\Lambda | T=t}(\lambda | t)$$ does not involve any unknown parameters (because $$T$$ is a sufficient statistic). So our test is 'conditional', we observe $$T$$ then we observe $$\Lambda$$ and reject $$H_0$$ if $$\Lambda$$ is below $$\lambda_0 (t)$$.

What I don't understand is how do we find $$\lambda_0 (t)$$? The book is vague about this. I think we are supposed to compute $$f_{\Lambda | T=t}(\lambda | t)$$, but how do we do this? Are we supposed to compute it from the conditional distribution of the $$N_{i,j}$$ given the marginals $$N_{i.}$$ and $$N_{.j}$$ which was shown to be $$\frac{(\prod {n_i. !})(\prod {n_.j !})}{n! \prod_{i,j} {n_{i,j}!}}$$ ? This sounds like a computational nightmare, the book does mention 'large-sample approximation', but I am not so certain what that refers to.