🤖 AI Summary
Pearson’s chi-squared test commonly relies on the continuous χ² distribution to approximate the discrete sampling distribution of the test statistic under uniformity, but this approximation incurs substantial errors—especially under low expected frequencies or in tail probability calculations.
Method: We propose the first efficient algorithm for computing the exact distribution of the chi-squared statistic under the discrete uniform null hypothesis, leveraging dynamic programming and zero-difference distribution composition to achieve feasible computational complexity.
Contribution/Results: Our method enables the first systematic quantification of systematic bias in the χ² approximation within the tail region, revealing significant p-value inflation (and consequent Type I error inflation) when expected frequencies fall below 5. Empirical evaluation confirms that approximation errors can exceed an order of magnitude. These findings correct longstanding statistical practice assumptions. An open-source implementation supports high-precision hypothesis testing and critical value calibration.
📝 Abstract
Pearson's chi-squared test is widely used to assess the uniformity of discrete histograms, typically relying on a continuous chi-squared distribution to approximate the test statistic, since computing the exact distribution is computationally too costly. While effective in many cases, this approximation allegedly fails when expected bin counts are low or tail probabilities are needed. Here, Zero-disparity Distribution Synthesis is presented, a fast dynamic programming approach for computing the exact distribution, enabling detailed analysis of approximation errors. The results dispel some existing misunderstandings and also reveal subtle, but significant pitfalls in approximation that are only apparent with exact values. The Python source code is available at https://github.com/DiscreteTotalVariation/ChiSquared.