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 has an asymptotic chi-squared distribution with 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.
For independent , a group with necessarily has and contributes likelihood one. Its probability parameter is unidentifiable and supplies no restriction to test. If groups have positive sample sizes, the unrestricted model has probability parameters and the common-probability model has one; the asymptotic homogeneity test therefore has degrees of freedom. Zero expected-count rows must be removed rather than divided by in the Pearson statistic.
For observed counts and positive expected counts in a contingency table, the statistic is . Under common category probabilities or statistical independence, estimate 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 degrees of freedom.
Consider independent binomial counts under the common-probability null hypothesis, with fixed positive row sizes . Let , and assume . Conditional on , the probability mass function is the displayed multivariate hypergeometric distribution: in the joint likelihood, the factor is common to all admissible tables and cancels. The Vandermonde identity gives the denominator, so the conditional distribution is free of the unknown nuisance parameter .
For a table , its Pearson chi-squared statistic isAn exact conditional p-value sums the displayed probabilities over all tables with the same margins and . The ordering is by the Pearson chi-squared statistic, rather than by the probability of an individual table; different exact-test orderings can give different answers. Enumeration is practical when and the number of rows are small. Monte Carlo tests can approximate the same tail by sampling tables with fixed margins.[ref]
Pearson's Chi-squared Test for Count Data in the R documentation. Details: simulated contingency-table tests sample tables with fixed marginals and use the Pearson statistic
An exact arithmetic comparison is easy too. Let be the least common multiple of the row sizes. Compare the integersince every table has the same positive denominator . This includes boundary ties without a floating-point tolerance. Conditional p-values are discrete and can be conservative; “exact” concerns their null calibration, not equality of rejection probability with every chosen significance level.
For a two-by-two contingency table, subtracting one half from each absolute observed-minus-expected count difference, with truncation at zero, gives the displayed corrected Pearson chi-squared statistic. Expected counts use the independence model . The subtraction compensates approximately for using a continuous chi-squared distribution for discrete counts. It can make the test conservative. The corrected statistic should be distinguished from the ordinary uncorrected Pearson chi-squared statistic.
Articles by others on the same topic
There are currently no matching articles.