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

please help,thanks~!

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)$)


2 Answers 2


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.

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


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~!


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .