Pearson chi-squared test of homogeneity (source code)

= Pearson chi-squared test of homogeneity
{c}
{title2=$X^2=\sum (O-E)^2/E$}

The Pearson chi-squared test of homogeneity tests whether several independent categorical samples have the same category probabilities. Under the null, expected cell counts equal the product of the corresponding row and column totals divided by the total sample size. The <Pearson chi-squared statistic for contingency tables> $\sum(O-E)^2/E$ has an asymptotic <chi-squared distribution> with $(r-1)(c-1)$ <degrees of freedom>, when expected counts are sufficiently large. The sampling design differs from a <Pearson chi-squared test of independence>, though the statistic has the same form.