End-to-end email A/B testing analysis: experiment design, power analysis, Z-test, T-test, Bayesian testing, and segment-level insights. Python (scipy, statsmodels) + Power BI dashboard. Variant B (personalized) won with 97.9% Bayesian confidence and +302% revenue lift.
This project demonstrates a complete A/B testing framework applied to Company A's email marketing campaign. The test evaluated whether personalized subject lines (using the recipient's first name) outperform generic subject lines in driving open rates, click-through rates, conversions, and revenue.
The analysis covers the full A/B testing lifecycle:
- Experiment Design β sample size, power analysis, random assignment
- Exploratory Data Analysis β metric distributions, segment breakdowns
- Statistical Testing β Z-test, T-test, and Bayesian A/B test
- Business Recommendation β winner declaration, segment insights, action plan
Note: Company A is an anonymized client. The dataset is simulated to reflect realistic email marketing dynamics including segment-level variation, conversion funnel behavior, and revenue distributions.
| Parameter | Value |
|---|---|
| Test type | A/B Test (two variants) |
| Channel | Email marketing |
| Test element | Subject line |
| Variant A (Control) | Generic subject line |
| Variant B (Treatment) | Personalized subject line with recipient name |
| Total subscribers | 10,000 |
| Split | 50/50 random assignment |
| Test duration | 4 weeks (March 2024) |
| Primary metric | Open Rate |
| Secondary metrics | CTR, Conversion Rate, Revenue per User |
| Significance threshold | Ξ± = 0.05 |
email-ab-testing-analysis/
β
βββ data/
β βββ email_ab_test_data.csv # Raw individual subscriber data (10K rows)
β βββ ab_daily_summary.csv # Daily metrics by variant
β βββ ab_segment_summary.csv # Results by customer segment
β βββ ab_statistical_results.csv # Statistical test results
β
βββ notebooks/
β βββ 01_eda_analysis.ipynb # Exploratory data analysis
β βββ 02_ab_test_analysis.ipynb # Statistical testing & recommendation
β
βββ screenshots/
β βββ page1_test_overview.png
β βββ page2_statistical_results.png
β βββ page3_business_recommendation.png
β
βββ README.md
| Field | Description |
|---|---|
subscriber_id |
Unique subscriber identifier |
variant |
A (Control) or B (Treatment) |
send_date |
Date email was sent |
age_group |
Subscriber age group |
customer_segment |
New, Returning, or VIP |
days_since_last_purchase |
Recency metric |
opened |
1 if email was opened, 0 otherwise |
clicked |
1 if link was clicked, 0 otherwise |
converted |
1 if purchase was made, 0 otherwise |
revenue |
Revenue generated ($) |
Notebook: 01_eda_analysis.ipynb
Key EDA findings:
- Variant B consistently outperformed Variant A on open rate every single day of the 4-week test β no crossover observed
- VIP customers showed the strongest response to personalization
- New customers showed no meaningful lift β generic subject line performs equally well for acquisition
- Revenue distribution for converters: Variant B median (
$50) higher than Variant A ($33)
| Metric | Variant A | Variant B | Lift |
|---|---|---|---|
| Open Rate | 21.86% | 26.78% | +22.5% |
| CTR | 20.31% | 21.96% | +8.1% |
| Conversion Rate | 0.10% | 0.28% | +180% |
| Revenue per User | $0.037 | $0.149 | +302% |
Notebook: 02_ab_test_analysis.ipynb
Before interpreting results, we assessed whether the test had sufficient statistical power:
| Parameter | Value |
|---|---|
| Baseline conversion rate | 0.10% |
| Minimum detectable effect | 20% relative lift |
| Required sample per variant | 392,050 |
| Actual sample per variant | 5,000 |
| Test adequately powered |
Important note: The test was underpowered for conversion rate detection. Open rate results (well-powered with 1,093+ opens per variant) are the most statistically reliable finding.
Variant A: 21.86%
Variant B: 26.78%
Absolute lift: +4.92 percentage points
Relative lift: +22.5%
95% CI: [0.0324, 0.0660]
Z-statistic: -5.73
P-value: 0.000000
Significant: β
YES β 100% confidence
Variant A: 0.10%
Variant B: 0.28%
Relative lift: +180%
95% CI: [0.0001, 0.0035]
Z-statistic: -2.07
P-value: 0.038762
Significant: β
YES β 96.1% confidence
Variant A: $0.037
Variant B: $0.149
Relative lift: +302.3%
95% CI: [$0.024, $0.199]
T-statistic: -2.499
P-value: 0.012461
Significant: β
YES β 98.8% confidence
Prior: Beta(1,1) β uninformative uniform prior
Posterior A: Beta(6, 4996)
Posterior B: Beta(15, 4987)
P(B > A): 97.9%
Recommendation: β
Launch Variant B
The Bayesian approach confirms: there is a 97.9% probability that Variant B's true conversion rate exceeds Variant A's β well above the 95% decision threshold.
| Frequentist (Z/T-Test) | Bayesian | |
|---|---|---|
| Question answered | Is this due to chance? | What's P(B beats A)? |
| Output | p-value | Probability |
| Business interpretation | Technical | Intuitive |
| Can stop early | No | Yes |
| Our result | p < 0.05 β | 97.9% β |
Both approaches agree: Variant B wins.
Business Impact:
- Every 10,000 emails sent with Variant B generates +$1,120 more revenue than Variant A
- +9 incremental conversions per 10,000 sends
- +4.92 percentage point improvement in open rate
- Zero additional cost β purely from subject line personalization
| Segment | Recommendation |
|---|---|
| VIP | β Switch to Variant B immediately β strongest lift ($0.10 β $0.29 revenue/user) |
| Returning | β Switch to Variant B β solid lift ($0.03 β $0.20 revenue/user) |
| New |
| Priority | Action | Segment | Expected Impact |
|---|---|---|---|
| 1 | Roll out Variant B immediately | Returning + VIP | +$1,120/send |
| 2 | Run separate test for New customers | New | TBD |
| 3 | Monitor open rate weekly | All | Detect novelty decay |
| 4 | Re-run full test in 90 days | All | Confirm sustained lift |
| 5 | Extend personalization to SMS | All | Apply learnings |
β οΈ Test underpowered for conversion rate β need 392K per variant for definitive resultβ οΈ New customer segment showed no lift β do not apply Variant B to acquisition campaignsβ οΈ Monitor for novelty effect β personalization lift may decay over timeβ οΈ Consider multivariate test: name + send time + content personalization
| Tool | Purpose |
|---|---|
| Python | Primary analysis language |
| pandas / numpy | Data manipulation |
| scipy / statsmodels | Statistical testing |
| matplotlib / seaborn | Data visualization |
| Power BI | Interactive dashboard |
- Clone the repository
- Install dependencies:
pip install pandas numpy scipy statsmodels matplotlib seaborn- Open Google Colab or Jupyter Notebook
- Upload
email_ab_test_data.csvto your environment - Run notebooks in order:
01_eda_analysis.ipynb β 02_ab_test_analysis.ipynb
π Marketing Mix Modeling with Robyn π Marketing Performance Dashboard β Power BI
Azar Taheri LinkedIn