Stat.Nonparametric.Local­Poly.Estimator­Risk

Pointwise-risk assembly for local-polynomial estimators, including density constants, leverage bounds, conditional MSE factorization, and unconditional risk lifts.

Density­Constants 2 core · 5 supporting The bandwidth-free kernel shape matrix T_{jk} = ∫ K(u) u^{j+k} p(t+hu) du is the positive-density-weighted Gram matrix of the centered monomials, and the pure kernel-moment matrix G_{jk} = ∫ K(u) u^{j+k} du is its unit-d ★ weightMomentMatrix_quadForm_sandwich

Density constants for the local-polynomial kernel shape matrix

The bandwidth-free kernel shape matrix T_{jk} = ∫ K(u) u^{j+k} p(t+hu) du is the positive-density-weighted Gram matrix of the centered monomials, and the pure kernel-moment matrix G_{jk} = ∫ K(u) u^{j+k} du is its unit-density analogue. This file:

* defines weightMomentMatrix p W — the moment matrix ∫ W(u) u^{j+k} du of an arbitrary weight W : ℝ → ℝ, with its Gram quadratic form vᵀ (weightMomentMatrix p W) v = ∫ W(u) (∑ vⱼ uʲ)² du; * proves the Loewner sandwich c·G ⪯ T ⪯ C·G (on quadratic forms) from a pointwise weight domination c·W_G ≤ W_T ≤ C·W_G, which in turn follows from the design-density window bound cDesign ≤ p ≤ CDesign (the kernel weight K ≥ 0 carries the densities); * combines the sandwich with SquareCompletion.inv00_le_of_quadForm_sandwich to bound the shape matrix's intercept leverage and top weight by the density constants:

(T⁻¹)₀₀ ≤ (G⁻¹)₀₀ / cDesign, T₀₀ ≤ CDesign · G₀₀.

These discharge the (T⁻¹)₀₀ ≤ cInv and T₀₀ ≤ cTop hypotheses fed to population_scaling_of_conj, leaving no S-level invertibility/leverage assumption.

def weightMomentMatrix reviewed
Causalean.Stat.Nonparametric

The weight-W moment matrix (weightMomentMatrix p W)_{jk} = ∫ W(u) · u^j · u^k du of the centered monomials against the Lebesgue weight W. With W = K · (p ∘ (t + h·)) this is the kernel shape matrix T; with W = K it is the pure kernel-moment matrix G.

Definition (Lean source)
noncomputable def weightMomentMatrix (p : ℕ) (W : ℝ → ℝ) : Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ := of (fun j k => ∫ u, W u * (u ^ (j : ℕ) * u ^ (k : ℕ)))
theorem weightMomentMatrix_quadForm_sandwich reviewed
Causalean.Stat.Nonparametric

Loewner sandwich on quadratic forms from pointwise weight domination. Let WT and WG be weight functions and c a nonnegative scalar. If every centered-monomial integrand built from WT is integrable and the same holds for WG, and if the weights obey the pointwise domination c · WG(u) ≤ WT(u) for every u, then for every coefficient vector v the shape-matrix quadratic form dominates c times the pure-matrix quadratic form: c · (vᵀ G v) ≤ vᵀ T v, where T = weightMomentMatrix p WT and G = weightMomentMatrix p WG.

