= Pearson chi-squared statistic for contingency tables
{c}
{title2=$X^2=\sum_{ij}(O_{ij}-E_{ij})^2/E_{ij}$}
For observed counts $O_{ij}$ and positive expected counts $E_{ij}$ in a <contingency table>, the statistic is $X^2=\sum_{ij}(O_{ij}-E_{ij})^2/E_{ij}$. Under common category probabilities or statistical independence, estimate $E_{ij}$ by the product of the row and column totals divided by the grand total. With large expected counts, this gives the test statistic for the <Pearson chi-squared test of homogeneity> or the <Pearson chi-squared test of independence>, with asymptotic <chi-squared distribution> on $(r-1)(c-1)$ <degrees of freedom>.
Back to article page