Analyse Olist e-commerce conversion funnels and simulate A/B tests with bootstrap confidence intervals and Bonferroni correction.
Active
- Olist order funnel analysis — full conversion funnel from order creation to delivery
- Monthly trends — funnel volumes broken down by month to spot seasonality
- Payment/category segmentation — funnel completion rates by payment method and product category
- Delivery vs satisfaction — scatter plot of delivery delay against review score
- A/B simulation — synthetic A/A and A/B tests with known ground-truth effects
- Bootstrap confidence intervals — non-parametric resampling (10 000 iterations) for robust inference
- Bonferroni correction — multiple-comparison adjustment demonstrated via 20 simultaneous A/A tests
| Script | Dependency | Purpose |
|---|---|---|
funnel_analysis.py |
PostgreSQL 16+ (Olist dataset) | Queries database, builds 6 funnel/satisfaction charts |
ab_test_simulator.py |
Standalone (synthetic data) | Runs 4 A/B test scenarios, produces 4 charts |
Both scripts output PNG charts to output/.
- Python 3.10+
- PostgreSQL 16+ (only for
funnel_analysis.py) - Packages listed in
requirements.txt
git clone https://github.com/Tabasiarash/ab-testing-funnel.git
cd ab-testing-funnel
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# For funnel analysis only — load Olist database
# See https://github.com/Tabasiarash/ecommerce-sales-intelligence
# Then edit the DB_URL in funnel_analysis.py (line 28) or set env varHardcoded credential (tech debt): DB_URL is hardcoded in funnel_analysis.py:28 as postgresql://analyst:analyst_pass@localhost:5432/olist. This should be moved to an environment variable. A .env.example file is provided as a reference.
# Standalone A/B test simulator (no DB needed)
python ab_test_simulator.py
# Funnel analysis (requires running PostgreSQL with Olist)
python funnel_analysis.pyAll charts are written to the output/ directory as PNG files.
Not applicable — these are single-run analysis scripts intended for local execution or notebook-style exploration.
- Adding a new funnel query: Open
funnel_analysis.py, write a new query function (seequery_funnel_overallfor the pattern), call it frommain(), and add a plotting step. - Adding a new A/B scenario: Open
ab_test_simulator.py, add a new scenario function following the existing pattern (generate synthetic data, run test, plot), then invoke it frommain(). - Styling: Both scripts use
matplotlibwith theAggbackend and seaborn-style theme viaplt.rcParams.
- Database credentials are hardcoded in
funnel_analysis.py:28(should use environment variables) - Funnel analysis requires the full Olist dataset loaded into PostgreSQL — no fallback to cached data
data/andoutput/directories exist but are empty (output is generated at runtime)- No
docker-compose.ymlis provided for the Olist database - A/B simulator uses synthetic data — results are pedagogical, not derived from real experiments
MIT