Formal statement
WT WG :
ℝ → ℝ
c :
hc :
0 ≤ c
hintT :
∀ j k : Fin (p + 1), Integrable (fun u => WT u * (u ^ (j : ℕ) * u ^ (k : ℕ)))
hintG :
∀ j k : Fin (p + 1), Integrable (fun u => WG u * (u ^ (j : ℕ) * u ^ (k : ℕ)))
hdom :
∀ u, c * WG u ≤ WT u
v :
Fin (p + 1) → ℝ
c * (v ⬝ᵥ (weightMomentMatrix p WG *ᵥ v)) ≤ v ⬝ᵥ (weightMomentMatrix p WT *ᵥ v)
Proof (Lean source)
theorem weightMomentMatrix_quadForm_sandwich {WT WG : ℝ → ℝ} {c : ℝ} (hc : 0 ≤ c) (hintT : ∀ j k : Fin (p + 1), Integrable (fun u => WT u * (u ^ (j : ℕ) * u ^ (k : ℕ)))) (hintG : ∀ j k : Fin (p + 1), Integrable (fun u => WG u * (u ^ (j : ℕ) * u ^ (k : ℕ)))) (hdom : ∀ u, c * WG u ≤ WT u) (v : Fin (p + 1) → ℝ) : c * (v ⬝ᵥ (weightMomentMatrix p WG *ᵥ v)) ≤ v ⬝ᵥ (weightMomentMatrix p WT *ᵥ v) := by have _hc := hc let s : ℝ → ℝ := fun u => ∑ j : Fin (p + 1), v j * u ^ (j : ℕ) have hsqG : Integrable (fun u => WG u * (s u) ^ 2) := by have e : (fun u => WG u * (s u) ^ 2) = (fun u => ∑ j : Fin (p + 1), ∑ k : Fin (p + 1), (v j * v k) * (WG u * (u ^ (j : ℕ) * u ^ (k : ℕ)))) := by funext u dsimp [s] rw [pow_two, Finset.sum_mul_sum] rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro j _ rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro k _ ring rw [e] exact integrable_finset_sum _ (fun j _ => integrable_finset_sum _ (fun k _ => (hintG j k).const_mul (v j * v k))) have hsqT : Integrable (fun u => WT u * (s u) ^ 2) := by have e : (fun u => WT u * (s u) ^ 2) = (fun u => ∑ j : Fin (p + 1), ∑ k : Fin (p + 1), (v j * v k) * (WT u * (u ^ (j : ℕ) * u ^ (k : ℕ)))) := by funext u dsimp [s] rw [pow_two, Finset.sum_mul_sum] rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro j _ rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro k _ ring rw [e] exact integrable_finset_sum _ (fun j _ => integrable_finset_sum _ (fun k _ => (hintT j k).const_mul (v j * v k))) rw [weightMomentMatrix_quadForm hintG v, weightMomentMatrix_quadForm hintT v] change c * (∫ u, WG u * (s u) ^ 2) ≤ ∫ u, WT u * (s u) ^ 2 rw [← MeasureTheory.integral_const_mul c (fun u => WG u * (s u) ^ 2)] exact MeasureTheory.integral_mono (hsqG.const_mul c) hsqT (fun u => by calc c * (WG u * (s u) ^ 2) = (c * WG u) * (s u) ^ 2 := by ring _ ≤ WT u * (s u) ^ 2 := mul_le_mul_of_nonneg_right (hdom u) (sq_nonneg _))
Causalean.Stat.Nonparametric.weightMomentMatrix_quadForm_sandwich · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/DensityConstants.lean:111 · uses weightMomentMatrix
5 supporting declarations (lemmas, instances)
  • weightMomentMatrix_quadForm theorem — Gram quadratic form of the weight moment matrix. vᵀ (weightMomentMatrix p W) v = ∫ W(u) (∑ⱼ vⱼ uʲ)² du.
    W :
    ℝ → ℝ
    hint :
    ∀ j k : Fin (p + 1), Integrable (fun u => W u * (u ^ (j : ℕ) * u ^ (k : ℕ)))
    v :
    Fin (p + 1) → ℝ
    v ⬝ᵥ (weightMomentMatrix p W *ᵥ v) = ∫ u, W u * (∑ j, v j * u ^ (j : ℕ)) ^ 2
    Proof (Lean source)
    theorem weightMomentMatrix_quadForm {W : ℝ → ℝ} (hint : ∀ j k : Fin (p + 1), Integrable (fun u => W u * (u ^ (j : ℕ) * u ^ (k : ℕ)))) (v : Fin (p + 1) → ℝ) : v ⬝ᵥ (weightMomentMatrix p W *ᵥ v) = ∫ u, W u * (∑ j, v j * u ^ (j : ℕ)) ^ 2 := by simp only [dotProduct, mulVec, weightMomentMatrix, Matrix.of_apply] calc ∑ j : Fin (p + 1), v j * ∑ k : Fin (p + 1), (∫ u, W u * (u ^ (j : ℕ) * u ^ (k : ℕ))) * v k = ∑ j : Fin (p + 1), ∑ k : Fin (p + 1), (v j * v k) * ∫ u, W u * (u ^ (j : ℕ) * u ^ (k : ℕ)) := by refine Finset.sum_congr rfl ?_ intro j _ rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro k _ ring _ = ∑ j : Fin (p + 1), ∑ k : Fin (p + 1), ∫ u, (v j * v k) * (W u * (u ^ (j : ℕ) * u ^ (k : ℕ))) := by refine Finset.sum_congr rfl ?_ intro j _ refine Finset.sum_congr rfl ?_ intro k _ exact (MeasureTheory.integral_const_mul (v j * v k) (fun u => W u * (u ^ (j : ℕ) * u ^ (k : ℕ)))).symm _ = ∑ j : Fin (p + 1), ∫ u, ∑ k : Fin (p + 1), (v j * v k) * (W u * (u ^ (j : ℕ) * u ^ (k : ℕ))) := by refine Finset.sum_congr rfl ?_ intro j _ symm rw [MeasureTheory.integral_finset_sum] intro k _ exact (hint j k).const_mul (v j * v k) _ = ∫ u, ∑ j : Fin (p + 1), ∑ k : Fin (p + 1), (v j * v k) * (W u * (u ^ (j : ℕ) * u ^ (k : ℕ))) := by symm rw [MeasureTheory.integral_finset_sum] intro j _ exact integrable_finset_sum _ (fun k _ => (hint j k).const_mul (v j * v k)) _ = ∫ u, W u * (∑ j, v j * u ^ (j : ℕ)) ^ 2 := by exact MeasureTheory.integral_congr_ae (Filter.Eventually.of_forall (fun u => by change (∑ j : Fin (p + 1), ∑ k : Fin (p + 1), (v j * v k) * (W u * (u ^ (j : ℕ) * u ^ (k : ℕ)))) = W u * (∑ j : Fin (p + 1), v j * u ^ (j : ℕ)) ^ 2 rw [pow_two, Finset.sum_mul_sum] rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro j _ rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro k _ ring))
    Causalean.Stat.Nonparametric.weightMomentMatrix_quadForm · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/DensityConstants.lean:46
  • weightMomentMatrix_isHermitian theorem — The weight moment matrix is symmetric.
    W :
    ℝ → ℝ
    Proof (Lean source)
    theorem weightMomentMatrix_isHermitian {W : ℝ → ℝ} : (weightMomentMatrix p W).IsHermitian := by ext j k simp only [Matrix.conjTranspose_apply, weightMomentMatrix, Matrix.of_apply, star_trivial] exact MeasureTheory.integral_congr_ae (Filter.Eventually.of_forall (fun u => by ring))
    Causalean.Stat.Nonparametric.weightMomentMatrix_isHermitian · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/DensityConstants.lean:104
  • weightMomentMatrix_quadForm_sandwich_upper theorem — Loewner sandwich on quadratic forms, upper direction. If W_T(u) ≤ C · W_G(u) pointwise (C ≥ 0) and both monomial integrands are integrable, then vᵀ T v ≤ C · (vᵀ G v) for every v, where T = weightMomentMatrix p W_T, G = weightMomentMatrix p W_G.
    WT WG :
    ℝ → ℝ
    C :
    hC :
    0 ≤ C
    hintT :
    ∀ j k : Fin (p + 1), Integrable (fun u => WT u * (u ^ (j : ℕ) * u ^ (k : ℕ)))
    hintG :
    ∀ j k : Fin (p + 1), Integrable (fun u => WG u * (u ^ (j : ℕ) * u ^ (k : ℕ)))
    hdom :
    ∀ u, WT u ≤ C * WG u
    v :
    Fin (p + 1) → ℝ
    v ⬝ᵥ (weightMomentMatrix p WT *ᵥ v) ≤ C * (v ⬝ᵥ (weightMomentMatrix p WG *ᵥ v))
    Proof (Lean source)
    theorem weightMomentMatrix_quadForm_sandwich_upper {WT WG : ℝ → ℝ} {C : ℝ} (hC : 0 ≤ C) (hintT : ∀ j k : Fin (p + 1), Integrable (fun u => WT u * (u ^ (j : ℕ) * u ^ (k : ℕ)))) (hintG : ∀ j k : Fin (p + 1), Integrable (fun u => WG u * (u ^ (j : ℕ) * u ^ (k : ℕ)))) (hdom : ∀ u, WT u ≤ C * WG u) (v : Fin (p + 1) → ℝ) : v ⬝ᵥ (weightMomentMatrix p WT *ᵥ v) ≤ C * (v ⬝ᵥ (weightMomentMatrix p WG *ᵥ v)) := by have _hC := hC let s : ℝ → ℝ := fun u => ∑ j : Fin (p + 1), v j * u ^ (j : ℕ) have hsqT : Integrable (fun u => WT u * (s u) ^ 2) := by have e : (fun u => WT u * (s u) ^ 2) = (fun u => ∑ j : Fin (p + 1), ∑ k : Fin (p + 1), (v j * v k) * (WT u * (u ^ (j : ℕ) * u ^ (k : ℕ)))) := by funext u dsimp [s] rw [pow_two, Finset.sum_mul_sum] rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro j _ rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro k _ ring rw [e] exact integrable_finset_sum _ (fun j _ => integrable_finset_sum _ (fun k _ => (hintT j k).const_mul (v j * v k))) have hsqG : Integrable (fun u => WG u * (s u) ^ 2) := by have e : (fun u => WG u * (s u) ^ 2) = (fun u => ∑ j : Fin (p + 1), ∑ k : Fin (p + 1), (v j * v k) * (WG u * (u ^ (j : ℕ) * u ^ (k : ℕ)))) := by funext u dsimp [s] rw [pow_two, Finset.sum_mul_sum] rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro j _ rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro k _ ring rw [e] exact integrable_finset_sum _ (fun j _ => integrable_finset_sum _ (fun k _ => (hintG j k).const_mul (v j * v k))) rw [weightMomentMatrix_quadForm hintT v, weightMomentMatrix_quadForm hintG v] change (∫ u, WT u * (s u) ^ 2) ≤ C * (∫ u, WG u * (s u) ^ 2) rw [← MeasureTheory.integral_const_mul C (fun u => WG u * (s u) ^ 2)] exact MeasureTheory.integral_mono hsqT (hsqG.const_mul C) (fun u => by calc WT u * (s u) ^ 2 ≤ (C * WG u) * (s u) ^ 2 := mul_le_mul_of_nonneg_right (hdom u) (sq_nonneg _) _ = C * (WG u * (s u) ^ 2) := by ring)
    Causalean.Stat.Nonparametric.weightMomentMatrix_quadForm_sandwich_upper · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/DensityConstants.lean:168
  • kernelDensity_lower_dom theorem — Pointwise weight domination from the design-density window bound. If the kernel K is nonnegative and supported in [-1,1] and the design density p obeys cDesign ≤ p(a) for every a within bandwidth h of t, then cDesign · K(u) ≤ K(u) · p(t + h·u) for every u: on the support |u| ≤ 1 the argument t + h·u lies in the window, off the support both sides vanish.
    K pdens :
    ℝ → ℝ
    t h cDesign :
    hh :
    0 < h
    hKnn :
    ∀ u, 0 ≤ K u
    hKsupp :
    ∀ u
    if
    1 < |u|
    then
    K u = 0
    hlo :
    ∀ a
    if
    |a - t| ≤ h
    then
    cDesign ≤ pdens a
    ∀ u, cDesign * K u ≤ K u * pdens (t + h * u)
    Proof (Lean source)
    theorem kernelDensity_lower_dom {K pdens : ℝ → ℝ} {t h cDesign : ℝ} (hh : 0 < h) (hKnn : ∀ u, 0 ≤ K u) (hKsupp : ∀ u, 1 < |u| → K u = 0) (hlo : ∀ a, |a - t| ≤ h → cDesign ≤ pdens a) : ∀ u, cDesign * K u ≤ K u * pdens (t + h * u) := by intro u by_cases hu : |u| ≤ 1 · have hwin : |(t + h * u) - t| ≤ h := by calc |(t + h * u) - t| = |h * u| := by ring_nf _ = h * |u| := by rw [abs_mul, abs_of_pos hh] _ ≤ h * 1 := mul_le_mul_of_nonneg_left hu hh.le _ = h := by ring have hp : cDesign ≤ pdens (t + h * u) := hlo (t + h * u) hwin have := mul_le_mul_of_nonneg_right hp (hKnn u) linarith · have hlt : 1 < |u| := lt_of_not_ge hu have hK : K u = 0 := hKsupp u hlt simp [hK]
    Causalean.Stat.Nonparametric.kernelDensity_lower_dom · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/DensityConstants.lean:222
  • kernelDensity_upper_dom theorem — Pointwise weight domination, upper side. Same hypotheses with an upper density bound p(a) ≤ CDesign on the window give K(u) · p(t + h·u) ≤ CDesign · K(u) for every u.
    K pdens :
    ℝ → ℝ
    t h CDesign :
    hh :
    0 < h
    hKnn :
    ∀ u, 0 ≤ K u
    hKsupp :
    ∀ u
    if
    1 < |u|
    then
    K u = 0
    hhi :
    ∀ a
    if
    |a - t| ≤ h
    then
    pdens a ≤ CDesign
    ∀ u, K u * pdens (t + h * u) ≤ CDesign * K u
    Proof (Lean source)
    theorem kernelDensity_upper_dom {K pdens : ℝ → ℝ} {t h CDesign : ℝ} (hh : 0 < h) (hKnn : ∀ u, 0 ≤ K u) (hKsupp : ∀ u, 1 < |u| → K u = 0) (hhi : ∀ a, |a - t| ≤ h → pdens a ≤ CDesign) : ∀ u, K u * pdens (t + h * u) ≤ CDesign * K u := by intro u by_cases hu : |u| ≤ 1 · have hwin : |(t + h * u) - t| ≤ h := by calc |(t + h * u) - t| = |h * u| := by ring_nf _ = h * |u| := by rw [abs_mul, abs_of_pos hh] _ ≤ h * 1 := mul_le_mul_of_nonneg_left hu hh.le _ = h := by ring have hp : pdens (t + h * u) ≤ CDesign := hhi (t + h * u) hwin have := mul_le_mul_of_nonneg_right hp (hKnn u) linarith · have hlt : 1 < |u| := lt_of_not_ge hu have hK : K u = 0 := hKsupp u hlt simp [hK]
    Causalean.Stat.Nonparametric.kernelDensity_upper_dom · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/DensityConstants.lean:245
Factorization 2 core · 1 supporting The population design moment matrix of the interior local-polynomial fit at bandwidth h and target t, against a design law with Lebesgue density p, has entries S_{jk} = N · ∫ K((a−t)/h) · (a−t)^{j+k} · p(a) da. ★ popDesignMatrix_factor

Change-of-variables factorization of the population design moment matrix

The population design moment matrix of the interior local-polynomial fit at bandwidth h and target t, against a design law with Lebesgue density p, has entries

S_{jk} = N · ∫ K((a−t)/h) · (a−t)^{j+k} · p(a) da.

The substitution u = (a−t)/h (a = t + h·u, da = h·du) factors it as a diagonal conjugation of the bandwidth-free shape matrix T_{jk} = ∫ K(u) u^{j+k} p(t+h·u) du:

S_{jk} = N · h^{j+k+1} · T_{jk} = (N·h) · (D · T · D)_{jk}, D = diagonal (fun j => h^j).

This is the literal factorization consumed by population_scaling_of_conj: it exposes the Θ(Nh) scale and the bandwidth-free shape matrix T (whose density-constant leverage bounds come from DensityConstants). The change of variables reuses the affine-rescaling pattern of Approximation/Kernel.lean.

def popDesignMatrix reviewed
Causalean.Stat.Nonparametric

The population design moment matrix S_{jk} = N · ∫ K((a−t)/h) (a−t)^{j+k} p(a) da.

