Hi Team,
gh-12282 noted that the sums of observed and expected counts passed to scipy.stats.chisquare
must be equal for the function to produce accurate p-values for Pearson’s chi-squared test. gh-13193 added a check that these sums are equal, raising an exception otherwise.
The change was quite disruptive (e.g. see gh-14298), but also seems to have caught real user errors (e.g. scipy.stats.chisquare is not working · Issue #14298 · scipy/scipy · GitHub).
Recently, a comment in gh-12282 noted a legitimate use case for the chisquare
function even when the total counts are not equal. To address this, gh-21695 proposes to add a sum_check
argument to chisquare
to disable the sum check.
Please join the discussion in ENH: `stats.chisquare`: add `sum_check` to disable check that total observed/expected counts are equal by mdhaber · Pull Request #21695 · scipy/scipy · GitHub!
Matt