Experimentation
Design-based experimentation under interference: finite randomization designs, exposure mappings, Horvitz-Thompson estimators, variance bounds, consistency, CLTs, and paper-specific Aronow-Samii, Hudgens-Halloran, and Savje-Aronow-Hudgens results.
BettingMean 4 core · 3 supporting Worked application of the anytime-valid substrate to Waudby-Smith & Ramdas (2024), "Estimating means of bounded random variables by betting" (JRSS-B). ★ capital★ isTestSupermartingale_capital★ isConfidenceSequence_bettingCI★ isAnytimeValid_betting
Waudby-Smith & Ramdas (2024): confidence sequences by betting
Worked application of the anytime-valid substrate to Waudby-Smith & Ramdas (2024), "Estimating means
of bounded random variables by betting" (JRSS-B). To test that the mean of a [0,1]-bounded data
stream is m, a gambler bets a predictable fraction λₙ of current capital on each new
observation, multiplying capital by 1 + λₙ(Xₙ − m). The resulting capital process
Kₙ(m) = ∏ᵢ (1 + λᵢ(Xᵢ − m)) is, under the null that the conditional mean is m and with bets kept
in the range that keeps capital nonnegative, a test supermartingale (IsTestSupermartingale):
nonnegative, with K₀ = 1, and a fair bet cannot grow capital in expectation. Inverting it —
keeping the values m whose capital has not yet reached 1/α — yields a confidence sequence
for the mean with time-uniform coverage 1 − α, directly via Ville's inequality.
The betting capital process for testing that the mean is m, with observations X and predictable betting fractions lam: K₀ = 1 and Kₙ₊₁ = Kₙ · (1 + lamₙ·(Xₙ − m)).
The capital process is a test supermartingale (the Waudby-Smith–Ramdas construction). Consider a data stream X tested against a candidate mean m via betting fractions lam, all adapted to a filtration ℱ. If the capital process itself is adapted to ℱ, each bet lam n is measurable with respect to the time-n information, the capital process, the centered increment X n − m, and the bet-scaled increment lam n · (X n − m) are all integrable at every time n, every per-step return factor 1 + lam n (X n − m) stays nonnegative, and the conditional mean of X n − m given the time-n information is zero, i.e. the bet is conditionally fair, then the betting capital process is a nonnegative test supermartingale for ℱ under μ, with E[K₀] ≤ 1.
Formal statement
Proof (Lean source)
Betting confidence sequence (coverage). If the betting capital process built from the data stream X, betting fractions lam, and candidate mean m is a test supermartingale under μ and the target error level α is strictly positive, then the sequence of confidence sets that retains a candidate mean m only while its capital has not yet reached 1/α is a valid confidence sequence with time-uniform coverage 1 − α.
Formal statement
Proof (Lean source)
Anytime-valid test by betting. If the betting capital process built from the data stream X, betting fractions lam, and candidate mean m is a test supermartingale under μ and the target error level α is strictly positive, then the rejection region that declares significance once the capital ever reaches 1/α is an anytime-valid level-α test.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
capital_zerolemma — The betting capital starts at one before any observations are processed.Proof (Lean source)
-
capital_succlemma — One step of the betting capital multiplies current wealth by the return 1 + lam n · (X n − m).hypothesesX lam :ℕ → Ω → ℝm :ℝn :ℕProof (Lean source)
lemma capital_succ (X lam : ℕ → Ω → ℝ) (m : ℝ) (n : ℕ) : capital X lam m (n + 1) = fun ω => capital X lam m n ω * (1 + lam n ω * (X n ω - m)) := rfl -
capital_nonneglemma — The capital process stays nonnegative provided each bet keeps the per-step factor nonnegative (0 ≤ 1 + lamₙ(Xₙ − m)) — the admissibility constraint on the betting fractions.hypothesesX lam :ℕ → Ω → ℝm :ℝhbet :∀ n ω, 0 ≤ 1 + lam n ω * (X n ω - m)conclusion∀ n, 0 ≤ capital X lam m nProof (Lean source)
lemma capital_nonneg {X lam : ℕ → Ω → ℝ} {m : ℝ} (hbet : ∀ n ω, 0 ≤ 1 + lam n ω * (X n ω - m)) : ∀ n, 0 ≤ capital X lam m n := by intro n induction n with | zero => rw [capital_zero] intro ω norm_num | succ n ih => rw [capital_succ] intro ω exact mul_nonneg (ih ω) (hbet n ω)
ClusterRandomizedHT 6 core · 2 supporting This file formalizes the cluster-randomized Horvitz-Thompson identity behind Middleton and Aronow's average-treatment-effect result. ★ htClusterEffect★ totalEffect★ E_htClusterEffect
Middleton & Aronow (2015): cluster-randomized Horvitz-Thompson ATE
This file formalizes the cluster-randomized Horvitz-Thompson identity behind Middleton and Aronow's average-treatment-effect result. Treatment is assigned independently by cluster, each cluster has treated and control cluster-total potential outcomes, and inverse-probability weighting recovers the finite-population average treatment effect after normalization by the total number of units.
The file records the cluster Horvitz-Thompson treated/control totals, the unit-count denominator, the normalized effect estimator, the normalized finite-population ATE estimand, and the unbiasedness theorem (a direct consequence of the first-order cluster inclusion probability).
The Horvitz–Thompson treated total: each treated cluster's total outcome y1 c, weighted by the inverse assignment probability 1 / p c.
Definition (Lean source)
The Horvitz–Thompson control total: each control cluster's total outcome y0 c, weighted by the inverse control probability 1 / (1 − p c).
Definition (Lean source)
The total number of experimental units represented by the cluster counts n c.
Definition (Lean source)
The Middleton-Aronow Horvitz-Thompson ATE estimator divides the inverse-probability weighted treated-minus-control cluster-total estimator by the total number of units.
Definition (Lean source)
The finite-population average treatment effect is the all-unit treated-minus-control potential-outcome total, aggregated through cluster totals, divided by the total number of units.
Definition (Lean source)
Unbiasedness for the finite-population average treatment effect. Consider cluster randomization where each cluster c is assigned treatment with probability p c; suppose p c lies between 0 and 1 and, more sharply, p c lies strictly between 0 and 1, and the total number of units across clusters is positive. Then the Middleton–Aronow Horvitz–Thompson estimator of the effect — the inverse-probability-weighted treated-minus-control cluster-total contrast, normalized by the total unit count — is unbiased for the finite-population average treatment effect, the analogous unweighted contrast of the cluster-total potential outcomes normalized by the same unit count.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
E_htTreatedTotaltheorem — The HT treated total is unbiased for the treated-arm population total ∑ y1 c: each cluster is treated with probability p c, which the inverse weight 1 / p c exactly undoes.hypothesesp y1 :C → ℝhp0 :∀ c, 0 ≤ p chp1 :∀ c, p c ≤ 1hppos :∀ c, 0 < p cconclusion(clusterDesign p hp0 hp1).E (htTreatedTotal p y1) = ∑ c, y1 cProof (Lean source)
theorem E_htTreatedTotal (p y1 : C → ℝ) (hp0 : ∀ c, 0 ≤ p c) (hp1 : ∀ c, p c ≤ 1) (hppos : ∀ c, 0 < p c) : (clusterDesign p hp0 hp1).E (htTreatedTotal p y1) = ∑ c, y1 c := by change (bernoulliDesign p hp0 hp1).E (fun z => ∑ c, treatInd c z / p c * y1 c) = ∑ c, y1 c rw [show (fun z => ∑ c, treatInd c z / p c * y1 c) = (fun z => ∑ c, y1 c / p c * treatInd c z) from funext (fun z => Finset.sum_congr rfl (fun c _ => by ring))] rw [FiniteDesign.E_sum] refine Finset.sum_congr rfl (fun c _ => ?_) rw [FiniteDesign.E_const_mul _ (y1 c / p c) (treatInd c)] have hE : (bernoulliDesign p hp0 hp1).E (treatInd c) = p c := by -- `simp` no longer eta-expands the partially applied `treatInd c`, so state the -- goal in the applied form (defeq) and rewrite there. show (bernoulliDesign p hp0 hp1).E (fun z => (fun b => if b then (1 : ℝ) else 0) (z c)) = p c rw [bernoulliDesign_E_treatInd p hp0 hp1 c (fun b => if b then (1 : ℝ) else 0)] norm_num rw [hE] exact div_mul_cancel₀ (y1 c) (hppos c).ne' -
E_htControlTotaltheorem — The HT control total is unbiased for the control-arm population total ∑ y0 c: each cluster is a control with probability 1 − p c, undone by the weight 1 / (1 − p c).hypothesesp y0 :C → ℝhp0 :∀ c, 0 ≤ p chp1 :∀ c, p c ≤ 1hp1' :∀ c, p c < 1conclusion(clusterDesign p hp0 hp1).E (htControlTotal p y0) = ∑ c, y0 cProof (Lean source)
theorem E_htControlTotal (p y0 : C → ℝ) (hp0 : ∀ c, 0 ≤ p c) (hp1 : ∀ c, p c ≤ 1) (hp1' : ∀ c, p c < 1) : (clusterDesign p hp0 hp1).E (htControlTotal p y0) = ∑ c, y0 c := by have hone : ∀ c, (bernoulliDesign p hp0 hp1).E (fun z => 1 - treatInd c z) = 1 - p c := by intro c rw [show (fun z => (1 : ℝ) - treatInd c z) = (fun z => (fun _ => (1 : ℝ)) z - treatInd c z) from rfl, FiniteDesign.E_sub, FiniteDesign.E_const] have hE : (bernoulliDesign p hp0 hp1).E (treatInd c) = p c := by -- `simp` no longer eta-expands the partially applied `treatInd c`, so state the -- goal in the applied form (defeq) and rewrite there. show (bernoulliDesign p hp0 hp1).E (fun z => (fun b => if b then (1 : ℝ) else 0) (z c)) = p c rw [bernoulliDesign_E_treatInd p hp0 hp1 c (fun b => if b then (1 : ℝ) else 0)] norm_num rw [hE] change (bernoulliDesign p hp0 hp1).E (fun z => ∑ c, (1 - treatInd c z) / (1 - p c) * y0 c) = ∑ c, y0 c rw [show (fun z => ∑ c, (1 - treatInd c z) / (1 - p c) * y0 c) = (fun z => ∑ c, y0 c / (1 - p c) * (1 - treatInd c z)) from funext (fun z => Finset.sum_congr rfl (fun c _ => by ring))] rw [FiniteDesign.E_sum] refine Finset.sum_congr rfl (fun c _ => ?_) rw [FiniteDesign.E_const_mul _ (y0 c / (1 - p c)) (fun z => 1 - treatInd c z), hone c] exact div_mul_cancel₀ (y0 c) (sub_ne_zero.mpr (hp1' c).ne')
FinitePopulationMoments 6 core · 0 supporting Worked application of the complete-randomization design to Li & Ding (2017), "General Forms of Finite Population Central Limit Theorems with Applications to Causal Inference" (JASA). ★ sampleMean★ E_sampleMean★ Var_sampleMean
Li & Ding (2017): finite-population moments of the simple-random-sampling mean
Worked application of the complete-randomization design to Li & Ding (2017), "General Forms of
Finite Population Central Limit Theorems with Applications to Causal Inference" (JASA). Their
foundational object (Theorem 1, after Hájek 1960) is the average ȳ_S = (1/n) ∑_{i∈S} y_i of a
simple random sample S of size n drawn from a fixed finite population Π_N = {y_1,…,y_N} —
which is exactly the completeRandomization design on size-n subsets. This file proves the two
exact finite-sample moments that the Hájek central limit theorem is stated about:
* the sample mean is unbiased for the population mean, E[ȳ_S] = ȳ_N; and
* its randomization variance is the classical sampling-without-replacement (Cochran) formula
Var(ȳ_S) = (1/n − 1/N)·v_N, where v_N = (1/(N−1)) ∑ (y_i − ȳ_N)² is the finite-population
variance.
The Hájek CLT itself — (ȳ_S − ȳ_N)/√Var(ȳ_S) ⇝ N(0,1) under the Lindeberg-type condition
m_N/(v_N·min(n,N−n)) → 0, where m_N = maxᵢ (y_i − ȳ_N)² — is the asymptotic result built on
these moments. This module formalizes the finite-population moments and the maximal-deviation
quantity popMaxSqDev; it does not formalize the sequence-level convergence-in-distribution
statement.
The finite-population mean ȳ_N = (1/N) ∑ y_i.
Definition (Lean source)
The finite-population variance v_N = (1/(N−1)) ∑ (y_i − ȳ_N)².
Definition (Lean source)
The maximum squared deviation m_N = maxᵢ (y_i − ȳ_N)² driving the Hájek CLT condition.
Definition (Lean source)
The simple-random-sample mean ȳ_S = (1/n) ∑_{i∈S} y_i of a size-n sample S.
Definition (Lean source)
Unbiasedness of the sample mean (Li & Ding 2017, Thm 1 moments). For a sample size that is positive and at most the population size, the mean of a simple random sample of that size, drawn without replacement from the finite population of outcomes y, is unbiased for the population mean: each unit is sampled with probability n/N, which the 1/n weight averages to 1/N.
Formal statement
Proof (Lean source)
Variance of the sample mean (Li & Ding 2017, Thm 1 / Cochran). For a sample size that is positive and at most the population size, when the population contains at least two units, the randomization variance of the simple-random-sample mean equals (1/n − 1/N)·v_N, the sampling-without-replacement variance.