Definition (Lean source)
noncomputable def popDesignMatrix (p N : ℕ) (K pdens : ℝ → ℝ) (t h : ℝ) : Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ := of (fun j k => (N : ℝ) * ∫ a, K ((a - t) / h) * (a - t) ^ ((j : ℕ) + (k : ℕ)) * pdens a)
theorem popDesignMatrix_factor reviewed
Causalean.Stat.Nonparametric

Diagonal-conjugation factorization of the population moment matrix. For a positive bandwidth h > 0, writing T for the kernel shape matrix weightMomentMatrix p (fun u => K u · p(t+h·u)) and D for the diagonal matrix diagonal (fun j => h^j), the population design moment matrix factors as popDesignMatrix p N K pdens t h = (N·h) • (D · T · D). This is the literal S = (Nh)·(D T D) hypothesis of population_scaling_of_conj, proved by the single-entry change of variables popMomentEntry_changeOfVar.

Formal statement
N :
K pdens :
ℝ → ℝ
t h :
hh :
0 < h
popDesignMatrix p N K pdens t h
= ((N : ℝ) * h) • (diagonal (fun j : Fin (p + 1) => h ^ (j : ℕ)) * weightMomentMatrix p (fun u => K u * pdens (t + h * u)) * diagonal (fun j : Fin (p + 1) => h ^ (j : ℕ)))
Proof (Lean source)
theorem popDesignMatrix_factor (N : ℕ) (K pdens : ℝ → ℝ) (t h : ℝ) (hh : 0 < h) : popDesignMatrix p N K pdens t h = ((N : ℝ) * h) • (diagonal (fun j : Fin (p + 1) => h ^ (j : ℕ)) * weightMomentMatrix p (fun u => K u * pdens (t + h * u)) * diagonal (fun j : Fin (p + 1) => h ^ (j : ℕ))) := by ext j k simp only [popDesignMatrix, Matrix.of_apply, Matrix.smul_apply, smul_eq_mul, Matrix.diagonal_mul, Matrix.mul_diagonal, weightMomentMatrix] rw [popMomentEntry_changeOfVar K pdens t h hh ((j : ℕ) + (k : ℕ))] have hint : (∫ u, K u * u ^ ((j : ℕ) + (k : ℕ)) * pdens (t + h * u)) = ∫ u, (K u * pdens (t + h * u)) * (u ^ (j : ℕ) * u ^ (k : ℕ)) := by refine integral_congr_ae (Filter.Eventually.of_forall (fun u => ?_)) ring rw [hint] ring
1 supporting declaration (lemmas, instances)
  • popMomentEntry_changeOfVar theorem — Change of variables for a single moment entry. For h > 0, ∫ a, K((a−t)/h) · (a−t)^m · p(a) da = h^{m+1} · ∫ u, K(u) · u^m · p(t+h·u) du: the substitution a = t + h·u contributes the Jacobian h and turns (a−t)^m into (h·u)^m = h^m u^m.
    K pdens :
    ℝ → ℝ
    t h :
    hh :
    0 < h
    m :
    (∫ a, K ((a - t) / h) * (a - t) ^ m * pdens a)
    = h ^ (m + 1) * ∫ u, K u * u ^ m * pdens (t + h * u)
    Proof (Lean source)
    theorem popMomentEntry_changeOfVar (K pdens : ℝ → ℝ) (t h : ℝ) (hh : 0 < h) (m : ℕ) : (∫ a, K ((a - t) / h) * (a - t) ^ m * pdens a) = h ^ (m + 1) * ∫ u, K u * u ^ m * pdens (t + h * u) := by set ψ : ℝ → ℝ := fun a => K ((a - t) / h) * (a - t) ^ m * pdens a with hψ have hrescale : (∫ a, ψ a) = h * ∫ u, ψ (t + h * u) := by have hcv : (∫ u, ψ (t + h * u)) = h⁻¹ * ∫ a, ψ a := by calc (∫ u, ψ (t + h * u)) = ∫ u, (fun w => ψ (t + w)) (h * u) := rfl _ = |h⁻¹| • ∫ w, (fun w => ψ (t + w)) w := by simpa using Measure.integral_comp_mul_left (fun w : ℝ => ψ (t + w)) h _ = |h⁻¹| • ∫ w, ψ (t + w) := rfl _ = |h⁻¹| • ∫ a, ψ a := by rw [integral_add_left_eq_self ψ t] _ = h⁻¹ * ∫ a, ψ a := by rw [smul_eq_mul, abs_of_pos (inv_pos.mpr hh)] calc (∫ a, ψ a) = h * (h⁻¹ * ∫ a, ψ a) := by field_simp [hh.ne'] _ = h * ∫ u, ψ (t + h * u) := by rw [hcv] have hinner : (∫ u, ψ (t + h * u)) = h ^ m * ∫ u, K u * u ^ m * pdens (t + h * u) := by calc (∫ u, ψ (t + h * u)) = ∫ u, h ^ m * (K u * u ^ m * pdens (t + h * u)) := by refine integral_congr_ae (Filter.Eventually.of_forall (fun u => ?_)) simp only [hψ] rw [show t + h * u - t = h * u from by ring] rw [show (h * u) / h = u from by rw [mul_comm, mul_div_assoc, div_self hh.ne', mul_one]] rw [mul_pow] ring _ = h ^ m * ∫ u, K u * u ^ m * pdens (t + h * u) := by rw [MeasureTheory.integral_const_mul] calc (∫ a, K ((a - t) / h) * (a - t) ^ m * pdens a) = ∫ a, ψ a := rfl _ = h * ∫ u, ψ (t + h * u) := hrescale _ = h * (h ^ m * ∫ u, K u * u ^ m * pdens (t + h * u)) := by rw [hinner] _ = h ^ (m + 1) * ∫ u, K u * u ^ m * pdens (t + h * u) := by rw [pow_succ] ring
    Causalean.Stat.Nonparametric.popMomentEntry_changeOfVar · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/Factorization.lean:38
Density­Leverage 2 core · 0 supporting Turns local-polynomial leverage hypotheses into explicit density and kernel-moment constants. ★ localPoly_density_inv00_rate★ localPoly_density_leverage_bound

Density-constant discharge of the local-polynomial leverage rate

Turns local-polynomial leverage hypotheses into explicit density and kernel-moment constants.

This module turns the abstract population-matrix leverage hypotheses for an interior local-polynomial fit into explicit density and kernel-moment constants. The earlier LocalPoly.Rate.population_scaling_of_conj reduced the leverage scaling to a bandwidth-free shape matrix T with assumed (T⁻¹)₀₀ ≤ cInv and T₀₀ ≤ cTop; here those constants become explicit density + kernel-moment quantities:

cInv = (G⁻¹)₀₀ / cDesign, cTop = CDesign · G₀₀,

with G = weightMomentMatrix p K the pure kernel-moment matrix and density-window bounds supplying the needed lower bound for the inverse rate and both lower/upper bounds for the leverage product. The chain is:

popDesignMatrix_factor (S = (Nh)·D T D, change of variables) → DensityConstants ((T⁻¹)₀₀ ≤ (G⁻¹)₀₀/cDesign, T₀₀ ≤ CDesign·G₀₀ via Loewner sandwich) → diagonal-conjugation scaling ((S⁻¹)₀₀ ≤ cInv/(Nh), S₀₀ ≤ cTop·(Nh)) → localPoly_inv00_rate / localPoly_leverage_bound.

The resulting localPoly_density_inv00_rate and localPoly_density_leverage_bound carry no hypothesis on the population matrix S other than the good design event (M entrywise within η of S) and explicit small-perturbation scale constants.

theorem localPoly_density_inv00_rate reviewed
Causalean.Stat.Nonparametric

Explicit Θ(1/(Nh)) leverage rate from density + kernel-moment constants. Fix a bandwidth h > 0, a sample size N with N > 0, and a design-density lower bound cDesign > 0. Let the kernel K be nonnegative and supported in [-1,1], with both centered-monomial integrands — against the shape weight K·p(t+h·) and against the pure kernel K — integrable, the pure kernel-moment matrix G positive definite, and the kernel shape matrix T positive definite; suppose the design density obeys cDesign ≤ p on the window |a − t| ≤ h. On the good design event where the population matrix's inverse row sums are bounded by a nonnegative constant c, the empirical moment matrix M lies entrywise within a nonnegative scale η of the population matrix S = popDesignMatrix p N K pdens t h, and where the regime constants are small enough (c·(p+1)·η ≤ 1/2 and 2c²(p+1)η is at most the explicit density + kernel-moment constant cInv/(Nh)), then the empirical moment matrix M is invertible and its intercept leverage obeys the explicit interior rate (M⁻¹)₀₀ ≤ 2·cInv/(Nh), with cInv = (G⁻¹)₀₀/cDesign an explicit density + kernel-moment constant — no S-level invertibility or leverage assumption remains.

