Skip to main content

Statistical validity auditor for A/B tests — because significant != trustworthy.

Project description

abaudit

Statistical Validity Auditor for A/B Tests

Tests PyPI version Python License: MIT

A significant p-value answers the wrong question.
abaudit asks: given that the result is significant, how likely is it to actually be real?

Most A/B testing tools tell you whether your result is significant.
abaudit tells you whether you should trust it.


The Problem

Your A/B test returned p = 0.031. The team is ready to ship. But:

  • You tested 8 metrics and reported the best one
  • Someone peeked at the results on Day 3 and almost stopped the test
  • The traffic split is 52/48 instead of 50/50
  • Your prior belief that this variant would work was maybe 15%

Given all of that, what is the actual probability this effect is real?
abaudit computes that number.


Quickstart

pip install abaudit
import abaudit as ab

result = ab.audit(
    control=control_data,
    treatment=treatment_data,
    metrics=['conversion', 'revenue', 'time_on_site'],
    primary='conversion',
    prior_f=0.2,              # your belief the effect exists
    alpha=0.05,
    peeking_log=p_value_history,
)

result.summary()
# ┌─────────────────────────────┬────────┬────────┐
# │ Check                       │ Result │ Status │
# ├─────────────────────────────┼────────┼────────┤
# │ p-value                     │ 0.031  │  ✅    │
# │ PPV (prob. effect is real)  │ 0.41   │  ⚠️    │
# │ Sample Ratio Mismatch       │ 0.892  │  ✅    │
# │ Multiple metrics correction │ 0.093  │  ❌    │
# │ Optional stopping           │ 3 peeks│  ⚠️    │
# │ Effect size plausibility    │ d=0.8  │  ⚠️    │
# └─────────────────────────────┴────────┴────────┘
# Bias score: 0.42 / 1.0  ⚠️  Moderate concern

result.report("audit_report.html")   # full HTML report
result.ppv                            # 0.41
result.bias_score                     # 0.42
result.flags                          # list of warnings

What abaudit Checks

Module Check Answers
validity PPV (Ioannidis 2005) Given the significant result, what's the probability it's real?
validity Multiple metric correction You tested 8 things — what's the corrected p-value for the best one?
validity Effect size plausibility Is the reported effect size realistic or suspiciously large?
validity Benford's Law Do the summary statistics look fabricated?
runtime Sample Ratio Mismatch Was traffic split as intended?
runtime Optional stopping Was the test stopped early after peeking?
design PPV-aware power analysis Given your prior, how large does n need to be for results to be trustworthy?

Statistical Foundation

The core of abaudit is the Positive Predictive Value framework from:

Ioannidis, J.P.A. (2005). Why Most Published Research Findings Are False.
PLOS Medicine 2(8): e124.

$$\text{PPV} = \frac{(1-\beta) \cdot f}{(1-\beta) \cdot f + \alpha \cdot (1-f)}$$

Where $f$ is your prior probability that the effect exists, $1-\beta$ is your test's power, and $\alpha$ is the significance threshold. This is exactly Bayes' rule applied to hypothesis testing.


Development Status

Phase Module Status
0 Scaffold + _stats.py ✅ Complete
1 validity.py — core audit ✅ Complete
2 design.py — pre-experiment ✅ Complete
3 runtime.py — health checks ✅ Complete
4 report.py — HTML reports ✅ Complete

Contributing

git clone https://github.com/aldair-ai/abaudit.git
cd abaudit
pip install -e ".[dev]"
pytest

License

MIT © Edwin Aldair Espinoza Zegarra

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abaudit-0.1.1.tar.gz (721.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

abaudit-0.1.1-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file abaudit-0.1.1.tar.gz.

File metadata

  • Download URL: abaudit-0.1.1.tar.gz
  • Upload date:
  • Size: 721.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for abaudit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d36f82f644340b2f9eb518aafe6d27e972ad912cf75360d4356449888d8568ed
MD5 31f8f8655fc8aad2ad8671514148d273
BLAKE2b-256 823f2521fecbd66d5347efbd555243a4b86d353aa68ae0cee826986b49d3e4fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for abaudit-0.1.1.tar.gz:

Publisher: publish.yml on aldair-ai/abaudit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file abaudit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: abaudit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for abaudit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 97c020677ac041e33754ee381de43f66b354838988824ab060ed9435f1e5c3c6
MD5 375136d78618353d2c44afa7eed0fa9d
BLAKE2b-256 358b9f15c80782c9aea2f48c8e5724f356069395524219db83e3c28ba00b8e00

See more details on using hashes here.

Provenance

The following attestation bundles were made for abaudit-0.1.1-py3-none-any.whl:

Publisher: publish.yml on aldair-ai/abaudit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page