You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/tutorials/hillstrom.rst
+321Lines changed: 321 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -332,6 +332,327 @@ The side-by-side bar charts show probability treatment effects across different
332
332
333
333
**Conclusion**: Using the real Hillstrom dataset with 64,000 customers, the distributional analysis reveals nuanced patterns in how email campaigns affect customer spending. The analysis goes beyond simple average comparisons to show how treatment effects vary across the entire spending distribution, providing insights into which customer segments respond best to different campaign types. This demonstrates the power of distribution treatment effect analysis for understanding heterogeneous responses in digital marketing experiments.
334
334
335
+
Subgroup Analysis by Purchase History
336
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
337
+
338
+
Beyond comparing email campaigns overall, we can examine how campaign effectiveness varies by customer purchase history. This analysis segments customers based on their past purchasing behavior:
Note that these segments overlap (6,448 customers purchased both categories), so a customer can appear in both analyses.
344
+
345
+
**Research Question**: Does the effectiveness of men's vs women's email campaigns vary by the type of merchandise customers have historically purchased?
print(f" Men's Merch. Purchasers: ATE = ${ate_women_male:.4f}")
383
+
print(f" Women's Merch. Purchasers: ATE = ${ate_women_female:.4f}")
384
+
print("\nMen's Email Campaign:")
385
+
print(f" Men's Merch. Purchasers: ATE = ${ate_men_male:.4f}")
386
+
print(f" Women's Merch. Purchasers: ATE = ${ate_men_female:.4f}")
387
+
388
+
Expected output::
389
+
390
+
Average Treatment Effects by Subgroup:
391
+
392
+
Women's Email Campaign:
393
+
Men's Merch. Purchasers: ATE = $0.2564
394
+
Women's Merch. Purchasers: ATE = $0.5442
395
+
396
+
Men's Email Campaign:
397
+
Men's Merch. Purchasers: ATE = $0.8966
398
+
Women's Merch. Purchasers: ATE = $0.8412
399
+
400
+
These results reveal important patterns:
401
+
402
+
- **Women's Email Campaign**: Shows 2× stronger effect for women's merchandise purchasers ($0.54) vs men's merchandise purchasers ($0.26)
403
+
- **Men's Email Campaign**: Demonstrates consistent strong effects across both segments ($0.84-$0.89)
404
+
405
+
While these averages provide a useful summary, they don't tell us *how* customer spending distributions change. The distributional and probability treatment effect analyses that follow reveal the complete picture of campaign effectiveness.
406
+
407
+
Distribution Treatment Effects: Women's Email Campaign
**Key Finding for Women's Email Campaign**: The distributional treatment effects reveal that women's email campaigns are significantly more effective for the women's merchandise purchaser segment (right panel) compared to the men's merchandise purchaser segment (left panel). The DTE curves show that women's emails reduce the probability of low spending levels (negative DTE at lower thresholds) for women's merchandise purchasers, indicating a shift toward higher spending. In contrast, the men's merchandise purchaser segment shows minimal or non-significant effects across most of the spending distribution, with confidence intervals overlapping zero.
464
+
465
+
Distribution Treatment Effects: Men's Email Campaign
**Key Finding for Men's Email Campaign**: In contrast to women's email campaigns, men's email campaigns show consistent effectiveness across both purchase history segments. The DTE curves in both panels show similar patterns, with negative values at lower spending levels indicating reduced probability of low spending for both male and women's merchandise purchasers. This suggests that men's emails have broad appeal regardless of whether customers historically purchased men's or women's merchandise.
511
+
512
+
Probability Treatment Effects: Women's Email Campaign
While DTE shows how cumulative distributions shift, Probability Treatment Effects (PTE) reveal which specific spending intervals are most affected by the campaign. PTE measures the change in probability mass within each spending category:
516
+
517
+
.. code-block:: python
518
+
519
+
# Compute PTE for Women's Email vs Control in each subgroup
520
+
pte_locations = np.insert(locations, 0, -1) # Add -1 at beginning for intervals
**Interval-Specific Insights**: The PTE bar charts reveal the mechanism behind the average treatment effect. For women's merchandise purchasers (right panel), women's emails significantly reduce the probability of zero spending (non-purchasers converting to purchasers), which is the primary driver of the positive ATE. However, no significant increase in high spending categories is observed. For men's merchandise purchasers (left panel), the effects are much smaller and less consistent, confirming the limited impact suggested by the ATE and DTE analyses.
562
+
563
+
Probability Treatment Effects: Men's Email Campaign
**Interval-Specific Insights**: Men's email campaigns show similar PTE patterns across both segments (left and right panels). The key mechanism is twofold: (1) significant reduction in zero spending probability (converting non-purchasers to purchasers), and (2) increased probability in the $40-100 spending range. This dual effect—both purchase conversion and mid-range spending increases—occurs consistently across both male and women's merchandise purchaser segments, confirming the broad effectiveness of men's campaigns.
611
+
612
+
Key Insights from Subgroup Analysis
613
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
614
+
615
+
Combining Average Treatment Effects (ATE), Distribution Treatment Effects (DTE), and Probability Treatment Effects (PTE) provides a comprehensive understanding of campaign effectiveness:
- For women's emails, the women's merchandise purchaser segment shows negative DTE at lower spending thresholds, indicating a systematic shift away from low-spending behavior
626
+
- Men's merchandise purchasers show minimal distributional changes from women's emails, with confidence intervals overlapping zero at most thresholds
627
+
- Men's emails produce similar distributional patterns across both segments, confirming broad effectiveness
628
+
629
+
**3. Spending Category Changes (from PTE)**
630
+
631
+
- PTE analysis reveals *which specific spending intervals* change in response to campaigns, particularly identifying the mechanisms behind average effects
632
+
- **Women's emails**: For women's merchandise purchasers, the primary effect is converting non-purchasers to purchasers (significant reduction in zero spending probability). No significant increase in high spending categories was observed.
633
+
- **Men's emails**: Show a dual mechanism across both segments: (1) converting non-purchasers to purchasers (zero spending reduction), and (2) increasing purchases in the $40-100 range
634
+
- PTE enables identification of behavioral change mechanisms that are invisible in average treatment effects alone—specifically revealing that lift comes primarily from purchase conversion (0→1 effect) rather than spending increases among existing purchasers
635
+
636
+
**4. Strategic Implications**
637
+
638
+
Based on these findings, several practical implications emerge:
639
+
640
+
- **For Women's Campaigns**: Target customers with history of purchasing women's merchandise to maximize ROI. The PTE analysis reveals that effectiveness comes primarily from converting non-purchasers to purchasers among women's merchandise purchaser segments, rather than increasing spending among existing buyers.
641
+
- **For Men's Campaigns**: Deploy broadly as they produce consistent positive effects across diverse customer segments. Both male and women's merchandise purchasers show both purchase conversion and mid-range spending increases, suggesting broader appeal.
642
+
- **Resource Allocation**: One practical implication is to prioritize precise targeting for gender-specific content (women's emails) but invest confidently in broad deployment for broadly appealing content (men's emails).
643
+
644
+
**5. Methodological Value**
645
+
646
+
This three-tier analysis demonstrates why distributional methods matter:
647
+
648
+
- **ATE alone** would show that both campaigns have positive effects, but with varying magnitudes across subgroups
649
+
- **Adding DTE** reveals *how* spending distributions shift, not just average changes
650
+
- **Adding PTE** pinpoints *which spending categories* are most affected, enabling precise business decisions
651
+
652
+
By examining effects at average, distributional, and interval-specific levels, we gain actionable insights that would be invisible to traditional mean-comparison approaches. This demonstrates the power of distribution treatment effect methods for understanding heterogeneous responses in digital marketing experiments.
653
+
654
+
For the complete reproducible code including helper functions and visualizations, see `example/hillstrom.ipynb <https://github.com/CyberAgentAILab/python-dte-adjustment/blob/main/example/hillstrom.ipynb>`_.
0 commit comments