Compare two variants. Measure lift. Make a confident decision.
Takes visitor and conversion counts for a control and a treatment group, then runs a complete frequentist analysis:
- Two-proportion z-test (two-sided, one-sided, or directional)
- 95% confidence interval for the lift
- Effect size — Cohen's h
- Power analysis and required sample size
- Decision recommendation with plain-English explanation
- Exportable Markdown and JSON reports
Everything is surfaced through a Streamlit dashboard or callable directly from Python.
# install
pip install -r requirements.txt
# run the dashboard
streamlit run dashboard/app.py
# run tests
pytestFor development, install in editable mode instead:
pip install -e ".[dev]"The dashboard accepts two CSV shapes.
Aggregated — one row per segment, or a single total row:
visitors_a,conversions_a,visitors_b,conversions_b
10000,450,10000,520
Per-user — one row per visitor:
variant,converted
A,0
A,1
B,1
B,0
Sample files are in data/.
from ab_testing_framework import run_ab_test
result = run_ab_test(
visitors_a=10000, conversions_a=450,
visitors_b=10000, conversions_b=520,
alpha=0.05,
alternative="two-sided", # "larger" | "smaller" | "two-sided"
)
print(result.decision) # Reject H₀
print(result.recommendation) # Deploy Version B. Conversion increased by 15.6%...
print(result.z_test.p_value) # 0.0212
print(result.power_analysis.power) # 0.xxPython 3.10+ · numpy · pandas · scipy · statsmodels · plotly · streamlit
A "Deploy" recommendation requires two conditions to both be true:
- p-value < α
- The confidence interval lower bound > 0
Passing the p-value threshold alone is not sufficient — the CI must fully exclude zero.