Formal statement
N :
h cDesign η c t :
K pdens :
ℝ → ℝ
M :
Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ
hh :
0 < h
hN :
0 < (N : ℝ)
hcD :
0 < cDesign
hKnn :
∀ u, 0 ≤ K u
hKsupp :
∀ u
if
1 < |u|
then
K u = 0
hintT :
∀ j k : Fin (p + 1),
Integrable (fun u => (K u * pdens (t + h * u)) * (u ^ (j : ℕ) * u ^ (k : ℕ)))
hintG :
∀ j k : Fin (p + 1), Integrable (fun u => K u * (u ^ (j : ℕ) * u ^ (k : ℕ)))
hGpd :
hTpd :
(weightMomentMatrix p (fun u => K u * pdens (t + h * u))).PosDef
hlo :
∀ a
if
|a - t| ≤ h
then
cDesign ≤ pdens a
hc :
0 ≤ c
:
0 ≤ η
hSrow :
∀ i, (∑ j, |(popDesignMatrix p N K pdens t h)⁻¹ i j|) ≤ c
hclose :
∀ j k, |M j k - popDesignMatrix p N K pdens t h j k| ≤ η
hsmall :
c * ((p + 1 : ℕ) * η) ≤ 1 / 2
hpert :
2 * c ^ 2 * ((p + 1 : ℕ) * η) ≤ ((weightMomentMatrix p K)⁻¹ 0 0 / cDesign) / ((N : ℝ) * h)
IsUnit M.det ∧ M⁻¹ 0 0 ≤ 2 * (((weightMomentMatrix p K)⁻¹ 0 0 / cDesign) / ((N : ℝ) * h))
Proof (Lean source)
theorem localPoly_density_inv00_rate {N : ℕ} {h cDesign η c t : ℝ} {K pdens : ℝ → ℝ} {M : Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ} (hh : 0 < h) (hN : 0 < (N : ℝ)) (hcD : 0 < cDesign) (hKnn : ∀ u, 0 ≤ K u) (hKsupp : ∀ u, 1 < |u| → K u = 0) (hintT : ∀ j k : Fin (p + 1), Integrable (fun u => (K u * pdens (t + h * u)) * (u ^ (j : ℕ) * u ^ (k : ℕ)))) (hintG : ∀ j k : Fin (p + 1), Integrable (fun u => K u * (u ^ (j : ℕ) * u ^ (k : ℕ)))) (hGpd : (weightMomentMatrix p K).PosDef) (hTpd : (weightMomentMatrix p (fun u => K u * pdens (t + h * u))).PosDef) (hlo : ∀ a, |a - t| ≤ h → cDesign ≤ pdens a) (hc : 0 ≤ c) (hη : 0 ≤ η) (hSrow : ∀ i, (∑ j, |(popDesignMatrix p N K pdens t h)⁻¹ i j|) ≤ c) (hclose : ∀ j k, |M j k - popDesignMatrix p N K pdens t h j k| ≤ η) (hsmall : c * ((p + 1 : ℕ) * η) ≤ 1 / 2) (hpert : 2 * c ^ 2 * ((p + 1 : ℕ) * η) ≤ ((weightMomentMatrix p K)⁻¹ 0 0 / cDesign) / ((N : ℝ) * h)) : IsUnit M.det ∧ M⁻¹ 0 0 ≤ 2 * (((weightMomentMatrix p K)⁻¹ 0 0 / cDesign) / ((N : ℝ) * h)) := by set G := weightMomentMatrix p K with hG set T := weightMomentMatrix p (fun u => K u * pdens (t + h * u)) with hT set S := popDesignMatrix p N K pdens t h with hSdef -- Loewner sandwich (lower): `cDesign · (wᵀ G w) ≤ wᵀ T w`. have hsand_lower : ∀ w : Fin (p + 1) → ℝ, cDesign * (w ⬝ᵥ (G *ᵥ w)) ≤ w ⬝ᵥ (T *ᵥ w) := fun w => weightMomentMatrix_quadForm_sandwich hcD.le hintT hintG (kernelDensity_lower_dom hh hKnn hKsupp hlo) w have hTinv00 : T⁻¹ 0 0 ≤ (weightMomentMatrix p K)⁻¹ 0 0 / cDesign := inv00_le_of_quadForm_sandwich hTpd hGpd hcD hsand_lower have hTunit : IsUnit T.det := (Matrix.isUnit_iff_isUnit_det T).mp hTpd.isUnit have hfactor : S = ((N : ℝ) * h) • (diagonal (fun j : Fin (p + 1) => h ^ (j : ℕ)) * T * diagonal (fun j : Fin (p + 1) => h ^ (j : ℕ))) := popDesignMatrix_factor N K pdens t h hh let κ : ℝ := (N : ℝ) * h have hκ : κ ≠ 0 := (mul_pos hN hh).ne' have hd : ∀ i : Fin (p + 1), h ^ (i : ℕ) ≠ 0 := fun i => pow_ne_zero _ hh.ne' have hd0 : (fun j : Fin (p + 1) => h ^ (j : ℕ)) 0 = 1 := by simp obtain ⟨hSunit, hSinv00_eq⟩ := inv00_diag_conj (κ := κ) hκ hd hd0 hTunit hfactor have hSinv00 : S⁻¹ 0 0 ≤ ((weightMomentMatrix p K)⁻¹ 0 0 / cDesign) / ((N : ℝ) * h) := by rw [hSinv00_eq] have hκnonneg : 0 ≤ κ⁻¹ := inv_nonneg.mpr (mul_pos hN hh).le calc κ⁻¹ * T⁻¹ 0 0 ≤ κ⁻¹ * ((weightMomentMatrix p K)⁻¹ 0 0 / cDesign) := mul_le_mul_of_nonneg_left hTinv00 hκnonneg _ = ((weightMomentMatrix p K)⁻¹ 0 0 / cDesign) / ((N : ℝ) * h) := by simp [κ, div_eq_mul_inv, mul_comm] exact localPoly_inv00_rate (mul_pos hN hh) hSunit hc hη hSrow hclose hsmall hSinv00 hpert
theorem localPoly_density_leverage_bound reviewed
Causalean.Stat.Nonparametric

Bandwidth-free density bound on the local-polynomial leverage product. Fix a bandwidth h > 0, a sample size N > 0, and density-window bounds 0 < cDesign with cDesign ≤ CDesign. Let the kernel K be nonnegative and supported in [-1,1], with both centered-monomial integrands integrable, the pure kernel-moment matrix G positive definite, and the kernel shape matrix T positive definite; suppose the design density obeys the lower window bound cDesign ≤ p and the upper window bound p ≤ CDesign on |a − t| ≤ h. On the good design event — the population matrix's inverse row sums bounded by a nonnegative c, the empirical moment matrix M entrywise within a nonnegative scale η of the population matrix, with the regime constants small (c·(p+1)·η ≤ 1/2), the perturbation bound 2c²(p+1)η ≤ cInv/(Nh), and η at most Nh — and given the total weight M₀₀ is nonnegative and the inverse leverage (M⁻¹)₀₀ is nonnegative, then the geometric mean of the total weight and the inverse leverage is bounded by the bandwidth-free density constant √(M₀₀·(M⁻¹)₀₀) ≤ √(2·cInv·(cTop+1)), with cInv = (G⁻¹)₀₀/cDesign and cTop = CDesign·G₀₀. Via equivKernelWeight_abs_sum_sq_le this controls the ℓ¹ bias leverage ∑ᵢ|Sᵢ| by a bandwidth-free constant.

Formal statement
N :
h cDesign CDesign η c t :
K pdens :
ℝ → ℝ
M :
Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ
hh :
0 < h
hN :
0 < (N : ℝ)
hcD :
0 < cDesign
hcCD :
cDesign ≤ CDesign
hKnn :
∀ u, 0 ≤ K u
hKsupp :
∀ u
if
1 < |u|
then
K u = 0
hintT :
∀ j k : Fin (p + 1),
Integrable (fun u => (K u * pdens (t + h * u)) * (u ^ (j : ℕ) * u ^ (k : ℕ)))
hintG :
∀ j k : Fin (p + 1), Integrable (fun u => K u * (u ^ (j : ℕ) * u ^ (k : ℕ)))
hGpd :
hTpd :
(weightMomentMatrix p (fun u => K u * pdens (t + h * u))).PosDef
hlo :
∀ a
if
|a - t| ≤ h
then
cDesign ≤ pdens a
hhi :
∀ a
if
|a - t| ≤ h
then
pdens a ≤ CDesign
hc :
0 ≤ c
:
0 ≤ η
hSrow :
∀ i, (∑ j, |(popDesignMatrix p N K pdens t h)⁻¹ i j|) ≤ c
hclose :
∀ j k, |M j k - popDesignMatrix p N K pdens t h j k| ≤ η
hsmall :
c * ((p + 1 : ℕ) * η) ≤ 1 / 2
hpert :
2 * c ^ 2 * ((p + 1 : ℕ) * η) ≤ ((weightMomentMatrix p K)⁻¹ 0 0 / cDesign) / ((N : ℝ) * h)
hηle :
η ≤ (N : ℝ) * h
hM00 :
0 ≤ M 0 0
hMinv00 :
0 ≤ M⁻¹ 0 0
sqrt (M 0 0 * M⁻¹ 0 0)
sqrt (2 * ((weightMomentMatrix p K)⁻¹ 0 0 / cDesign) * (CDesign * (weightMomentMatrix p K) 0 0 + 1))
Proof (Lean source)
theorem localPoly_density_leverage_bound {N : ℕ} {h cDesign CDesign η c t : ℝ} {K pdens : ℝ → ℝ} {M : Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ} (hh : 0 < h) (hN : 0 < (N : ℝ)) (hcD : 0 < cDesign) (hcCD : cDesign ≤ CDesign) (hKnn : ∀ u, 0 ≤ K u) (hKsupp : ∀ u, 1 < |u| → K u = 0) (hintT : ∀ j k : Fin (p + 1), Integrable (fun u => (K u * pdens (t + h * u)) * (u ^ (j : ℕ) * u ^ (k : ℕ)))) (hintG : ∀ j k : Fin (p + 1), Integrable (fun u => K u * (u ^ (j : ℕ) * u ^ (k : ℕ)))) (hGpd : (weightMomentMatrix p K).PosDef) (hTpd : (weightMomentMatrix p (fun u => K u * pdens (t + h * u))).PosDef) (hlo : ∀ a, |a - t| ≤ h → cDesign ≤ pdens a) (hhi : ∀ a, |a - t| ≤ h → pdens a ≤ CDesign) (hc : 0 ≤ c) (hη : 0 ≤ η) (hSrow : ∀ i, (∑ j, |(popDesignMatrix p N K pdens t h)⁻¹ i j|) ≤ c) (hclose : ∀ j k, |M j k - popDesignMatrix p N K pdens t h j k| ≤ η) (hsmall : c * ((p + 1 : ℕ) * η) ≤ 1 / 2) (hpert : 2 * c ^ 2 * ((p + 1 : ℕ) * η) ≤ ((weightMomentMatrix p K)⁻¹ 0 0 / cDesign) / ((N : ℝ) * h)) (hηle : η ≤ (N : ℝ) * h) (hM00 : 0 ≤ M 0 0) (hMinv00 : 0 ≤ M⁻¹ 0 0) : sqrt (M 0 0 * M⁻¹ 0 0) ≤ sqrt (2 * ((weightMomentMatrix p K)⁻¹ 0 0 / cDesign) * (CDesign * (weightMomentMatrix p K) 0 0 + 1)) := by set G := weightMomentMatrix p K with hG set T := weightMomentMatrix p (fun u => K u * pdens (t + h * u)) with hT set S := popDesignMatrix p N K pdens t h with hSdef have hsand_lower : ∀ w : Fin (p + 1) → ℝ, cDesign * (w ⬝ᵥ (G *ᵥ w)) ≤ w ⬝ᵥ (T *ᵥ w) := fun w => weightMomentMatrix_quadForm_sandwich hcD.le hintT hintG (kernelDensity_lower_dom hh hKnn hKsupp hlo) w have hsand_upper : ∀ w : Fin (p + 1) → ℝ, w ⬝ᵥ (T *ᵥ w) ≤ CDesign * (w ⬝ᵥ (G *ᵥ w)) := fun w => weightMomentMatrix_quadForm_sandwich_upper (hcD.le.trans hcCD) hintT hintG (kernelDensity_upper_dom hh hKnn hKsupp hhi) w have hTinv00 : T⁻¹ 0 0 ≤ G⁻¹ 0 0 / cDesign := inv00_le_of_quadForm_sandwich hTpd hGpd hcD hsand_lower have hT00 : T 0 0 ≤ CDesign * G 0 0 := entry00_le_of_quadForm_sandwich hsand_upper have hTunit : IsUnit T.det := (Matrix.isUnit_iff_isUnit_det T).mp hTpd.isUnit have hfactor : S = ((N : ℝ) * h) • (diagonal (fun j : Fin (p + 1) => h ^ (j : ℕ)) * T * diagonal (fun j : Fin (p + 1) => h ^ (j : ℕ))) := popDesignMatrix_factor N K pdens t h hh obtain ⟨hSunit, hSinv00, hS00'⟩ := population_scaling_of_conj hh hN hTunit hTinv00 hT00 hfactor -- nonnegativity of the density constants from positive (semi)definiteness of `G`. have hG00_nn : 0 ≤ G 0 0 := by have h := hGpd.posSemidef.dotProduct_mulVec_nonneg (single (0 : Fin (p + 1)) (1 : ℝ)) rw [entry00_eq_quadForm G]; simpa using h have hGinv00_nn : 0 ≤ G⁻¹ 0 0 := by have h := hGpd.posSemidef.inv.dotProduct_mulVec_nonneg (single (0 : Fin (p + 1)) (1 : ℝ)) rw [inv00_eq_quadForm G]; simpa using h have hcInv_nn : 0 ≤ G⁻¹ 0 0 / cDesign := div_nonneg hGinv00_nn hcD.le have hcTop_nn : 0 ≤ CDesign * G 0 0 := mul_nonneg (hcD.le.trans hcCD) hG00_nn exact localPoly_leverage_bound (mul_pos hN hh) hSunit hc hη hcInv_nn hcTop_nn hSrow hclose hsmall hSinv00 hpert hS00' hηle hM00 hMinv00
Estimator­Risk 2 core · 0 supporting Conditional local-polynomial estimator risk bounds, assembling interior bias and stochastic L² estimates for the windowed pointwise estimator. ★ localPoly_estimatorBias_window★ localPoly_estimatorStochL2

