Documentation

CslibFrontier.Probability.HypothesisSelection.LeCamBirge

Robust Le Cam–Birgé and Scheffé pairwise tests #

This module constructs robust pairwise hypothesis tests between finite discrete distributions:

  1. Hellinger Le Cam–Birgé test (leCamBirgeTest): compares the product of clipped midpoint likelihood-ratio square roots birgeWeight q₀ q₁ (x i) = √((q₀ + 2 q₁) / (2 q₀ + q₁)) against threshold 1. Unlike the bare likelihood ratio q₀^n ≤ q₁^n, birgeWeight takes values in [1 / √2, √2] everywhere, making it robust under arbitrary Hellinger perturbations: under any unknown distribution p with 10 * h(p, q₀) ≤ h(q₀, q₁) (in particular h(p, q₀) ≤ r when 10 * r ≤ h(q₀, q₁)), the probability of rejecting q₀ is at most Real.exp (-n * h²(q₀, q₁) / 25) (this 1/3–2/3 clipped birgeWeight formulation and its explicit constants are proved in this library; see [LC73] and [Bir83] as background).
  2. Total-variation Scheffé test (scheffeTest): compares the empirical mass of the Scheffé set scheffeSet q₀ q₁ = {a | q₁(a) < q₀(a)} against the midpoint (q₀(A) + q₁(A)) / 2. Under any distribution p with dist p q₀ + γ ≤ dist q₀ q₁ / 2 (in particular dist p q₀ ≤ r and 3 * r + 2 * γ ≤ dist p q₁), the error probability is at most Real.exp (-2 * n * γ ^ 2) (this Hoeffding-based formulation and proof are this library's formulation; see [DL01] as background).

Main definitions #

Main results #

References #

noncomputable def Cslib.Probability.HypothesisSelection.birgeWeight {α : Type u_1} (q₀ q₁ : PMF α) (a : α) :

Clipped midpoint likelihood-ratio square root used by Le Cam and Birgé's pairwise Hellinger test: √((q₀(a) + 2 q₁(a)) / (2 q₀(a) + q₁(a))), defaulting to 1 when both distributions vanish at a. It always lies in [1 / √2, √2].

theorem Cslib.Probability.HypothesisSelection.birgeWeight_eq {α : Type u_1} (q₀ q₁ : PMF α) (a : α) :
birgeWeight q₀ q₁ a = if 2 * (q₀ a).toReal + (q₁ a).toReal = 0 then 1 else √(((q₀ a).toReal + 2 * (q₁ a).toReal) / (2 * (q₀ a).toReal + (q₁ a).toReal))

Explicit formula for birgeWeight q₀ q₁ a in terms of q₀ a and q₁ a.

theorem Cslib.Probability.HypothesisSelection.birgeWeight_pos {α : Type u_1} (q₀ q₁ : PMF α) (a : α) :
0 < birgeWeight q₀ q₁ a

Positivity of birgeWeight q₀ q₁ a.

theorem Cslib.Probability.HypothesisSelection.birgeWeight_le_sqrt_two {α : Type u_1} (q₀ q₁ : PMF α) (a : α) :
birgeWeight q₀ q₁ a ≤ √2

Upper bound birgeWeight q₀ q₁ a ≤ √2.

theorem Cslib.Probability.HypothesisSelection.birgeWeight_symm {α : Type u_1} (q₀ q₁ : PMF α) (a : α) :
birgeWeight q₁ q₀ a = (birgeWeight q₀ q₁ a)⁻¹

Swapping q₀ and q₁ inverts birgeWeight q₀ q₁ a.

theorem Cslib.Probability.HypothesisSelection.inv_sqrt_two_le_birgeWeight {α : Type u_1} (q₀ q₁ : PMF α) (a : α) :
(√2)⁻¹ ≤ birgeWeight q₀ q₁ a

Lower bound 1 / √2 ≤ birgeWeight q₀ q₁ a.

theorem Cslib.Probability.HypothesisSelection.sum_mul_birgeWeight_le {α : Type u_1} [Fintype α] (p q₀ q₁ : PMF α) :
∑ a : α, (p a).toReal * birgeWeight q₀ q₁ a ≤ 1 - PMF.hellingerSq q₀ q₁ / 4 + 2 * (√2 - 1) * PMF.hellingerSq p q₀ + 2 * PMF.hellingerDist p q₀ * PMF.hellingerDist q₀ q₁

General Hellinger drift bound for birgeWeight under an arbitrary distribution p: ∑ a, p(a) * birgeWeight q₀ q₁ a ≤ 1 - h²(q₀, q₁) / 4 + 2 (√2 - 1) h²(p, q₀) + 2 h(p, q₀) h(q₀, q₁).

theorem Cslib.Probability.HypothesisSelection.sum_mul_birgeWeight_le_of_mul {α : Type u_1} [Fintype α] {p q₀ q₁ : PMF α} (hsep : 10 * PMF.hellingerDist p q₀ ≤ PMF.hellingerDist q₀ q₁) :
∑ a : α, (p a).toReal * birgeWeight q₀ q₁ a ≤ 1 - PMF.hellingerSq q₀ q₁ / 25

Robust Hellinger-ball drift bound: whenever 10 * hellingerDist p q₀ ≤ hellingerDist q₀ q₁, ∑ a, (p a).toReal * birgeWeight q₀ q₁ a ≤ 1 - hellingerSq q₀ q₁ / 25.

theorem Cslib.Probability.HypothesisSelection.toOuterMeasure_iid_birgeWeight_ge_one_le {α : Type u_1} [Fintype α] (p q₀ q₁ : PMF α) (n : ℕ) :
((PMF.iid p n).toOuterMeasure {x : Fin n → α | 1 ≤ ∏ i : Fin n, birgeWeight q₀ q₁ (x i)}).toReal ≤ (∑ a : α, (p a).toReal * birgeWeight q₀ q₁ a) ^ n

Markov bound for the product of Birgé weights over n i.i.d. draws from p.

noncomputable def Cslib.Probability.HypothesisSelection.leCamBirgeTest {α : Type u_1} {n : ℕ} (q₀ q₁ : PMF α) (x : Fin n → α) :

Le Cam–Birgé pairwise Hellinger test: outputs true (favoring q₀) iff ∏ i, birgeWeight q₀ q₁ (x i) < 1, and false (favoring q₁) otherwise.

theorem Cslib.Probability.HypothesisSelection.leCamBirgeTest_false_le {α : Type u_1} [Finite α] {p q₀ q₁ : PMF α} (hsep : 10 * PMF.hellingerDist p q₀ ≤ PMF.hellingerDist q₀ q₁) (n : ℕ) :
((PMF.iid p n).toOuterMeasure {x : Fin n → α | leCamBirgeTest q₀ q₁ x = false}).toReal ≤ Real.exp (-↑n * PMF.hellingerSq q₀ q₁ / 25)

Type-I robustness of leCamBirgeTest: if p is close to q₀ relative to the separation h(q₀, q₁) (10 * h(p, q₀) ≤ h(q₀, q₁)), then leCamBirgeTest q₀ q₁ rejects q₀ with probability at most Real.exp (-n * h²(q₀, q₁) / 25).

theorem Cslib.Probability.HypothesisSelection.leCamBirgeTest_true_le {α : Type u_1} [Finite α] {p q₀ q₁ : PMF α} (hsep : 10 * PMF.hellingerDist p q₁ ≤ PMF.hellingerDist q₀ q₁) (n : ℕ) :
((PMF.iid p n).toOuterMeasure {x : Fin n → α | leCamBirgeTest q₀ q₁ x = true}).toReal ≤ Real.exp (-↑n * PMF.hellingerSq q₀ q₁ / 25)

Type-II robustness of leCamBirgeTest: if 10 * h(p, q₁) ≤ h(q₀, q₁), then leCamBirgeTest q₀ q₁ accepts q₀ (= true) with probability at most Real.exp (-n * h²(q₀, q₁) / 25).

theorem Cslib.Probability.HypothesisSelection.leCamBirgeTest_false_le_of_radius {α : Type u_1} [Finite α] {p q₀ q₁ : PMF α} {r : ℝ} (hr : 0 ≤ r) (hp : PMF.hellingerDist p q₀ ≤ r) (hsep : 10 * r ≤ PMF.hellingerDist q₀ q₁) (n : ℕ) :
((PMF.iid p n).toOuterMeasure {x : Fin n → α | leCamBirgeTest q₀ q₁ x = false}).toReal ≤ Real.exp (-4 * ↑n * r ^ 2)

Radius specialization of leCamBirgeTest_false_le: if h(p, q₀) ≤ r and 10 * r ≤ h(q₀, q₁), the rejection probability is at most Real.exp (-4 * n * r ^ 2).

theorem Cslib.Probability.HypothesisSelection.leCamBirgeTest_true_le_of_radius {α : Type u_1} [Finite α] {p q₀ q₁ : PMF α} {r : ℝ} (hr : 0 ≤ r) (hp : PMF.hellingerDist p q₁ ≤ r) (hsep : 10 * r ≤ PMF.hellingerDist q₀ q₁) (n : ℕ) :
((PMF.iid p n).toOuterMeasure {x : Fin n → α | leCamBirgeTest q₀ q₁ x = true}).toReal ≤ Real.exp (-4 * ↑n * r ^ 2)

Radius specialization of leCamBirgeTest_true_le: if h(p, q₁) ≤ r and 10 * r ≤ h(q₀, q₁), the false-acceptance probability is at most Real.exp (-4 * n * r ^ 2).

noncomputable def Cslib.Probability.HypothesisSelection.scheffeSet {α : Type u_1} [Fintype α] (q₀ q₁ : PMF α) :

The Scheffé witness set {a | q₁ a < q₀ a} separating two distributions q₀ and q₁.

A distribution's Scheffé set against itself is empty.

theorem Cslib.Probability.HypothesisSelection.scheffeSet_sub_eq_dist {α : Type u_1} [Fintype α] (q₀ q₁ : PMF α) :
(q₀.toOuterMeasure ↑(scheffeSet q₀ q₁)).toReal - (q₁.toOuterMeasure ↑(scheffeSet q₀ q₁)).toReal = dist q₀ q₁

Scheffé's identity: the probability gap on scheffeSet q₀ q₁ equals dist q₀ q₁.

noncomputable def Cslib.Probability.HypothesisSelection.empiricalMass {α : Type u_1} [DecidableEq α] (A : Finset α) {n : ℕ} (x : Fin n → α) :

Empirical mass assigned to A : Finset α by a sample tuple x : Fin n → α.

theorem Cslib.Probability.HypothesisSelection.toOuterMeasure_empiricalMass_le_sub_le {α : Type u_1} [Finite α] [DecidableEq α] (p : PMF α) (A : Finset α) (n : ℕ) {γ : ℝ} (hγ : 0 ≤ γ) :
((PMF.iid p n).toOuterMeasure {x : Fin n → α | empiricalMass A x ≤ (p.toOuterMeasure ↑A).toReal - γ}).toReal ≤ Real.exp (-2 * ↑n * γ ^ 2)

Lower-tail Hoeffding concentration for empiricalMass A x.

theorem Cslib.Probability.HypothesisSelection.toOuterMeasure_add_le_empiricalMass_le {α : Type u_1} [Finite α] [DecidableEq α] (p : PMF α) (A : Finset α) (n : ℕ) {γ : ℝ} (hγ : 0 ≤ γ) :
((PMF.iid p n).toOuterMeasure {x : Fin n → α | (p.toOuterMeasure ↑A).toReal + γ ≤ empiricalMass A x}).toReal ≤ Real.exp (-2 * ↑n * γ ^ 2)

Upper-tail Hoeffding concentration for empiricalMass A x.

theorem Cslib.Probability.HypothesisSelection.abs_empiricalMass_sub_ge_le {α : Type u_1} [Finite α] [DecidableEq α] (p : PMF α) (A : Finset α) (n : ℕ) {γ : ℝ} (hγ : 0 ≤ γ) :
((PMF.iid p n).toOuterMeasure {x : Fin n → α | γ ≤ |empiricalMass A x - (p.toOuterMeasure ↑A).toReal|}).toReal ≤ 2 * Real.exp (-2 * ↑n * γ ^ 2)

Two-sided Hoeffding concentration for empiricalMass A x: P^{\otimes n}(γ ≤ |empiricalMass A x - p(A)|) ≤ 2 * Real.exp (-2 * n * γ ^ 2).

noncomputable def Cslib.Probability.HypothesisSelection.scheffeTest {α : Type u_1} [Fintype α] [DecidableEq α] (q₀ q₁ : PMF α) {n : ℕ} (x : Fin n → α) :

Pairwise Scheffé TV test between q₀ and q₁: outputs true (favoring q₀) iff the empirical frequency of scheffeSet q₀ q₁ is at least (q₀(A) + q₁(A)) / 2.

theorem Cslib.Probability.HypothesisSelection.scheffeTest_false_le {α : Type u_1} [Fintype α] [DecidableEq α] {p q₀ q₁ : PMF α} {γ : ℝ} (hγ : 0 ≤ γ) (hsep : dist p q₀ + γ ≤ dist q₀ q₁ / 2) (n : ℕ) :
((PMF.iid p n).toOuterMeasure {x : Fin n → α | scheffeTest q₀ q₁ x = false}).toReal ≤ Real.exp (-2 * ↑n * γ ^ 2)

Robust Type-I bound for scheffeTest: under any p with dist p q₀ + γ ≤ dist q₀ q₁ / 2, the probability of outputting false is at most Real.exp (-2 * n * γ ^ 2).

theorem Cslib.Probability.HypothesisSelection.scheffeTest_true_le {α : Type u_1} [Fintype α] [DecidableEq α] {p q₀ q₁ : PMF α} {γ : ℝ} (hγ : 0 ≤ γ) (hsep : dist p q₁ + γ ≤ dist q₀ q₁ / 2) (n : ℕ) :
((PMF.iid p n).toOuterMeasure {x : Fin n → α | scheffeTest q₀ q₁ x = true}).toReal ≤ Real.exp (-2 * ↑n * γ ^ 2)

Robust Type-II bound for scheffeTest: under any p with dist p q₁ + γ ≤ dist q₀ q₁ / 2, the probability of outputting true is at most Real.exp (-2 * n * γ ^ 2).