Decision-first experimentation
Eleven worked modules on real data: a 64,000-customer email test and California's 1988 tobacco tax. Every method is checked on the data before it is trusted, and every result ends in a decision.
Measured on real customers, not assumed from a formula.
Check results every day and stop at the first win
21% false alarms instead of the promised 5%
See notebook 05
Switch to the bootstrap because revenue is skewed
9% false alarms with 1,000 customers per group
See notebook 03
Size the test with the textbook formula
Too optimistic on revenue: 161K per group vs 173K by simulation
See notebook 04
Read "not significant" as "no effect"
This test would have missed a worthwhile lift 5 times out of 6
See notebook 04
Expect CUPED to shrink the noise
A year of purchase history removed under 0.1% of revenue variance
See notebook 06
Build an uplift model to target who gets the email
Two uplift models ranked customers no better than random, and emailing everyone beat every targeting policy
Each one is a question a team actually asks.
Can we trust this test?
Sample ratio check, covariate balance
02What do we decide before looking?
Decision plan as code, break-even economics
03Do our methods actually work on this data?
A/A calibration of the t-test and bootstrap
04How many customers do we need?
Power by simulation vs the textbook formula
05What happens if we peek every day?
Sequential testing (O'Brien-Fleming)
06Did the email work, and by how much?
CUPED, Holm correction, three estimators
07Which email should we send, in dollars and risk?
Bayesian bootstrap, expected loss, sensitivity, decision memo
08Who does the email actually change?
T-learner, X-learner, Qini curves, stability
09Who should get the email at all?
Policy value in dollars, inverse propensity weighting
10What if we could not randomize?
Difference-in-differences, event study, placebo in time
11Can we build a better comparison?
Synthetic control, placebo states, leave-one-out
pip install git+https://github.com/ai-with-md/experimentation-toolkit
from exptoolkit.checks import sample_ratio_check
from exptoolkit.estimators import welch_t
from exptoolkit.calibration import aa_test
from exptoolkit.power import simulate_power
from exptoolkit.sequential import obf_boundaries
# df: one row per customer, with an "arm" column and your metric
control = df.loc[df["arm"] == "control", "revenue"]
# 1. Were the groups split the way you planned?
sample_ratio_check(df)["p_value"]
# 2. Does the t-test behave on *your* metric at *your* size? (A/A test on real data)
aa_test(control, welch_t, n_per_arm=5_000).false_positive_rate
# 3. How likely is a test of this size to catch a 10 cent lift?
simulate_power(control, revenue_lift=0.10, n_per_arm=20_000)
# 4. Checking daily for two weeks? Use these thresholds instead of 1.96.
obf_boundaries(n_looks=14)
# 5. A policy you could not randomize? Build a synthetic comparison group.
from exptoolkit.causal import synthetic_control
result = synthetic_control(panel, treated="California", start=1989) # panel: years x units
result.weights, result.average_effect