Interior local-polynomial estimator risk: bias and stochastic- bounds

Conditional local-polynomial estimator risk bounds, assembling interior bias and stochastic estimates for the windowed pointwise estimator.

This module assembles the conditional-on-design bias / variance bounds (localPoly_intercept_bias, localPoly_intercept_variance_le) and the bandwidth-free density-constant leverage facts produced by DensityLeverage:

* localPoly_estimatorBias_windowestimatorBias = |ĉ₀ − f(t)| ≤ Cbias · h^β with the explicit constant Cbias = (MH/p!) · L, where p = holderDerivOrder β and L = √(2·cInv·(cTop+1)) is the bandwidth-free leverage bound (MH the Hölder constant). The ℓ¹ leverage ∑ᵢ|Sᵢ| is squeezed by (∑ᵢ|Sᵢ|)² ≤ M₀₀·(M⁻¹)₀₀ ≤ L² (equivKernelWeight_abs_sum_sq_le). * localPoly_estimatorStochL2estimatorStochL2 = √Var(ĉ₀) ≤ Cvar · (Nh)^{-1/2} with the explicit constant Cvar = √(2σ²·W·cInv), from Var ≤ σ²·W·(M⁻¹)₀₀ and the leverage rate (M⁻¹)₀₀ ≤ 2·cInv/(Nh).

Both bounds hold conditionally on the design (equivalently, on the high-probability good design event of designMatrix_inv_concentration): once the leverage rate is supplied, the estimator risk reduces to a deterministic bias bound plus a conditional variance bound. The leverage constants cInv, cTop are the explicit density + kernel-moment quantities of localPoly_density_inv00_rate / localPoly_density_leverage_bound, so no S-level matrix hypothesis remains.

theorem localPoly_estimatorBias_window reviewed
Causalean.Stat.Nonparametric

Interior local-polynomial estimator bias ≤ Cbias · h^β. Let ĉ₀ = c 0 be the degree- p = holderDerivOrder β weighted least-squares intercept fit — the coefficient vector c minimizing the weighted sum of squared residuals — of a β-Hölder function f (exponent β > 0) with Hölder constant MH ≥ 0 bounding the highest derivative's modulus of continuity at noise-free responses, where the weights are nonnegative, the target point t and every design point a i lie in a common interval [lo, hi], every design point is within bandwidth h ≥ 0 of t, and the design moment matrix is invertible. If the bandwidth-free leverage bound √(M₀₀·(M⁻¹)₀₀) ≤ L holds for some L ≥ 0 — supplied by localPoly_density_leverage_bound — then the conditional bias obeys |ĉ₀ − f(t)| ≤ (MH/p!) · L · h^β, the standard local-polynomial bias rate with constant Cbias = (MH/p!) · L.

Formal statement
N :
β MH lo hi t h L :
a w :
Fin N → ℝ
f :
ℝ → ℝ
c :
Fin ((holderDerivOrder β) + 1) → ℝ
:
0 < β
hMH :
0 ≤ MH
hh :
0 ≤ h
hw :
∀ i, 0 ≤ w i
ht :
t ∈ Icc lo hi
ha :
∀ i, a i ∈ Icc lo hi
hwin :
∀ i, |a i - t| ≤ h
hf :
hb :
∀ x ∈ Icc lo hi,
∀ y ∈ Icc lo hi,
≤ MH * |x - y| ^ (β - ((holderDerivOrder β) : ℝ))
hMdet :
IsUnit (designMatrix (holderDerivOrder β) (fun i => a i - t) w).det
hmin :
∀ c' : Fin ((holderDerivOrder β) + 1) → ℝ,
(∑ i, w i * (f (a i) - ∑ j, c j * (a i - t) ^ (j : ℕ)) ^ 2)
≤ ∑ i, w i * (f (a i) - ∑ j, c' j * (a i - t) ^ (j : ℕ)) ^ 2
hlev :
sqrt ((designMatrix (holderDerivOrder β) (fun i => a i - t) w) 0 0 * (designMatrix (holderDerivOrder β) (fun i => a i - t) w)⁻¹ 0 0)
≤ L
|c 0 - f t| ≤ (MH / ((holderDerivOrder β)).factorial) * L * h ^ β
Proof (Lean source)
theorem localPoly_estimatorBias_window {N : ℕ} {β MH lo hi t h L : ℝ} {a w : Fin N → ℝ} {f : ℝ → ℝ} {c : Fin ((holderDerivOrder β) + 1) → ℝ} (hβ : 0 < β) (hMH : 0 ≤ MH) (hh : 0 ≤ h) (hw : ∀ i, 0 ≤ w i) (ht : t ∈ Icc lo hi) (ha : ∀ i, a i ∈ Icc lo hi) (hwin : ∀ i, |a i - t| ≤ h) (hf : ContDiff ℝ (holderDerivOrder β) f) (hb : ∀ x ∈ Icc lo hi, ∀ y ∈ Icc lo hi, |iteratedDeriv (holderDerivOrder β) f x - iteratedDeriv (holderDerivOrder β) f y| ≤ MH * |x - y| ^ (β - ((holderDerivOrder β) : ℝ))) (hMdet : IsUnit (designMatrix (holderDerivOrder β) (fun i => a i - t) w).det) (hmin : ∀ c' : Fin ((holderDerivOrder β) + 1) → ℝ, (∑ i, w i * (f (a i) - ∑ j, c j * (a i - t) ^ (j : ℕ)) ^ 2) ≤ ∑ i, w i * (f (a i) - ∑ j, c' j * (a i - t) ^ (j : ℕ)) ^ 2) (hlev : sqrt ((designMatrix (holderDerivOrder β) (fun i => a i - t) w) 0 0 * (designMatrix (holderDerivOrder β) (fun i => a i - t) w)⁻¹ 0 0) ≤ L) : |c 0 - f t| ≤ (MH / ((holderDerivOrder β)).factorial) * L * h ^ β := by have hbias := localPoly_intercept_bias hβ hMH hw ht ha hwin hf hb hMdet hmin set s := ∑ i, |equivKernelWeight (holderDerivOrder β) (fun i => a i - t) w i| with hs have hs_nn : 0 ≤ s := sum_nonneg (fun i _ => abs_nonneg _) have hsq : s ^ 2 ≤ (designMatrix (holderDerivOrder β) (fun i => a i - t) w) 0 0 * (designMatrix (holderDerivOrder β) (fun i => a i - t) w)⁻¹ 0 0 := equivKernelWeight_abs_sum_sq_le hMdet hw have hsL : s ≤ L := by rw [(Real.sqrt_sq hs_nn).symm] exact le_trans (Real.sqrt_le_sqrt hsq) hlev have hcoef_nn : 0 ≤ MH / ((holderDerivOrder β)).factorial := div_nonneg hMH (by positivity) have hhb : 0 ≤ h ^ β := Real.rpow_nonneg hh β calc |c 0 - f t| ≤ (MH / ((holderDerivOrder β)).factorial) * s * h ^ β := hbias _ ≤ (MH / ((holderDerivOrder β)).factorial) * L * h ^ β := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hsL hcoef_nn) hhb
theorem localPoly_estimatorStochL2 reviewed
Causalean.Stat.Nonparametric

