Experimentation.MatchedPairDesign
Worked application of the design-based randomization substrate to the fixed-pair matched-pair design from Bai (2022), "Optimality of Matched-Pair Designs in Randomized Controlled Trials" (American Economic Review).
MatchedPair 6 core · 2 supporting Bai's fixed matched-pair design organizes units into pairs and treats exactly one of each pair's two positions, selected by an independent fair coin. ★ matchedPairDesign_E_mpTreatInd★ matchedPairDesign_E_mpTreatInd_within★ matchedPairDesign_E_mpTreatInd_cross
Matched-pair designs
Bai's fixed matched-pair design organizes units into pairs and treats exactly one of each pair's two positions, selected by an independent fair coin. It is therefore a product across pairs, not independent assignment across all units.
This file defines the pair-level coin, the product design, and its treatment indicator. The main
inclusion results give treatment probability 1/2, perfect negative dependence within a pair,
and independence across pairs with joint treatment probability 1/4. The file fixes the pairing;
it does not compare pairings or prove an optimal matching theorem.
The per-pair fair-coin randomization design assigns probability one half to each of the two positions: one outcome selects the first position for treatment and the other selects the second position.
Definition (Lean source)
For a finite collection of pair labels with decidable identity, the matched-pair randomization design independently draws a fair coin for every pair and treats the position selected by that coin, leaving the other position as control. This is a size-two stratified design with one treated unit in each pair rather than independent assignment over all units.
Definition (Lean source)
For a pair label, one of its two positions, and an assignment selecting a treated position in every pair, the treatment indicator for that unit equals one when the assignment selects that position and zero otherwise.
First-order inclusion probability. Under the matched-pair design, the unit occupying position b of pair p is treated with probability 1/2.
Formal statement
Proof (Lean source)
Within-pair negative dependence. Under the matched-pair design, the two units of pair p are never treated together, so the expectation of the product of their treatment indicators is zero — perfect negative dependence.
Formal statement
Proof (Lean source)
Cross-pair independence. For pairs p and p' that are distinct, the probability that position b of p and position b' of p' are treated simultaneously equals ¼ — units in distinct pairs are treated independently, and each position is treated with probability ½, so the joint probability factors as ½ · ½.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
matchedPairDesign_eq_prod_pairCoinlemma — The matched-pair design is the product of the independent pair-level fair coins.hypothesesP :sharedType u_1conclusionProof (Lean source)
lemma matchedPairDesign_eq_prod_pairCoin : matchedPairDesign (P := P) = prodDesign (fun _ : P => pairCoinDesign) := rfl -
mpTreatInd_withinlemma — Within-pair exclusivity. Exactly one position of each pair is treated: the two units' indicators sum to one on every assignment.hypothesesconclusionProof (Lean source)
lemma mpTreatInd_within (p : P) (z : P → Bool) : mpTreatInd p true z + mpTreatInd p false z = 1 := by unfold mpTreatInd cases z p <;> simp
Estimator 4 core · 1 supporting For Bai's fixed matched-pair randomization design, a fair coin selects the treated position in each pair. ★ sate★ matchedPairEstimator★ E_matchedPairEstimator
Matched-pair estimators
For Bai's fixed matched-pair randomization design, a fair coin selects the treated position in each pair. The difference-in-means estimator averages the observed treated-minus-control contrast over pairs, while the sample average treatment effect averages both potential-outcome contrasts over all units.
This file defines those two averages and proves that the estimator is unbiased for the sample average treatment effect. The proof reduces to the one-pair marginal of the product design: each pair's observed contrast has expectation equal to that pair's average treatment effect.
For a finite collection of pairs and the treated and control potential outcomes of every position in every pair, the sample average treatment effect is the sum, over both positions of all pairs, of the treated potential outcome minus the control potential outcome, divided by twice the number of pairs, with a zero denominator understood to yield zero.
Definition (Lean source)
For the treated and control potential outcomes of every position in every pair, a particular pair, and an assignment selecting a treated position in every pair, the observed treated-minus-control contribution of that pair is its treated potential outcome at the selected position minus its control potential outcome at the other position.
For a finite collection of pairs, the treated and control potential outcomes of every position in every pair, and an assignment selecting a treated position in every pair, the matched-pair difference-in-means estimator is the sum of the observed treated-minus-control contributions across pairs divided by the number of pairs, with a zero denominator understood to yield zero.
Definition (Lean source)
Unbiasedness of the matched-pair estimator. Provided there is at least one pair, under the matched-pair design the difference-in-means estimator is unbiased for the sample average treatment effect.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
E_pairContributionlemma — The expected per-pair contribution is pair p's average treatment effect ½ ∑_b (y1 p b − y0 p b) — the fair coin gives each position probability ½ of being treated.hypothesesconclusion(matchedPairDesign (P := P)).E (pairContribution y1 y0 p) = (∑ b, (y1 p b - y0 p b)) / 2Proof (Lean source)
lemma E_pairContribution (y1 y0 : P → Bool → ℝ) (p : P) : (matchedPairDesign (P := P)).E (pairContribution y1 y0 p) = (∑ b, (y1 p b - y0 p b)) / 2 := by change (prodDesign (fun k : P => coinDesign ((fun _ : P => (1 : ℝ) / 2) k) (by norm_num) (by norm_num))).E (fun z => (fun c : Bool => y1 p c - y0 p (!c)) (z p)) = (∑ b, (y1 p b - y0 p b)) / 2 rw [FiniteDesign.E_prod_apply (fun k : P => coinDesign ((fun _ : P => (1 : ℝ) / 2) k) (by norm_num) (by norm_num)) p (fun c : Bool => y1 p c - y0 p (!c)), coinDesign_E] rw [Fintype.sum_bool] norm_num ring
Variance 2 core · 1 supporting For a fixed set of pairs, the matched-pair estimator's randomization variance is Var(τ̂) = (1 / 4N²) ∑ₚ ((y1 p true + y0 p true) − (y1 p false + y0 p false))². ★ Var_matchedPairEstimator
Matched-pair estimator variance
For a fixed set of pairs, the matched-pair estimator's randomization variance is
Var(τ̂) = (1 / 4N²) ∑ₚ ((y1 p true + y0 p true) − (y1 p false + y0 p false))².
The quantity inside each square is the within-pair imbalance in the units' treated-plus-control outcome totals. This file computes the fair-coin variance of one pair and sums the independent pair contributions through product-design independence. It treats the pairing as fixed and does not prove that one pairing is optimal among alternatives.
For the treated and control potential outcomes of every position in every pair and a particular pair, the within-pair imbalance is the difference between the two positions in the sum of their treated and control potential outcomes.
Variance of the matched-pair estimator. Under the matched-pair design, the difference-in-means estimator built from potential outcomes y1 and y0 has randomization variance equal to 1/(4N²) times the sum of squared within-pair imbalances.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
Var_pairContributionlemma — The variance of a single pair's contribution is ¼ times its squared within-pair imbalance — the variance of the fair two-point random variable y1 p (z p) − y0 p (¬ z p).hypothesesconclusion= (pairImbalance y1 y0 p) ^ 2 / 4Proof (Lean source)
lemma Var_pairContribution (y1 y0 : P → Bool → ℝ) (p : P) : (matchedPairDesign (P := P)).Var (pairContribution y1 y0 p) = (pairImbalance y1 y0 p) ^ 2 / 4 := by change (prodDesign (fun k : P => coinDesign ((fun _ : P => (1 : ℝ) / 2) k) (by norm_num) (by norm_num))).Var (fun z => (fun c : Bool => y1 p c - y0 p (!c)) (z p)) = (pairImbalance y1 y0 p) ^ 2 / 4 rw [FiniteDesign.Var_prod_apply (fun k : P => coinDesign ((fun _ : P => (1 : ℝ) / 2) k) (by norm_num) (by norm_num)) p (fun c : Bool => y1 p c - y0 p (!c))] rw [FiniteDesign.Var_eq] rw [coinDesign_E, coinDesign_E] unfold pairImbalance norm_num ring