Skip to main content
← Lab

proptail

confirmedupstream bugPython · mlxtendSystems & data structuresJuly 25, 2026

the question

Is the p-value returned by mlxtend's `proportion_difference` a valid two-sided test statistic?

what came out

mlxtend's `proportion_difference` returns `scipy.stats.norm.cdf(z)`, the lower-tail probability, not a two-sided p-value. Swapping the two proportions replaces p with `1 - p`, equal proportions give 0.5 instead of 1.0, and on (0.83, 0.91), n=100 it reports 0.045 and rejects while the correct two-tailed p is 0.090. Fix: `2.0 * scipy.stats.norm.sf(abs(z))`.

method & receipts

  • Result: confirmed
  • Reproducible one script re-runs the whole thing from scratch.
  • Tested — a correctness/benchmark suite ships alongside the code.

→ read the code and re-run it

github.com/v-code01/proptail