Interior local-polynomial estimator stochastic error ≤ Cvar · (Nh)^{-1/2}. The degree-p local-polynomial equivalent-kernel smoother ĉ₀ = ∑ᵢ Sᵢ Yᵢ, applied to a family Y of square-integrable responses that is spherical with common scale σ, with an invertible design moment matrix and nonnegative weights bounded by a constant W ≥ 0, satisfies, on the good design event where the intercept leverage obeys the rate (M⁻¹)₀₀ ≤ 2·cInv/Nh for a nonnegative constant cInv and a positive scale Nh, the conditional stochastic error bound √Var(ĉ₀) ≤ √(2σ²·W·cInv) · (Nh)^{-1/2}, the standard interior stochastic rate with constant Cvar = √(2σ²·W·cInv).

Formal statement
Ω :
Type*
N p :
x w :
Fin N → ℝ
Y :
Fin N → Ω → ℝ
σ W cInv Nh :
hY :
∀ i, MemLp (Y i) 2 μ
hsph :
hMdet :
hw :
∀ i, 0 ≤ w i
hwW :
∀ i, w i ≤ W
hW :
0 ≤ W
hcInv :
0 ≤ cInv
_hNh :
0 < Nh
hrate :
(designMatrix p x w)⁻¹ 0 0 ≤ 2 * (cInv / Nh)
sqrt (Var[fun ω => ∑ i, equivKernelWeight p x w i * Y i ω; μ])
sqrt (2 * σ ^ 2 * W * cInv) * sqrt Nh⁻¹
Proof (Lean source)
theorem localPoly_estimatorStochL2 {Ω : Type*} {N p : ℕ} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {x w : Fin N → ℝ} {Y : Fin N → Ω → ℝ} {σ W cInv Nh : ℝ} (hY : ∀ i, MemLp (Y i) 2 μ) (hsph : SphericalFamily Y μ σ) (hMdet : IsUnit (designMatrix p x w).det) (hw : ∀ i, 0 ≤ w i) (hwW : ∀ i, w i ≤ W) (hW : 0 ≤ W) (hcInv : 0 ≤ cInv) (_hNh : 0 < Nh) (hrate : (designMatrix p x w)⁻¹ 0 0 ≤ 2 * (cInv / Nh)) : sqrt (Var[fun ω => ∑ i, equivKernelWeight p x w i * Y i ω; μ]) ≤ sqrt (2 * σ ^ 2 * W * cInv) * sqrt Nh⁻¹ := by have hvar := localPoly_intercept_variance_le hY hsph hMdet hw hwW have hσ2 : 0 ≤ σ ^ 2 := sq_nonneg σ have hVarbd : Var[fun ω => ∑ i, equivKernelWeight p x w i * Y i ω; μ] ≤ 2 * σ ^ 2 * W * cInv * Nh⁻¹ := by refine le_trans hvar ?_ have hWm : W * (designMatrix p x w)⁻¹ 0 0 ≤ W * (2 * (cInv / Nh)) := mul_le_mul_of_nonneg_left hrate hW calc σ ^ 2 * (W * (designMatrix p x w)⁻¹ 0 0) ≤ σ ^ 2 * (W * (2 * (cInv / Nh))) := mul_le_mul_of_nonneg_left hWm hσ2 _ = 2 * σ ^ 2 * W * cInv * Nh⁻¹ := by rw [div_eq_mul_inv]; ring have hCvar_nn : 0 ≤ 2 * σ ^ 2 * W * cInv := mul_nonneg (mul_nonneg (mul_nonneg (by norm_num) hσ2) hW) hcInv calc sqrt (Var[fun ω => ∑ i, equivKernelWeight p x w i * Y i ω; μ]) ≤ sqrt (2 * σ ^ 2 * W * cInv * Nh⁻¹) := Real.sqrt_le_sqrt hVarbd _ = sqrt (2 * σ ^ 2 * W * cInv) * sqrt Nh⁻¹ := Real.sqrt_mul hCvar_nn _
Square­Completion 1 core · 4 supporting Linear-algebra bounds for the top-left inverse entry under positive-definite quadratic-form sandwiches. ★ two_dotProduct_sub_quadForm_le_inv

Square-completion bound on the (0,0) inverse entry under a Loewner sandwich

Linear-algebra bounds for the top-left inverse entry under positive-definite quadratic-form sandwiches.

The interior local-polynomial leverage (T⁻¹)₀₀ of the bandwidth-free kernel shape matrix T must be controlled by the density constants cDesign ≤ p ≤ CDesign together with the pure kernel-moment Gram matrix G. The clean route avoids Loewner inverse-monotonicity (absent from Mathlib): it uses only the elementary completing-the-square identity

(w − A⁻¹e)ᵀ A (w − A⁻¹e) ≥ 0 ⟺ 2 eᵀw − wᵀ A w ≤ eᵀ A⁻¹ e

valid for any positive definite A and vectors e, w. Evaluating it at the optimum w = A⁻¹e turns the inequality into the variational identity eᵀ A⁻¹ e = max_w (2 eᵀw − wᵀ A w), and a Loewner sandwich c·B ⪯ A (as quadratic forms) then transports the maximum:

(A⁻¹)₀₀ ≤ (B⁻¹)₀₀ / c.

This file proves that bound (and the trivial companion A₀₀ ≤ C·B₀₀ under A ⪯ C·B). It is the pure-linear-algebra heart of the density-constant discharge of the local-polynomial leverage rate.

theorem two_dotProduct_sub_quadForm_le_inv reviewed
Causalean.Stat.Nonparametric

Completing-the-square inequality for a positive definite quadratic form. For a positive definite matrix A and any vectors e, w, the affine functional 2 eᵀw − wᵀ A w is bounded above by the inverse quadratic form eᵀ A⁻¹ e, with equality at w = A⁻¹ e. This is the elementary identity eᵀ A⁻¹ e − (2 eᵀw − wᵀ A w) = (w − A⁻¹ e)ᵀ A (w − A⁻¹ e) ≥ 0.

