# how to prove chi-square statistics conforms to chi-square distribution with contingency table?

chi-square test(principle used in C4.5's CVP Pruning),

also called chi-square statistics,

also called chi-square goodness-of fit

How to prove

$$\sum_{i=1}^{i=r}\sum_{j=1}^{j=c}\frac{(x_{ij}-E_{ij} )^2}{E_{ij}} = \chi^2_{(r-1)(c-1)}$$

where $$E_{ij}=\frac{N_i·N_j}{N}$$,

$$N$$ is the total counts of the whole datasets.

$$N_i$$ are the counts of the sub-datasets of the same-value of feature

$$N_j$$ are the counts of the sub-datasets of the same-class

here is contingency table

/------------------------------------------------

here are some references which are not clear:

https://arxiv.org/pdf/1808.09171.pdf (not mention why $$k-1$$ is used in formula(5))

https://www.math.utah.edu/~davar/ps-pdf-files/Chisquared.pdf (Not mention why $$\Theta<1$$ from (9)->(10))

https://arxiv.org/pdf/1808.09171 (page 4th not mention what is X*with a line on it)

http://personal.psu.edu/drh20/asymp/fall2006/lectures/ANGELchpt07.pdf (Page 109th,Not mention why $$Cov(X_{ij},X_{il}=-p_ip_l)$$)

The proof uses $$x_{ij}\approx\operatorname{Poisson}(E_{ij})\approx N(E_{ij},\,E_{ij})$$. The reason for $$k-1$$ is that $$\sum_i N_i=N$$ removes a degree of freedom. The reason for $$\Theta\le 1$$ is because the $$\theta_i$$ are probabilities.

• thanks for your replies,could you please give a proof with details about the xij≈Poisson(Eij)≈N(Eij,Eij)?THANKS. Commented Nov 26, 2018 at 8:05
• what's the meaning of xij≈Poisson(Eij)≈N(Eij,Eij)？ Commented Nov 26, 2018 at 8:25
• For the Poisson distribution the mean is equal to the variance.
– Karl
Commented Nov 26, 2018 at 12:32
• thanks for your replies,but what's the meaning of "xij≈Poisson(Eij)"? Commented Nov 27, 2018 at 6:52
• @appleyuchi That $x_{ij}$ is approximately Poisson-distributed.
– J.G.
Commented Nov 27, 2018 at 6:53

https://blog.csdn.net/appleyuchi/article/details/84567158

I try to prove it from multi-nominal distribution. The above link is my record,NOT very rigorous,

If there are something wrong ,please let me know,thanks.

If there are other proof which is much easier to understand ,please let me know,thanks.

Many thanks for all your help~!