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 Matched-pair designs organize units into pairs indexed by P, with the two members of each pair represented by positions Bool. ★ matchedPairDesign★ matchedPairDesign_E_mpTreatInd★ matchedPairDesign_E_mpTreatInd_within★ matchedPairDesign_E_mpTreatInd_cross
Matched-pair designs
Matched-pair designs organize units into pairs indexed by P, with the two members of each pair
represented by positions Bool. The assignment z p is a pair-level fair coin selecting the
treated position, so this is not independent assignment over the 2|P| units: each size-two stratum
treats exactly one unit.
This file defines the fair coin pairCoinDesign, the product design matchedPairDesign, and the
treatment indicator mpTreatInd. The main inclusion results prove within-pair exclusivity,
first-order inclusion probability 1/2, perfect within-pair negative dependence, and cross-pair
independence with joint probability 1/4.
The per-pair fair coin: true means the true position is treated, and false means the false position is treated.
Definition (Lean source)
The matched-pair design: each pair p independently treats one of its two positions by a fair coin. The assignment z p : Bool is the treated position in pair p; the other position is control. This is a size-two stratified design with one treated unit per stratum, represented in the smaller assignment space of treated positions rather than as independent unit-level assignments.
Definition (Lean source)
The treatment indicator of the unit at position b of pair p under assignment z: 1 if the coin selected position b, else 0.
Definition (Lean source)
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.conclusionProof (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.Proof (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 a fixed matched-pair randomization design, each unit is the position b : Bool of a pair p : P, with treated/control potential outcomes y1 p b and y0 p b. ★ sate★ matchedPairEstimator★ E_matchedPairEstimator
Matched-pair estimators
For a fixed matched-pair randomization design, each unit is the position b : Bool of a pair
p : P, with treated/control potential outcomes y1 p b and y0 p b. Under the matched-pair
design the coin z p selects the treated position in pair p; pairContribution records that
pair's observed treated-minus-control contrast y1 p (z p) - y0 p (!z p).
This file defines the sample average treatment effect sate, the matched-pair
difference-in-means estimator matchedPairEstimator, the per-pair expectation identity
E_pairContribution, and the unbiasedness theorem E_matchedPairEstimator for Bai's
matched-pair design.
The sample average treatment effect over the 2|P| units (both positions of every pair).
The observed treated-minus-control contribution of pair p under assignment z: the treated position is z p (outcome y1 p (z p)), the control position is ¬ z p (outcome y0 p (¬ z p)).
Definition (Lean source)
The matched-pair difference-in-means estimator: the average over pairs of the per-pair treated-minus-control contributions.
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.hypothesesy1 y0 :P → Bool → ℝp :Pconclusion(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 equals the sum of squared within-pair imbalances, scaled by 1/(4N²). ★ Var_matchedPairEstimator
Matched-pair estimator variance
For a fixed set of pairs, the matched-pair estimator's randomization variance equals the sum of
squared within-pair imbalances, scaled by 1/(4N²).
The main definition is pairImbalance, the difference across the two units in a pair of the unit
totals y1 + y0. The lemma Var_pairContribution computes the variance contribution of one
pair, and Var_matchedPairEstimator sums these independent pair contributions using
product-design independence. The file does not compare alternative pairings or prove an optimal
matching theorem.
The within-pair imbalance of pair p: the difference, between its two positions, of the unit totals y1 + y0. Good matching makes this small.
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).Proof (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