Formal statement
A :
Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ
hA :
A.PosDef
e w :
Fin (p + 1) → ℝ
2 * (e ⬝ᵥ w) - w ⬝ᵥ (A *ᵥ w) ≤ e ⬝ᵥ (A⁻¹ *ᵥ e)
Proof (Lean source)
theorem two_dotProduct_sub_quadForm_le_inv {A : Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ} (hA : A.PosDef) (e w : Fin (p + 1) → ℝ) : 2 * (e ⬝ᵥ w) - w ⬝ᵥ (A *ᵥ w) ≤ e ⬝ᵥ (A⁻¹ *ᵥ e) := by let u : Fin (p + 1) → ℝ := (A⁻¹ *ᵥ e) have hdet : IsUnit A.det := Matrix.isUnit_iff_isUnit_det A |>.mp hA.isUnit have hAu : A *ᵥ u = e := by simpa [u] using congr_arg (fun M => M *ᵥ e) (Matrix.mul_nonsing_inv A hdet) have hsym : ∀ x y : Fin (p + 1), A x y = A y x := by intro x y have h := congr_fun₂ hA.isHermitian.eq y x simpa [conjTranspose] using h have hcross : u ⬝ᵥ (A *ᵥ w) = e ⬝ᵥ w := by rw [Matrix.dotProduct_mulVec] have hvec : u ᵥ* A = A *ᵥ u := by ext i rw [vecMul, mulVec] simp only [hsym] exact dotProduct_comm _ _ rw [hvec, hAu] have hlast : u ⬝ᵥ e = e ⬝ᵥ (A⁻¹ *ᵥ e) := by dsimp [u] rw [dotProduct_comm] have h0 : 0 ≤ (w - u) ⬝ᵥ (A *ᵥ (w - u)) := by simpa using hA.posSemidef.dotProduct_mulVec_nonneg (w - u) have hexpand : (w - u) ⬝ᵥ (A *ᵥ (w - u)) = w ⬝ᵥ (A *ᵥ w) - 2 * (e ⬝ᵥ w) + e ⬝ᵥ (A⁻¹ *ᵥ e) := by rw [Matrix.mulVec_sub, dotProduct_sub, sub_dotProduct, sub_dotProduct] rw [hAu, hcross, hlast] rw [dotProduct_comm w e] ring rw [hexpand] at h0 linarith
Causalean.Stat.Nonparametric.two_dotProduct_sub_quadForm_le_inv · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/SquareCompletion.lean:38
4 supporting declarations (lemmas, instances)
  • inv00_eq_quadForm theorem — The (0,0) entry of an inverse as an inverse quadratic form at the first basis vector: (A⁻¹)₀₀ = e₀ᵀ A⁻¹ e₀ with e₀ = Pi.single 0 1.
    A :
    Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ
    A⁻¹ 0 0 = (single (0 : Fin (p + 1)) (1 : ℝ)) ⬝ᵥ (A⁻¹ *ᵥ single 0 1)
    Proof (Lean source)
    theorem inv00_eq_quadForm (A : Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ) : A⁻¹ 0 0 = (single (0 : Fin (p + 1)) (1 : ℝ)) ⬝ᵥ (A⁻¹ *ᵥ single 0 1) := by simp [dotProduct, mulVec, Pi.single_apply]
  • entry00_eq_quadForm theorem — The (0,0) entry of a matrix as a quadratic form at the first basis vector: A₀₀ = e₀ᵀ A e₀ with e₀ = Pi.single 0 1.
    A :
    Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ
    A 0 0 = (single (0 : Fin (p + 1)) (1 : ℝ)) ⬝ᵥ (A *ᵥ single 0 1)
    Proof (Lean source)
    theorem entry00_eq_quadForm (A : Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ) : A 0 0 = (single (0 : Fin (p + 1)) (1 : ℝ)) ⬝ᵥ (A *ᵥ single 0 1) := by simp [dotProduct, mulVec, Pi.single_apply]
  • inv00_le_of_quadForm_sandwich theorem — Loewner sandwich bound on the (0,0) inverse entry. If A and B are positive definite and A dominates c·B in the Loewner order on quadratic forms (c·(wᵀ B w) ≤ wᵀ A w for all w) with c > 0, then the intercept leverage entries satisfy
    A B :
    Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ
    hA :
    A.PosDef
    hB :
    B.PosDef
    c :
    hc :
    0 < c
    hsand :
    ∀ w : Fin (p + 1) → ℝ, c * (w ⬝ᵥ (B *ᵥ w)) ≤ w ⬝ᵥ (A *ᵥ w)
    A⁻¹ 0 0 ≤ B⁻¹ 0 0 / c
    Proof (Lean source)
    theorem inv00_le_of_quadForm_sandwich {A B : Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ} (hA : A.PosDef) (hB : B.PosDef) {c : ℝ} (hc : 0 < c) (hsand : ∀ w : Fin (p + 1) → ℝ, c * (w ⬝ᵥ (B *ᵥ w)) ≤ w ⬝ᵥ (A *ᵥ w)) : A⁻¹ 0 0 ≤ B⁻¹ 0 0 / c := by let e0 : Fin (p + 1) → ℝ := single (0 : Fin (p + 1)) (1 : ℝ) let wstar : Fin (p + 1) → ℝ := (A⁻¹ *ᵥ e0) have hdetA : IsUnit A.det := Matrix.isUnit_iff_isUnit_det A |>.mp hA.isUnit have hAw : A *ᵥ wstar = e0 := by have hAA : (A * A⁻¹) *ᵥ e0 = e0 := by rw [Matrix.mul_nonsing_inv A hdetA] simp simpa [wstar] using hAA have hew : e0 ⬝ᵥ wstar = A⁻¹ 0 0 := by simp [e0, wstar] have hquadA : wstar ⬝ᵥ (A *ᵥ wstar) = e0 ⬝ᵥ wstar := by rw [hAw, dotProduct_comm] have hoptA : A⁻¹ 0 0 = 2 * (e0 ⬝ᵥ wstar) - wstar ⬝ᵥ (A *ᵥ wstar) := by rw [hquadA, hew] ring have hAB : 2 * (e0 ⬝ᵥ wstar) - wstar ⬝ᵥ (A *ᵥ wstar) ≤ 2 * (e0 ⬝ᵥ wstar) - c * (wstar ⬝ᵥ (B *ᵥ wstar)) := by linarith [hsand wstar] have hBvar := two_dotProduct_sub_quadForm_le_inv hB e0 (c • wstar) have hscale : 2 * (e0 ⬝ᵥ (c • wstar)) - (c • wstar) ⬝ᵥ (B *ᵥ (c • wstar)) = c * (2 * (e0 ⬝ᵥ wstar) - c * (wstar ⬝ᵥ (B *ᵥ wstar))) := by simp [Matrix.mulVec_smul] ring have hBscaled : c * (2 * (e0 ⬝ᵥ wstar) - c * (wstar ⬝ᵥ (B *ᵥ wstar))) ≤ B⁻¹ 0 0 := by rwa [hscale, ← inv00_eq_quadForm B] at hBvar have hBdiv : 2 * (e0 ⬝ᵥ wstar) - c * (wstar ⬝ᵥ (B *ᵥ wstar)) ≤ B⁻¹ 0 0 / c := by rw [le_div_iff₀ hc] linarith rw [hoptA] exact le_trans hAB hBdiv
    Causalean.Stat.Nonparametric.inv00_le_of_quadForm_sandwich · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/SquareCompletion.lean:88
  • entry00_le_of_quadForm_sandwich theorem — Loewner sandwich bound on the (0,0) entry. If A ⪯ C·B in the Loewner order on quadratic forms (wᵀ A w ≤ C·wᵀ B w for all w), then the top weight entries satisfy A₀₀ ≤ C·B₀₀. (Just evaluate the quadratic forms at the first basis vector.)
    A B :
    Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ
    C :
    hsand :
    ∀ w : Fin (p + 1) → ℝ, w ⬝ᵥ (A *ᵥ w) ≤ C * (w ⬝ᵥ (B *ᵥ w))
    A 0 0 ≤ C * B 0 0
    Proof (Lean source)
    theorem entry00_le_of_quadForm_sandwich {A B : Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ} {C : ℝ} (hsand : ∀ w : Fin (p + 1) → ℝ, w ⬝ᵥ (A *ᵥ w) ≤ C * (w ⬝ᵥ (B *ᵥ w))) : A 0 0 ≤ C * B 0 0 := by rw [entry00_eq_quadForm A, entry00_eq_quadForm B] exact hsand (single (0 : Fin (p + 1)) (1 : ℝ))
    Causalean.Stat.Nonparametric.entry00_le_of_quadForm_sandwich · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/SquareCompletion.lean:137
Unconditional 3 core · 0 supporting Unconditional risk bounds for truncated local-polynomial estimators, lifting conditional-on-design bias and variance estimates through good-design events. ★ estimatorBias_unconditional★ estimatorVariance_unconditional★ estimatorStochL2_unconditional

Unconditional (full-sample-law) bias / variance of a truncated estimator

Unconditional risk bounds for truncated local-polynomial estimators, lifting conditional-on-design bias and variance estimates through good-design events.

The conditional-on-design capstones localPoly_estimatorBias_window and localPoly_estimatorStochL2 bound the bias / variance of the interior local-polynomial estimator given a non-degenerate design (equivalently, on the high-probability good-design event of designMatrix_inv_concentration). A full risk bound for the random-design estimator also needs bounds on the bias 𝔼[est] − f(t) and stochastic error √Var(est) under the full sample law, where the design itself is random.

This module performs that high-probability-to- lift as a pair of generic probabilistic facts, with no conditional-on-design caveat remaining:

* estimatorBias_unconditional — split 𝔼[est] = 𝔼[est·1_G] + 𝔼[est·1_{Gᶜ}] through the design σ-algebra m: on the good design event G the conditional bias |𝔼[est | m] − θ| ≤ B holds, while off G the truncation |est| ≤ M controls the contribution by 2M·μ(Gᶜ). Yields |𝔼[est] − θ| ≤ B + 2M·μ(Gᶜ). * estimatorVariance_unconditional — via the law of total variance Var(est) = 𝔼[Var(est | m)] + Var(𝔼[est | m]): the first term is the within-design variance (≤ Vrate on G, ≤ M² off it), the second is dominated by the squared conditional bias (≤ Bsq on G, ≤ 4M² off it). Yields Var(est) ≤ Vrate + Bsq + 5M²·μ(Gᶜ). * estimatorStochL2_unconditional — the √· form of the variance bound.

Each carries an explicit μ(Gᶜ) tail; designMatrix_inv_concentration makes that tail tiny (and a regime hypothesis absorbs it into the leading rate). The lift takes the conditional bias / variance bounds as hypotheses — exactly the output of the conditional capstones — and is otherwise self-contained: the conditional-expectation and law-of-total-variance machinery is MeasureTheory.condExp / ProbabilityTheory.condVar from Mathlib.

theorem estimatorBias_unconditional reviewed
Causalean.Stat.Nonparametric

Unconditional bias of a truncated estimator. Let est be an integrable statistic bounded by M in absolute value estimating a target θ with |θ| ≤ M, relative to a sub-σ-algebra m of the ambient σ-algebra. If G is an m-measurable good-design event on which, almost everywhere, the conditional bias |𝔼[est | m] − θ| is at most a nonnegative constant B, then the full-sample-law bias obeys |𝔼[est] − θ| ≤ B + 2M·μ(Gᶜ), the conditional bias B plus a truncation tail proportional to the bad-design probability.

Formal statement
est :
Ω → ℝ
θ B M :
G :
Set Ω
hm :
m ≤ m0
hest :
Integrable est μ
hM :
∀ ω, |est ω| ≤ M
:
|θ| ≤ M
hB :
0 ≤ B
hG :
hcond :
∀ᵐ ω ∂μ
if
ω ∈ G
then
|(μ[est | m]) ω - θ| ≤ B
|(∫ ω, est ω ∂μ) - θ| ≤ B + 2 * M * (μ Gᶜ).toReal
Proof (Lean source)
theorem estimatorBias_unconditional {est : Ω → ℝ} {θ B M : ℝ} {G : Set Ω} (hm : m ≤ m0) (hest : Integrable est μ) (hM : ∀ ω, |est ω| ≤ M) (hθ : |θ| ≤ M) (hB : 0 ≤ B) (hG : MeasurableSet[m] G) (hcond : ∀ᵐ ω ∂μ, ω ∈ G → |(μ[est | m]) ω - θ| ≤ B) : |(∫ ω, est ω ∂μ) - θ| ≤ B + 2 * M * (μ Gᶜ).toReal := by have hGm0 : MeasurableSet[m0] G := hm _ hG have hcE_int : Integrable (μ[est | m]) μ := integrable_condExp have hg_int : Integrable (fun ω => (μ[est | m]) ω - θ) μ := hcE_int.sub (integrable_const θ) -- `∫ est = ∫ 𝔼[est | m]`, so the bias is the mean of `𝔼[est | m] − θ`. have hbias_eq : (∫ ω, est ω ∂μ) - θ = ∫ ω, ((μ[est | m]) ω - θ) ∂μ := by rw [integral_sub hcE_int (integrable_const θ), integral_const, integral_condExp hm, probReal_univ, one_smul] rw [hbias_eq] refine (abs_integral_le_integral_abs).trans ?_ -- bad-side global a.e. bound `|𝔼[est | m] − θ| ≤ 2M`. have habsM := abs_condExp_le_of_bound hm hest hM have hθ' := abs_le.1 hθ have hbad : ∀ᵐ ω ∂μ, ω ∈ Gᶜ → |(μ[est | m]) ω - θ| ≤ 2 * M := by filter_upwards [habsM] with ω hω _ have h1 := abs_le.1 hω rw [abs_le]; constructor <;> linarith [h1.1, h1.2, hθ'.1, hθ'.2] have hsplit := split_bound hg_int.abs hGm0 hcond hbad refine hsplit.trans ?_ have hμG : (μ G).toReal ≤ 1 := by rw [← ENNReal.toReal_one]; exact ENNReal.toReal_mono (by simp) prob_le_one have hBG : B * (μ G).toReal ≤ B := by nlinarith [hB, hμG, ENNReal.toReal_nonneg (a := μ G)] linarith
Causalean.Stat.Nonparametric.estimatorBias_unconditional · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/Unconditional.lean:82
theorem estimatorVariance_unconditional reviewed
Causalean.Stat.Nonparametric

