Skip to content

fix: significance_report's confidence parameter now affects the significant flag - #560

Merged
yakew7 merged 1 commit into
yakew7:mainfrom
propcgamer20-png:fix/significance-confidence-affects-verdict
Sep 10, 2026
Merged

fix: significance_report's confidence parameter now affects the significant flag#560
yakew7 merged 1 commit into
yakew7:mainfrom
propcgamer20-png:fix/significance-confidence-affects-verdict

Conversation

@propcgamer20-png

Copy link
Copy Markdown
Collaborator

Problem

faircode/significance.py's significance_report hardcoded "significant": p_value < 0.05, while confidence (default 0.95) only affected the width of the returned ci_low / ci_high.

r95 = significance_report(a, b, confidence=0.95, ...)   # p=0.0383, significant=True
r99 = significance_report(a, b, confidence=0.99, ...)   # p=0.0383, significant=True  <- unchanged

A caller tightening confidence to 0.99 to get a more conservative verdict got the same p < 0.05 threshold, with nothing indicating confidence had no effect on significant.

Fix

significant is now p_value < (1 - confidence):

  • at the default confidence=0.95 -> p < 0.05, identical to the old behavior (every audit's unfair.py / fair.py uses the default, so their output is unchanged)
  • confidence=0.99 -> p < 0.01, so p=0.0383 is now significant=False

The CI and the verdict move together. Documented in the docstring.

Test

test_confidence_tightens_the_significance_threshold_not_just_the_ci - a gap with 0.01 < p < 0.05 is significant at confidence=0.95 but not at confidence=0.99, same permutation p_value both times.

pytest tests/test_significance.py -> 8 passed. ruff clean.

Closes #548

…ficant flag

significant was hardcoded p_value < 0.05 while confidence (default 0.95)
only widened or narrowed the returned CI. A caller passing a stricter
confidence (0.99) expecting a more conservative significance verdict got
the same p < 0.05 threshold, silently.

significant is now p_value < (1 - confidence): identical to the old
p < 0.05 at the default confidence=0.95 (so every audit's unfair.py /
fair.py output is unchanged), and correspondingly stricter for a caller
that asks for it. Documented in the docstring.

Closes yakew7#548
@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@propcgamer20-png is attempting to deploy a commit to the yashkewlani2020-gmailcom's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

@yakew7 @ahmdkaml - new PR touching a path you own, please review.

@yakew7
yakew7 merged commit 49301cd into yakew7:main Sep 10, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

significance_report's confidence parameter doesn't affect the significant flag - only the CI

2 participants