Unconditional variance of a truncated estimator (law of total variance). Let est be an statistic bounded by M in absolute value estimating a target θ with |θ| ≤ M, relative to a sub-σ-algebra m of the ambient σ-algebra. Let G be an m-measurable good-design event on which, almost everywhere, the conditional variance Var[est | m] is at most a nonnegative rate Vrate and the squared conditional bias (𝔼[est | m] − θ)² is at most a nonnegative constant Bsq. Then the full-sample-law variance obeys Var(est) ≤ Vrate + Bsq + 5M²·μ(Gᶜ), the within-design variance rate plus the squared bias plus a truncation tail.

Formal statement
est :
Ω → ℝ
θ Bsq Vrate M :
G :
Set Ω
hm :
m ≤ m0
hest :
MemLp est 2 μ
hM :
∀ ω, |est ω| ≤ M
:
|θ| ≤ M
hVr :
0 ≤ Vrate
hBsq :
0 ≤ Bsq
hG :
hVcond :
∀ᵐ ω ∂μ
if
ω ∈ G
then
(Var[est; μ | m]) ω ≤ Vrate
hBcond :
∀ᵐ ω ∂μ
if
ω ∈ G
then
((μ[est | m]) ω - θ) ^ 2 ≤ Bsq
Var[est; μ] ≤ Vrate + Bsq + 5 * M ^ 2 * (μ Gᶜ).toReal
Proof (Lean source)
theorem estimatorVariance_unconditional {est : Ω → ℝ} {θ Bsq Vrate M : ℝ} {G : Set Ω} (hm : m ≤ m0) (hest : MemLp est 2 μ) (hM : ∀ ω, |est ω| ≤ M) (hθ : |θ| ≤ M) (hVr : 0 ≤ Vrate) (hBsq : 0 ≤ Bsq) (hG : MeasurableSet[m] G) (hVcond : ∀ᵐ ω ∂μ, ω ∈ G → (Var[est; μ | m]) ω ≤ Vrate) (hBcond : ∀ᵐ ω ∂μ, ω ∈ G → ((μ[est | m]) ω - θ) ^ 2 ≤ Bsq) : Var[est; μ] ≤ Vrate + Bsq + 5 * M ^ 2 * (μ Gᶜ).toReal := by have hMnn : 0 ≤ M := le_trans (abs_nonneg θ) hθ have hM2nn : 0 ≤ M ^ 2 := sq_nonneg M have hGm0 : MeasurableSet[m0] G := hm _ hG have hest_int : Integrable est μ := hest.integrable one_le_two have hμG : (μ G).toReal ≤ 1 := by rw [← ENNReal.toReal_one]; exact ENNReal.toReal_mono (by simp) prob_le_one have hμGcnn : (0 : ℝ) ≤ (μ Gᶜ).toReal := ENNReal.toReal_nonneg -- Law of total variance: `Var(est) = 𝔼[Var(est | m)] + Var(𝔼[est | m])`. have htot := integral_condVar_add_variance_condExp hm hest have hθ' := abs_le.1 hθ -- ===== Term 1: `𝔼[Var(est | m)] ≤ Vrate + M²·μ(Gᶜ)` ===== have hcondVar_int : Integrable (Var[est; μ | m]) μ := integrable_condVar -- off-`G` bound on the conditional variance: `Var[est | m] ≤ 𝔼[est² | m] ≤ M²`. have hCV_le_sq : Var[est; μ | m] ≤ᵐ[μ] μ[fun ω => est ω ^ 2 | m] := condVar_ae_le_condExp_sq hm hest have hsq_le_M2 : μ[fun ω => est ω ^ 2 | m] ≤ᵐ[μ] (fun _ => M ^ 2) := by have h := condExp_mono (m := m) hest.integrable_sq (integrable_const (M ^ 2)) (Filter.Eventually.of_forall fun ω => by nlinarith [sq_abs (est ω), hM ω, abs_nonneg (est ω)]) rwa [condExp_const hm] at h have hCV_bad : ∀ᵐ ω ∂μ, ω ∈ Gᶜ → (Var[est; μ | m]) ω ≤ M ^ 2 := by filter_upwards [hCV_le_sq, hsq_le_M2] with ω h1 h2 _ using le_trans h1 h2 have hT1 : (∫ ω, (Var[est; μ | m]) ω ∂μ) ≤ Vrate + M ^ 2 * (μ Gᶜ).toReal := by refine (split_bound hcondVar_int hGm0 hVcond hCV_bad).trans ?_ have hVG : Vrate * (μ G).toReal ≤ Vrate := by nlinarith [hVr, hμG, ENNReal.toReal_nonneg (a := μ G)] linarith -- ===== Term 2: `Var(𝔼[est | m]) ≤ Bsq + 4M²·μ(Gᶜ)` ===== have hcE_memLp : MemLp (μ[est | m]) 2 μ := MemLp.condExp (by norm_num) hest have hZ_memLp : MemLp (fun ω => (μ[est | m]) ω - θ) 2 μ := hcE_memLp.sub (memLp_const θ) have hZsq_int : Integrable (fun ω => ((μ[est | m]) ω - θ) ^ 2) μ := hZ_memLp.integrable_sq have habsM := abs_condExp_le_of_bound hm hest_int hM -- `Var(𝔼[est | m]) = Var(𝔼[est | m] − θ) ≤ 𝔼[(𝔼[est | m] − θ)²]`. have hVarcE_le : Var[μ[est | m]; μ] ≤ ∫ ω, ((μ[est | m]) ω - θ) ^ 2 ∂μ := by have hveq : Var[μ[est | m]; μ] = Var[fun ω => (μ[est | m]) ω - θ; μ] := (variance_sub_const hcE_memLp.aestronglyMeasurable θ).symm rw [hveq] have h := variance_le_expectation_sq (μ := μ) hZ_memLp.aestronglyMeasurable simpa [pow_two, Pi.pow_apply] using h -- off-`G` bound on `(𝔼[est | m] − θ)²≤ (2M)² = 4M²`. have hZsq_bad : ∀ᵐ ω ∂μ, ω ∈ Gᶜ → ((μ[est | m]) ω - θ) ^ 2 ≤ 4 * M ^ 2 := by filter_upwards [habsM] with ω hω _ have h1 := abs_le.1 hω have hlo : -(2 * M) ≤ (μ[est | m]) ω - θ := by linarith [h1.1, hθ'.2] have hhi : (μ[est | m]) ω - θ ≤ 2 * M := by linarith [h1.2, hθ'.1] nlinarith [hlo, hhi] have hT2 : Var[μ[est | m]; μ] ≤ Bsq + 4 * M ^ 2 * (μ Gᶜ).toReal := by refine hVarcE_le.trans ?_ refine (split_bound hZsq_int hGm0 hBcond hZsq_bad).trans ?_ have hBG : Bsq * (μ G).toReal ≤ Bsq := by nlinarith [hBsq, hμG, ENNReal.toReal_nonneg (a := μ G)] linarith -- ===== Assemble via the law of total variance ===== rw [← htot] have heq : μ[Var[est; μ | m]] = ∫ ω, (Var[est; μ | m]) ω ∂μ := rfl rw [heq] exact (add_le_add hT1 hT2).trans_eq (by ring)
Causalean.Stat.Nonparametric.estimatorVariance_unconditional · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/Unconditional.lean:117
theorem estimatorStochL2_unconditional reviewed
Causalean.Stat.Nonparametric

Unconditional stochastic error of a truncated estimator. The √· form of estimatorVariance_unconditional: for an statistic est bounded by M in absolute value estimating θ with |θ| ≤ M relative to a sub-σ-algebra m of the ambient σ-algebra, and an m-measurable good-design event G on which, almost everywhere, the conditional variance is at most a nonnegative rate Vrate and the squared conditional bias is at most a nonnegative constant Bsq, the full-sample-law stochastic error obeys √Var(est) ≤ √(Vrate + Bsq + 5M²·μ(Gᶜ)). With Vrate = Cvar²·(Nh)⁻¹, Bsq = Cbias²·h^{2β} and a negligible truncation tail (5M²·μ(Gᶜ) driven to o((Nh)⁻¹) by designMatrix_inv_concentration), this gives the full-sample stochastic rate up to the bias and the negligible tail.

Formal statement
est :
Ω → ℝ
θ Bsq Vrate M :
G :
Set Ω
hm :
m ≤ m0
hest :
MemLp est 2 μ
hM :
∀ ω, |est ω| ≤ M
:
|θ| ≤ M
hVr :
0 ≤ Vrate
hBsq :
0 ≤ Bsq
hG :
hVcond :
∀ᵐ ω ∂μ
if
ω ∈ G
then
(Var[est; μ | m]) ω ≤ Vrate
hBcond :
∀ᵐ ω ∂μ
if
ω ∈ G
then
((μ[est | m]) ω - θ) ^ 2 ≤ Bsq
sqrt (Var[est; μ]) ≤ sqrt (Vrate + Bsq + 5 * M ^ 2 * (μ Gᶜ).toReal)
Proof (Lean source)
theorem estimatorStochL2_unconditional {est : Ω → ℝ} {θ Bsq Vrate M : ℝ} {G : Set Ω} (hm : m ≤ m0) (hest : MemLp est 2 μ) (hM : ∀ ω, |est ω| ≤ M) (hθ : |θ| ≤ M) (hVr : 0 ≤ Vrate) (hBsq : 0 ≤ Bsq) (hG : MeasurableSet[m] G) (hVcond : ∀ᵐ ω ∂μ, ω ∈ G → (Var[est; μ | m]) ω ≤ Vrate) (hBcond : ∀ᵐ ω ∂μ, ω ∈ G → ((μ[est | m]) ω - θ) ^ 2 ≤ Bsq) : sqrt (Var[est; μ]) ≤ sqrt (Vrate + Bsq + 5 * M ^ 2 * (μ Gᶜ).toReal) := Real.sqrt_le_sqrt (estimatorVariance_unconditional hm hest hM hθ hVr hBsq hG hVcond hBcond)
Causalean.Stat.Nonparametric.estimatorStochL2_unconditional · Causalean/Stat/Nonparametric/LocalPoly/EstimatorRisk/Unconditional.lean:189