Stat.Inference

Inferential tooling: delta methods (scalar, functional, Hadamard), Wald/chi-squared statistics, and Slutsky ingredients.

Affine­Inversion 2 core · 4 supporting This module develops model-free geometry and expected-volume bounds for confidence sets obtained by inverting a scalar affine inequality over a finite-volume parameter region. ★ expectedRestrictedVolume_affineInversion_frontier_le

Affine test inversion

This module develops model-free geometry and expected-volume bounds for confidence sets obtained by inverting a scalar affine inequality over a finite-volume parameter region. The final result converts a mean-radius bound and a bad-slope probability into the capped inverse-square-root frontier rate.

def affineInversionSet reviewed
Causalean.Stat

The subset of a parameter region accepted by a scalar affine inequality.

Definition (Lean source)
noncomputable def affineInversionSet (region : Set ℝ) (A B r : ℝ) : Set ℝ := {theta | theta ∈ region ∧ |A - theta * B| ≤ r}
Causalean.Stat.affineInversionSet · Causalean/Stat/Inference/AffineInversion.lean:24
theorem expectedRestrictedVolume_affineInversion_frontier_le reviewed
Causalean.Stat

Affine-inversion frontier bound over a finite-volume region. Fix a probability space (Ω, Q), real-valued functions A, B, K on it, and a region of the line with finite Lebesgue measure. Suppose a nonnegative radius scale L, a positive centering level mu and a positive sample size n; suppose K is pointwise nonnegative and Q-integrable with Q-mean at most Kbar, and that the Q-probability that B deviates from mu by more than mu/2 is at most q. Suppose further a positive scale kappa, a nonnegative inflation factor inflation and nonnegative slack Y, with Kbar controlled by inflation · kappa and the bad-event contribution (vol region) · q controlled by Y / t, where t is defined as n · mu² / kappa. Then the Q-expected restricted volume of the affine-inversion set built from A, B and the shrinking radius L · √(K/n) is at most max(vol region, 4·√inflation·L + Y) · min(1, t^(-1/2)).

Formal statement
Ω :
region :
Set
hregionFinite :
volume region ≠ ⊤
A B K :
Ω → ℝ
n :
L mu Kbar q kappa inflation Y t :
hL :
0 ≤ L
hmu :
0 < mu
hn :
0 < n
hK :
∀ w, 0 ≤ K w
hKint :
hKbar :
(∫ w, K w ∂Q) ≤ Kbar
hbad :
(Q {w | mu / 2 < |B w - mu|}).toReal ≤ q
hkappa :
0 < kappa
hinflation :
0 ≤ inflation
hY :
0 ≤ Y
hKbar_le :
Kbar ≤ inflation * kappa
hbadContribution :
(volume region).toReal * q ≤ Y / t
ht :
t = (n : ℝ) * mu ^ 2 / kappa
(∫ w, restrictedSetVolume region (affineInversionSet region (A w) (B w) (L * sqrt (K w / n))) ∂Q)
max (volume region).toReal (4 * sqrt inflation * L + Y) * min 1 (t ^ (-1 / 2 : ℝ))
Proof (Lean source)
theorem expectedRestrictedVolume_affineInversion_frontier_le {Ω : Type*} [MeasurableSpace Ω] (Q : Measure Ω) [IsProbabilityMeasure Q] (region : Set ℝ) (hregionFinite : volume region ≠ ⊤) (A B K : Ω → ℝ) (n : ℕ) (L mu Kbar q kappa inflation Y t : ℝ) (hL : 0 ≤ L) (hmu : 0 < mu) (hn : 0 < n) (hK : ∀ w, 0 ≤ K w) (hKint : Integrable K Q) (hKbar : (∫ w, K w ∂Q) ≤ Kbar) (hbad : (Q {w | mu / 2 < |B w - mu|}).toReal ≤ q) (hkappa : 0 < kappa) (hinflation : 0 ≤ inflation) (hY : 0 ≤ Y) (hKbar_le : Kbar ≤ inflation * kappa) (hbadContribution : (volume region).toReal * q ≤ Y / t) (ht : t = (n : ℝ) * mu ^ 2 / kappa) : (∫ w, restrictedSetVolume region (affineInversionSet region (A w) (B w) (L * sqrt (K w / n))) ∂Q) ≤ max (volume region).toReal (4 * sqrt inflation * L + Y) * min 1 (t ^ (-1 / 2 : ℝ)) := by have hnR : 0 < (n : ℝ) := by exact_mod_cast hn have htpos : 0 < t := by rw [ht]; positivity have hbase := expectedRestrictedVolume_affineInversion_le Q region hregionFinite A B K n L mu Kbar q hL hmu hn hK hKint hKbar hbad have hcap := expectedRestrictedVolume_affineInversion_le_region Q region hregionFinite A B (fun w => L * sqrt (K w / n)) have hsqrt : sqrt (Kbar / (n : ℝ)) ≤ sqrt (inflation * kappa / (n : ℝ)) := Real.sqrt_le_sqrt (div_le_div_of_nonneg_right hKbar_le hnR.le) have hratio : sqrt (inflation * kappa / (n : ℝ)) / mu = sqrt inflation / sqrt t := sqrt_mul_kappa_div_n_div_mu inflation n mu kappa t hinflation hnR hmu hkappa ht have hradius : 4 * L * sqrt (Kbar / (n : ℝ)) / mu ≤ (4 * sqrt inflation * L) / sqrt t := by calc 4 * L * sqrt (Kbar / (n : ℝ)) / mu ≤ 4 * L * sqrt (inflation * kappa / (n : ℝ)) / mu := by gcongr _ = 4 * L * (sqrt (inflation * kappa / (n : ℝ)) / mu) := by ring _ = (4 * sqrt inflation * L) / sqrt t := by rw [hratio] ring have hsum : 4 * L * sqrt (Kbar / (n : ℝ)) / mu + (volume region).toReal * q ≤ (4 * sqrt inflation * L) / sqrt t + Y / t := add_le_add hradius hbadContribution calc (∫ w, restrictedSetVolume region (affineInversionSet region (A w) (B w) (L * sqrt (K w / n))) ∂Q) ≤ min (volume region).toReal (4 * L * sqrt (Kbar / (n : ℝ)) / mu + (volume region).toReal * q) := le_min hcap hbase _ ≤ min (volume region).toReal ((4 * sqrt inflation * L) / sqrt t + Y / t) := min_le_min_left _ hsum _ ≤ max (volume region).toReal (4 * sqrt inflation * L + Y) * min 1 (t ^ (-1 / 2 : ℝ)) := inverseStrength_to_frontier hY htpos
Causalean.Stat.expectedRestrictedVolume_affineInversion_frontier_le · Causalean/Stat/Inference/AffineInversion.lean:293 · uses affineInversionSet , restrictedSetVolume
4 supporting declarations (lemmas, instances)
  • affineInversionSet_restrictedVolume_le theorem — Affine inversion has restricted volume at most the parameter-region volume and at most twice the radius divided by the nonzero slope.
    region :
    Set
    hregionFinite :
    volume region ≠ ⊤
    A B r :
    hB :
    B ≠ 0
    hr :
    0 ≤ r
    min (volume region).toReal (2 * r / |B|)
    Proof (Lean source)
    theorem affineInversionSet_restrictedVolume_le (region : Set ℝ) (hregionFinite : volume region ≠ ⊤) (A B r : ℝ) (hB : B ≠ 0) (hr : 0 ≤ r) : restrictedSetVolume region (affineInversionSet region A B r) ≤ min (volume region).toReal (2 * r / |B|) := by have hAbsB : 0 < |B| := abs_pos.mpr hB apply le_min · unfold restrictedSetVolume exact ENNReal.toReal_mono hregionFinite (measure_mono Set.inter_subset_right) · have hsub : affineInversionSet region A B r ∩ region ⊆ Icc (A / B - r / |B|) (A / B + r / |B|) := by intro x hx have hscore := hx.1.2 change A / B - r / |B| ≤ x ∧ x ≤ A / B + r / |B| have hid : A - x * B = B * (A / B - x) := by field_simp [hB] rw [hid, abs_mul] at hscore have hx' : |A / B - x| ≤ r / |B| := by rw [le_div_iff₀ hAbsB] simpa [mul_comm] using hscore rw [abs_le] at hx' constructor <;> linarith unfold restrictedSetVolume calc (volume (affineInversionSet region A B r ∩ region)).toReal ≤ (volume (Icc (A / B - r / |B|) (A / B + r / |B|))).toReal := ENNReal.toReal_mono (by simp [Real.volume_Icc]) (measure_mono hsub) _ = 2 * r / |B| := by simp [Real.volume_Icc, ENNReal.toReal_ofReal, div_nonneg hr hAbsB.le] field_simp ring
    Causalean.Stat.affineInversionSet_restrictedVolume_le · Causalean/Stat/Inference/AffineInversion.lean:28
  • affineInversionSet_restrictedVolume_le_region theorem — Affine inversion is always bounded by the volume of its parameter region.
    region :
    Set
    hregionFinite :
    volume region ≠ ⊤
    A B r :
    restrictedSetVolume region (affineInversionSet region A B r) ≤ (volume region).toReal
    Proof (Lean source)
    theorem affineInversionSet_restrictedVolume_le_region (region : Set ℝ) (hregionFinite : volume region ≠ ⊤) (A B r : ℝ) : restrictedSetVolume region (affineInversionSet region A B r) ≤ (volume region).toReal := by unfold restrictedSetVolume exact ENNReal.toReal_mono hregionFinite (measure_mono Set.inter_subset_right)
    Causalean.Stat.affineInversionSet_restrictedVolume_le_region · Causalean/Stat/Inference/AffineInversion.lean:64
  • expectedRestrictedVolume_affineInversion_le theorem — Expected restricted volume for affine inversion is controlled by the mean radius and by the probability that the random slope is less than half its positive target value.
    Ω :
    region :
    Set
    hregionFinite :
    volume region ≠ ⊤
    A B K :
    Ω → ℝ
    n :
    L mu Kbar q :
    hL :
    0 ≤ L
    hmu :
    0 < mu
    hn :
    0 < n
    hK :
    ∀ w, 0 ≤ K w
    hKint :
    hKbar :
    (∫ w, K w ∂Q) ≤ Kbar
    hbad :
    (Q {w | mu / 2 < |B w - mu|}).toReal ≤ q
    (∫ w, restrictedSetVolume region (affineInversionSet region (A w) (B w) (L * sqrt (K w / n))) ∂Q)
    ≤ 4 * L * sqrt (Kbar / n) / mu + (volume region).toReal * q
    Proof (Lean source)
    theorem expectedRestrictedVolume_affineInversion_le {Ω : Type*} [MeasurableSpace Ω] (Q : Measure Ω) [IsProbabilityMeasure Q] (region : Set ℝ) (hregionFinite : volume region ≠ ⊤) (A B K : Ω → ℝ) (n : ℕ) (L mu Kbar q : ℝ) (hL : 0 ≤ L) (hmu : 0 < mu) (hn : 0 < n) (hK : ∀ w, 0 ≤ K w) (hKint : Integrable K Q) (hKbar : (∫ w, K w ∂Q) ≤ Kbar) (hbad : (Q {w | mu / 2 < |B w - mu|}).toReal ≤ q) : (∫ w, restrictedSetVolume region (affineInversionSet region (A w) (B w) (L * sqrt (K w / n))) ∂Q) ≤ 4 * L * sqrt (Kbar / n) / mu + (volume region).toReal * q := by let F : Ω → ℝ := fun w => restrictedSetVolume region (affineInversionSet region (A w) (B w) (L * sqrt (K w / n))) let S : Ω → ℝ := fun w => sqrt (K w / n) let c : ℝ := 4 * L / mu let d : ℝ := (volume region).toReal have hnR : 0 < (n : ℝ) := by exact_mod_cast hn have hSn : ∀ w, 0 ≤ K w / (n : ℝ) := fun w => div_nonneg (hK w) hnR.le have hKnInt : Integrable (fun w => K w / (n : ℝ)) Q := hKint.div_const _ have hSint : Integrable S Q := integrable_sqrt_of_nonneg _ hKnInt hSn have hc : 0 ≤ c := div_nonneg (mul_nonneg (by norm_num) hL) hmu.le have hd : 0 ≤ d := ENNReal.toReal_nonneg have hIntK_nonneg : 0 ≤ ∫ w, K w ∂Q := integral_nonneg_of_ae (Filter.Eventually.of_forall hK) have hKbar_nonneg : 0 ≤ Kbar := hIntK_nonneg.trans hKbar have hq : 0 ≤ q := ENNReal.toReal_nonneg.trans hbad have hright_nonneg : 0 ≤ 4 * L * sqrt (Kbar / (n : ℝ)) / mu + d * q := by positivity by_cases hFi : Integrable F Q · have hgood_pointwise : ∀ w, |B w - mu| ≤ mu / 2 → F w ≤ c * S w := by intro w hw have hBabs : mu / 2 ≤ |B w| := by have hrev := abs_sub_abs_le_abs_sub mu (B w) rw [abs_of_pos hmu, abs_sub_comm] at hrev linarith have hBpos : 0 < |B w| := (half_pos hmu).trans_le hBabs have hBne : B w ≠ 0 := abs_pos.mp hBpos have hr : 0 ≤ L * S w := mul_nonneg hL (Real.sqrt_nonneg _) have hlen : F w ≤ 2 * (L * S w) / |B w| := (affineInversionSet_restrictedVolume_le region hregionFinite (A w) (B w) (L * S w) hBne hr).trans (min_le_right _ _) have hdiv : 2 * (L * S w) / |B w| ≤ 2 * (L * S w) / (mu / 2) := div_le_div_of_nonneg_left (mul_nonneg (by positivity) hr) (half_pos hmu) hBabs calc F w ≤ 2 * (L * S w) / |B w| := hlen _ ≤ 2 * (L * S w) / (mu / 2) := hdiv _ = c * S w := by dsimp [c] field_simp ring let Fm : Ω → ℝ := hFi.aestronglyMeasurable.mk F let Sm : Ω → ℝ := hSint.aestronglyMeasurable.mk S let D : Set Ω := {w | c * Sm w < Fm w} have hFm : Measurable Fm := hFi.aestronglyMeasurable.measurable_mk have hSm : Measurable Sm := hSint.aestronglyMeasurable.measurable_mk have hD : MeasurableSet D := measurableSet_lt (hSm.const_mul c) hFm have hFeq : F =ᵐ[Q] Fm := hFi.aestronglyMeasurable.ae_eq_mk have hSeq : S =ᵐ[Q] Sm := hSint.aestronglyMeasurable.ae_eq_mk have hD_bad : D ≤ᵐ[Q] {w | mu / 2 < |B w - mu|} := by filter_upwards [hFeq, hSeq] with w hFw hSw hwD by_contra hwbad have hwgood : |B w - mu| ≤ mu / 2 := le_of_not_gt hwbad have hwle := hgood_pointwise w hwgood change c * Sm w < Fm w at hwD rw [← hFw, ← hSw] at hwD linarith have hDreal : (Q D).toReal ≤ q := (ENNReal.toReal_mono (by finiteness) (measure_mono_ae hD_bad)).trans hbad have hmajorant_int : Integrable (fun w => c * S w + D.indicator (fun _ => d) w) Q := (hSint.const_mul c).add ((integrable_const d).indicator hD) have hmajorant : F ≤ᵐ[Q] fun w => c * S w + D.indicator (fun _ => d) w := by filter_upwards [hFeq, hSeq] with w hFw hSw by_cases hwD : w ∈ D · simp only [Set.indicator_of_mem hwD] have hFd : F w ≤ d := affineInversionSet_restrictedVolume_le_region region hregionFinite _ _ _ have hSnonneg : 0 ≤ S w := Real.sqrt_nonneg _ nlinarith · simp only [indicator, hwD, if_false] have hwle : Fm w ≤ c * Sm w := le_of_not_gt hwD rw [← hFw, ← hSw] at hwle simpa using hwle have hJensen : (∫ w, S w ∂Q) ≤ sqrt ((∫ w, K w ∂Q) / (n : ℝ)) := by have hj := Real.strictConcaveOn_sqrt.concaveOn.le_map_integral Real.continuous_sqrt.continuousOn isClosed_Ici (Filter.Eventually.of_forall hSn) hKnInt hSint simpa [S, Function.comp_def, integral_div] using hj have hsqrt_mono : sqrt ((∫ w, K w ∂Q) / (n : ℝ)) ≤ sqrt (Kbar / (n : ℝ)) := Real.sqrt_le_sqrt (div_le_div_of_nonneg_right hKbar hnR.le) calc (∫ w, restrictedSetVolume region (affineInversionSet region (A w) (B w) (L * sqrt (K w / n))) ∂Q) = ∫ w, F w ∂Q := by rfl _ ≤ ∫ w, c * S w + D.indicator (fun _ => d) w ∂Q := integral_mono_ae hFi hmajorant_int hmajorant _ = c * (∫ w, S w ∂Q) + d * (Q D).toReal := by rw [integral_add (hSint.const_mul c) ((integrable_const d).indicator hD), integral_const_mul, integral_indicator_const d hD] simp only [smul_eq_mul, Measure.real] ring _ ≤ c * sqrt (Kbar / (n : ℝ)) + d * q := by gcongr exact hJensen.trans hsqrt_mono _ = 4 * L * sqrt (Kbar / (n : ℝ)) / mu + d * q := by dsimp [c] ring · rw [show (∫ w, restrictedSetVolume region (affineInversionSet region (A w) (B w) (L * sqrt (K w / n))) ∂Q) = 0 by exact integral_undef hFi] exact hright_nonneg
    Causalean.Stat.expectedRestrictedVolume_affineInversion_le · Causalean/Stat/Inference/AffineInversion.lean:88
  • inverseStrength_to_frontier theorem — An inverse-root plus inverse-strength bound, capped by a nonnegative region volume, is bounded by the compact inverse-square-root frontier form.
    cap A B t :
    hB :
    0 ≤ B
    ht :
    0 < t
    min cap (A / sqrt t + B / t) ≤ max cap (A + B) * min 1 (t ^ (-1 / 2 : ℝ))
    Proof (Lean source)
    theorem inverseStrength_to_frontier {cap A B t : ℝ} (hB : 0 ≤ B) (ht : 0 < t) : min cap (A / sqrt t + B / t) ≤ max cap (A + B) * min 1 (t ^ (-1 / 2 : ℝ)) := by by_cases ht1 : t ≤ 1 · rw [min_eq_left (Real.one_le_rpow_of_pos_of_le_one_of_nonpos ht ht1 (by norm_num))] simp only [mul_one] exact (min_le_left _ _).trans (le_max_left _ _) · have h1t : 1 ≤ t := le_of_not_ge ht1 rw [min_eq_right (Real.rpow_le_one_of_one_le_of_nonpos h1t (by norm_num))] have hsqrt : 0 < sqrt t := Real.sqrt_pos.2 ht have hsqrt_le_t : sqrt t ≤ t := by nlinarith [Real.sq_sqrt ht.le] have hBt : B / t ≤ B / sqrt t := div_le_div_of_nonneg_left hB hsqrt hsqrt_le_t have hsum : A / sqrt t + B / t ≤ (A + B) / sqrt t := by calc A / sqrt t + B / t ≤ A / sqrt t + B / sqrt t := add_le_add_right hBt _ _ = (A + B) / sqrt t := by ring calc min cap (A / sqrt t + B / t) ≤ A / sqrt t + B / t := min_le_right _ _ _ ≤ (A + B) / sqrt t := hsum _ = (A + B) * t ^ (-1 / 2 : ℝ) := by rw [show (-1 / 2 : ℝ) = -(1 / 2) by norm_num, Real.rpow_neg ht.le, ← Real.sqrt_eq_rpow] simp [div_eq_mul_inv] _ ≤ max cap (A + B) * t ^ (-1 / 2 : ℝ) := mul_le_mul_of_nonneg_right (le_max_right _ _) (Real.rpow_nonneg ht.le _)
    Causalean.Stat.inverseStrength_to_frontier · Causalean/Stat/Inference/AffineInversion.lean:238
Chi­Squared­Wald 3 core · 2 supporting This file identifies the Gaussian Wald quadratic form with a chi-squared law and then specializes multivariate Wald coverage to that limit. ★ gaussianLimit_waldForm_map★ wald_coverage_chiSq

This file identifies the Gaussian Wald quadratic form with a chi-squared law and then specializes multivariate Wald coverage to that limit. It constructs the inverse secondMomentInv of the second-moment operator from the positive square root, proves the two-sided inverse identities secondMomentInv_secondMomentLM and secondMomentLM_secondMomentInv, and uses whitening in gaussianLimit_waldForm_map to show that gaussianLimit hψ hvar pushed through S ↦ ⟪S, Σ⁻¹ S⟫ is chiSqDist (Module.finrank ℝ E).

The final theorem Tendsto_dist.wald_coverage_chiSq plugs that chi-squared limit into the generic ellipsoid-coverage theorem from Causalean.Stat.Inference.WaldVec.

def secondMomentInv reviewed
Causalean.Stat

The inverse Σ⁻¹ = (√Σ)⁻¹ ∘ (√Σ)⁻¹ of the second-moment operator, as a continuous linear map (continuity is automatic in finite dimension).

Definition (Lean source)
noncomputable def secondMomentInv (hinj : Injective (secondMomentLM hψ hvar)) : E →L[ℝ] E := (((posSqrtEquiv hψ hvar hinj).symm.trans (posSqrtEquiv hψ hvar hinj).symm) : E →ₗ[ℝ] E).toContinuousLinearMap
theorem gaussianLimit_waldForm_map reviewed
Causalean.Stat

χ² identification of the Wald quadratic form. When the linear map induced by the asymptotic-variance operator Σ is injective, i.e. Σ is non-degenerate, the multivariate-CLT Gaussian limit, pushed through the Wald quadratic form S ↦ ⟪S, Σ⁻¹ S⟫, is exactly the χ²_d distribution, with d the dimension of the ambient space.

Formal statement
hinj :
(gaussianLimit hψ hvar).map (fun S => ⟪S, secondMomentInv hψ hvar hinj S⟫)
= chiSqDist (finrank ℝ E)
Proof (Lean source)
theorem gaussianLimit_waldForm_map (hinj : Injective (secondMomentLM hψ hvar)) : (gaussianLimit hψ hvar).map (fun S => ⟪S, secondMomentInv hψ hvar hinj S⟫) = chiSqDist (finrank ℝ E) := by have hQmeas : Measurable (fun S : E => ⟪S, secondMomentInv hψ hvar hinj S⟫) := (continuous_id.inner (secondMomentInv hψ hvar hinj).continuous).measurable rw [gaussianLimit, Measure.map_map hQmeas (secondMomentLM_isPositive hψ hvar).posSqrtCLM.continuous.measurable, ← stdGaussian_map_normSq (E := E)] refine Measure.map_congr (ae_of_all _ fun w => ?_) change ⟪(secondMomentLM_isPositive hψ hvar).posSqrtCLM w, secondMomentInv hψ hvar hinj ((secondMomentLM_isPositive hψ hvar).posSqrtCLM w)⟫ = ‖w‖ ^ 2 rw [(secondMomentLM_isPositive hψ hvar).posSqrtCLM_apply] exact waldForm_posSqrt hψ hvar hinj w
theorem wald_coverage_chiSq reviewed
Causalean.Stat.Tendsto_dist

χ²-coverage of the Wald confidence ellipsoid. Suppose the Wald statistic sequence Wₙ is measurable at every sample size, d is a positive-integer degrees-of-freedom parameter, and Wₙ converges in distribution to the χ²_d law. If a coverage-probability sequence coverProb is asymptotically equivalent to the ellipsoid event {Wₙ ≤ c}, then coverProb converges to the χ²_d probability of (-∞, c].

Formal statement
Ω :
Wn :
ℕ → Ω → ℝ
hWn :
∀ n, AEMeasurable (Wn n) ν
d :
hd :
1 ≤ d
hW :
Tendsto_dist Wn (chiSqDist d) ν hWn
c :
coverProb :
ℕ → ℝ
h_bridge :
Tendsto (fun n => coverProb n - (ν {ω | Wn n ω ≤ c}).toReal) atTop (𝓝 0)
Tendsto coverProb atTop (𝓝 ((chiSqDist d (Iic c)).toReal))
Proof (Lean source)
theorem Tendsto_dist.wald_coverage_chiSq {Ω : Type*} [MeasurableSpace Ω] {ν : Measure Ω} [IsProbabilityMeasure ν] {Wn : ℕ → Ω → ℝ} (hWn : ∀ n, AEMeasurable (Wn n) ν) {d : ℕ} (hd : 1 ≤ d) (hW : Tendsto_dist Wn (chiSqDist d) ν hWn) (c : ℝ) (coverProb : ℕ → ℝ) (h_bridge : Tendsto (fun n => coverProb n - (ν {ω | Wn n ω ≤ c}).toReal) atTop (𝓝 0)) : Tendsto coverProb atTop (𝓝 ((chiSqDist d (Iic c)).toReal)) := by haveI := noAtoms_chiSqDist hd exact Tendsto_dist.wald_coverage_Iic_of_noAtoms hWn hW c coverProb h_bridge
2 supporting declarations (lemmas, instances)
Delta­Method 2 core · 0 supporting This file proves smooth delta-method results for asymptotically normal estimators. ★ deltaMethod_scalar★ deltaMethod

This file proves smooth delta-method results for asymptotically normal estimators. The scalar theorem deltaMethod_scalar transforms √n (Tn - t₀) ⇒ gaussianMeasure 0 σsq through a differentiable real map and returns the Gaussian limit with variance parameter g' ^ 2 * σsq.

The multivariate theorem deltaMethod works at the probability-measure level: if √n • (Tn - t₀) converges weakly to Q and g has Fréchet derivative Dg at t₀, then the laws of √n • (g (Tn) - g t₀) converge to the pushforward Q.toMeasure.map Dg. The proofs use the stochastic-order and tightness utilities from Causalean.Stat.Limit.Convergence.

theorem deltaMethod_scalar reviewed
Causalean.Stat

Scalar delta method. For a real-valued estimator sequence Tn of a target t₀, suppose the rescaled deviation √n(Tn − t₀) is measurable at every sample size and the rescaled image √n(g(Tn) − g(t₀)) is measurable at every sample size, where g is differentiable at t₀ with derivative g'. If the rescaled deviation converges in distribution to the project's Gaussian law with mean zero and variance σ², then the rescaled image converges in distribution to the same Gaussian wrapper with variance g'² · σ².

Formal statement
Tn :
ℕ → Ω → ℝ
t₀ :
g :
ℝ → ℝ
g' σsq :
hTn :
∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) * (Tn n ω - t₀)) μ
hgTn :
∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) * (g (Tn n ω) - g t₀)) μ
_hg :
HasDerivAt g g' t₀
_hCLT :
Tendsto_dist (fun (n : ℕ) ω => sqrt (n : ℝ) * (Tn n ω - t₀)) (gaussianMeasure 0 σsq) μ hTn
Tendsto_dist (fun (n : ℕ) ω => sqrt (n : ℝ) * (g (Tn n ω) - g t₀)) (gaussianMeasure 0 (g' ^ 2 * σsq)) μ hgTn
Proof (Lean source)
theorem deltaMethod_scalar (Tn : ℕ → Ω → ℝ) (t₀ : ℝ) (g : ℝ → ℝ) (g' σsq : ℝ) (hTn : ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) * (Tn n ω - t₀)) μ) (hgTn : ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) * (g (Tn n ω) - g t₀)) μ) (_hg : HasDerivAt g g' t₀) (_hCLT : Tendsto_dist (fun (n : ℕ) ω => sqrt (n : ℝ) * (Tn n ω - t₀)) (gaussianMeasure 0 σsq) μ hTn) : Tendsto_dist (fun (n : ℕ) ω => sqrt (n : ℝ) * (g (Tn n ω) - g t₀)) (gaussianMeasure 0 (g' ^ 2 * σsq)) μ hgTn := by let Sn : ℕ → Ω → ℝ := fun n ω => sqrt (n : ℝ) * (Tn n ω - t₀) let Zn : ℕ → Ω → ℝ := fun n ω => g' * Sn n ω let Yn : ℕ → Ω → ℝ := fun n ω => sqrt (n : ℝ) * (g (Tn n ω) - g t₀) have hSn_meas : ∀ n, AEMeasurable (Sn n) μ := by simpa [Sn] using hTn have hZn_meas : ∀ n, AEMeasurable (Zn n) μ := by intro n exact (hSn_meas n).const_mul g' have hYn_meas : ∀ n, AEMeasurable (Yn n) μ := by simpa [Yn] using hgTn have hSnBig : IsBigOp Sn (fun _ => (1 : ℝ)) μ := by simpa [Sn] using Tendsto_dist.tightness hTn _hCLT have hZdist : Tendsto_dist Zn (gaussianMeasure 0 (g' ^ 2 * σsq)) μ hZn_meas := by simpa [Sn, Zn] using Tendsto_dist.const_mul_tendsto_gaussian (a := fun _ : ℕ => g') (a₀ := g') (v := σsq) hSn_meas (by simpa [Sn] using _hCLT) tendsto_const_nhds have hInvSqrt : Tendsto (fun n : ℕ => (sqrt (n : ℝ))⁻¹) atTop (𝓝 0) := by have hsqrt_atTop : Tendsto (fun n : ℕ => sqrt (n : ℝ)) atTop atTop := by exact Real.tendsto_sqrt_atTop.comp tendsto_natCast_atTop_atTop exact tendsto_inv_atTop_zero.comp hsqrt_atTop have hDeltaScaled : IsLittleOp (fun n ω => (sqrt (n : ℝ))⁻¹ * Sn n ω) (fun _ => (1 : ℝ)) μ := IsBigOp.const_mul_tendsto_zero hSnBig hInvSqrt have hEqD : ∀ᶠ (n : ℕ) in atTop, (fun ω => (sqrt (n : ℝ))⁻¹ * Sn n ω) = (fun ω => Tn n ω - t₀) := by filter_upwards [eventually_ge_atTop (1 : ℕ)] with n hn funext ω have hnpos_nat : 0 < n := lt_of_lt_of_le zero_lt_one hn have hnpos : 0 < (n : ℝ) := by exact_mod_cast hnpos_nat have hsqrt_ne : sqrt (n : ℝ) ≠ 0 := (Real.sqrt_pos.2 hnpos).ne' calc (sqrt (n : ℝ))⁻¹ * Sn n ω = (sqrt (n : ℝ))⁻¹ * (sqrt (n : ℝ) * (Tn n ω - t₀)) := by rfl _ = ((sqrt (n : ℝ))⁻¹ * sqrt (n : ℝ)) * (Tn n ω - t₀) := by ring _ = Tn n ω - t₀ := by rw [inv_mul_cancel₀ hsqrt_ne, one_mul] have hDeltaProb : ∀ ρ : ℝ, 0 < ρ → Tendsto (fun n => μ {ω | ρ < |Tn n ω - t₀|}) atTop (𝓝 0) := by intro ρ hρ have h := hDeltaScaled ρ hρ refine h.congr' ?_ filter_upwards [hEqD] with n hn congr 1 ext ω change ρ * (fun _ => (1 : ℝ)) n < |(fun ω => (sqrt (n : ℝ))⁻¹ * Sn n ω) ω| ↔ ρ < |Tn n ω - t₀| have heq : (fun ω => (sqrt (n : ℝ))⁻¹ * Sn n ω) ω = Tn n ω - t₀ := congr_fun hn ω simp [heq] have hRn : IsLittleOp (fun n ω => Yn n ω - Zn n ω) (fun _ => (1 : ℝ)) μ := by intro ε hε rw [ENNReal.tendsto_nhds_zero] intro δ hδ by_cases hδtop : δ = ⊤ · filter_upwards with n simp [hδtop] have hδpos : 0 < δ.toReal := ENNReal.toReal_pos (ne_of_gt hδ) hδtop let α : ℝ := δ.toReal / 8 have hαpos : 0 < α := by dsimp [α] linarith rcases hSnBig α hαpos with ⟨M0, hM0⟩ let M : ℝ := max M0 1 have hMpos : 0 < M := by dsimp [M] exact lt_of_lt_of_le zero_lt_one (le_max_right M0 1) have hM0le : M0 ≤ M := by dsimp [M] exact le_max_left M0 1 let A : ℕ → Set Ω := fun n => {ω | M < |Sn n ω|} let C : ℕ → Set Ω := fun n => {ω | ε < |Yn n ω - Zn n ω|} have hlimA : limsup (fun n => μ (A n)) atTopofReal α := by refine le_trans (Filter.limsup_le_limsup (Eventually.of_forall ?_)) hM0 intro n apply measure_mono intro ω hω dsimp [A, Sn] at hω ⊢ nlinarith have halpha_two : ofReal α < ofReal (2 * α) := by rw [ENNReal.ofReal_lt_ofReal_iff] · linarith · linarith have hAevent := Filter.eventually_lt_of_limsup_lt (lt_of_le_of_lt hlimA halpha_two) let η : ℝ := ε / M have hηpos : 0 < η := by dsimp [η] exact div_pos hε hMpos have hderiv_event : ∀ᶠ x in 𝓝 t₀, |g x - g t₀ - g' * (x - t₀)| ≤ η * |x - t₀| := by have hderiv_event0 := _hg.isLittleO.def hηpos filter_upwards [hderiv_event0] with x hx simpa [Real.norm_eq_abs, smul_eq_mul, mul_comm, mul_left_comm, mul_assoc] using hx rcases Metric.eventually_nhds_iff.mp hderiv_event with ⟨ρ, hρpos, hρprop⟩ let B : ℕ → Set Ω := fun n => {ω | ρ ≤ |Tn n ω - t₀|} have hDeltaHalf := hDeltaProb (ρ / 2) (by linarith) have hBsmall0 := (ENNReal.tendsto_nhds_zero.mp hDeltaHalf) (ofReal α) (by exact ENNReal.ofReal_pos.mpr hαpos) have hBevent : ∀ᶠ n in atTop, μ (B n) < ofReal (2 * α) := by filter_upwards [hBsmall0] with n hn exact lt_of_le_of_lt (le_trans (measure_mono (by intro ω hω dsimp [B] at hω have : ρ / 2 < |Tn n ω - t₀| := by linarith exact this)) hn) halpha_two have hpoint : ∀ n, μ (C n) ≤ μ (A n) + μ (B n) := by intro n have hsubset : C n ⊆ A n ∪ B n := by intro ω hω by_contra hnot have hnotA : ¬ M < |Sn n ω| := by intro hx exact hnot (inl hx) have hnotB : ¬ ρ ≤ |Tn n ω - t₀| := by intro hx exact hnot (inr hx) have hSnle : |Sn n ω| ≤ M := le_of_not_gt hnotA have hnear : |Tn n ω - t₀| < ρ := lt_of_not_ge hnotB have hder := hρprop (by simpa [Real.dist_eq] using hnear) have hRabs : |Yn n ω - Zn n ω| ≤ η * |Sn n ω| := by calc |Yn n ω - Zn n ω| = |sqrt (n : ℝ) * (g (Tn n ω) - g t₀ - g' * (Tn n ω - t₀))| := by dsimp [Yn, Zn, Sn] congr 1 ring _ = |sqrt (n : ℝ)| * |g (Tn n ω) - g t₀ - g' * (Tn n ω - t₀)| := by rw [abs_mul] _ = sqrt (n : ℝ) * |g (Tn n ω) - g t₀ - g' * (Tn n ω - t₀)| := by rw [abs_of_nonneg (Real.sqrt_nonneg _)] _ ≤ sqrt (n : ℝ) * (η * |Tn n ω - t₀|) := by exact mul_le_mul_of_nonneg_left hder (Real.sqrt_nonneg _) _ = η * |Sn n ω| := by dsimp [Sn] rw [abs_mul, abs_of_nonneg (Real.sqrt_nonneg _)] ring have hRle : |Yn n ω - Zn n ω| ≤ ε := by calc |Yn n ω - Zn n ω| ≤ η * |Sn n ω| := hRabs _ ≤ η * M := by exact mul_le_mul_of_nonneg_left hSnle (le_of_lt hηpos) _ = ε := by dsimp [η] field_simp [hMpos.ne'] exact not_lt_of_ge hRle hω calc μ (C n) ≤ μ (A n ∪ B n) := measure_mono hsubset _ ≤ μ (A n) + μ (B n) := MeasureTheory.measure_union_le (A n) (B n) have hfour_alpha_lt_delta : ofReal (4 * α) < δ := by rw [ENNReal.ofReal_lt_iff_lt_toReal] · dsimp [α] linarith · dsimp [α] linarith [le_of_lt hδpos] · exact hδtop filter_upwards [hAevent, hBevent] with n hAn hBn exact le_of_lt <| calc μ {ω | ε * (fun _ => (1 : ℝ)) n < |Yn n ω - Zn n ω|} = μ (C n) := by simp [C] _ ≤ μ (A n) + μ (B n) := hpoint n _ < ofReal (2 * α) + ofReal (2 * α) := ENNReal.add_lt_add hAn hBn _ = ofReal (4 * α) := by rw [← ENNReal.ofReal_add] · congr 1; ring · linarith · linarith _ < δ := hfour_alpha_lt_delta simpa [Yn] using Tendsto_dist.add_isLittleOp_one hZn_meas hYn_meas hZdist hRn
theorem deltaMethod reviewed
Causalean.Stat

Multivariate delta method. Let Tn be a sequence of E-valued estimators of a target t₀, and let g : E → F be Fréchet-differentiable at t₀ with derivative Dg. Given that the rescaled deviations √n • (Tn − t₀) are measurable at every sample size and that their images √n • (g(Tn) − g(t₀)) are measurable at every sample size, if the laws of √n • (Tn − t₀) converge weakly to a probability measure Q on E, then the laws of √n • (g(Tn) − g(t₀)) converge weakly to the pushforward of Q along the linear map Dg.

Formal statement
Tn :
ℕ → Ω → E
t₀ :
E
g :
E → F
Dg :
E →L[ℝ] F
hTn :
∀ n, AEMeasurable (fun ω => (sqrt ((n : ℕ) : ℝ)) • (Tn n ω - t₀)) μ
hgTn :
∀ n, AEMeasurable (fun ω => (sqrt ((n : ℕ) : ℝ)) • (g (Tn n ω) - g t₀)) μ
_hg :
HasFDerivAt g Dg t₀
_hCLT :
Tendsto (β := ProbabilityMeasure E) (fun n => ⟨μ.map (fun ω => (sqrt ((n : ℕ) : ℝ)) • (Tn n ω - t₀)), Measure.isProbabilityMeasure_map (hTn n)⟩) atTop (𝓝 Q)
Tendsto (β := ProbabilityMeasure F) (fun n => ⟨μ.map (fun ω => (sqrt ((n : ℕ) : ℝ)) • (g (Tn n ω) - g t₀)), Measure.isProbabilityMeasure_map (hgTn n)⟩) atTop (𝓝 ⟨Q.toMeasure.map Dg, Measure.isProbabilityMeasure_map Dg.continuous.measurable.aemeasurable⟩)
Proof (Lean source)
theorem deltaMethod (Tn : ℕ → Ω → E) (t₀ : E) (g : E → F) (Dg : E →L[ℝ] F) (Q : ProbabilityMeasure E) (hTn : ∀ n, AEMeasurable (fun ω => (sqrt ((n : ℕ) : ℝ)) • (Tn n ω - t₀)) μ) (hgTn : ∀ n, AEMeasurable (fun ω => (sqrt ((n : ℕ) : ℝ)) • (g (Tn n ω) - g t₀)) μ) (_hg : HasFDerivAt g Dg t₀) (_hCLT : Tendsto (β := ProbabilityMeasure E) (fun n => ⟨μ.map (fun ω => (sqrt ((n : ℕ) : ℝ)) • (Tn n ω - t₀)), Measure.isProbabilityMeasure_map (hTn n)⟩) atTop (𝓝 Q)) : Tendsto (β := ProbabilityMeasure F) (fun n => ⟨μ.map (fun ω => (sqrt ((n : ℕ) : ℝ)) • (g (Tn n ω) - g t₀)), Measure.isProbabilityMeasure_map (hgTn n)⟩) atTop (𝓝 ⟨Q.toMeasure.map Dg, Measure.isProbabilityMeasure_map Dg.continuous.measurable.aemeasurable⟩) := by let Sn : ℕ → Ω → E := fun n ω => (sqrt ((n : ℕ) : ℝ)) • (Tn n ω - t₀) let Zn : ℕ → Ω → F := fun n ω => Dg (Sn n ω) let Yn : ℕ → Ω → F := fun n ω => (sqrt ((n : ℕ) : ℝ)) • (g (Tn n ω) - g t₀) haveI : IsProbabilityMeasure (Q.toMeasure) := Q.2 haveI : IsProbabilityMeasure (Q.toMeasure.map (fun x : E => ‖x‖)) := Measure.isProbabilityMeasure_map continuous_norm.measurable.aemeasurable haveI : IsProbabilityMeasure (Q.toMeasure.map Dg) := Measure.isProbabilityMeasure_map Dg.continuous.measurable.aemeasurable have hSn_meas : ∀ n, AEMeasurable (Sn n) μ := by simpa [Sn] using hTn have hZn_meas : ∀ n, AEMeasurable (Zn n) μ := by intro n exact Dg.continuous.measurable.comp_aemeasurable (hSn_meas n) have hYn_meas : ∀ n, AEMeasurable (Yn n) μ := by simpa [Yn] using hgTn have hSnDist : Tendsto_dist_vec Sn Q.toMeasure μ hSn_meas := by change Tendsto (β := ProbabilityMeasure E) (fun n => ⟨μ.map (Sn n), Measure.isProbabilityMeasure_map (hSn_meas n)⟩) atTop (𝓝 Q) simpa [Sn] using _hCLT have hNormSn_meas : ∀ n, AEMeasurable (fun ω => ‖Sn n ω‖) μ := by intro n exact continuous_norm.measurable.comp_aemeasurable (hSn_meas n) have hNormDistVec : Tendsto_dist_vec (fun n ω => ‖Sn n ω‖) (Q.toMeasure.map (fun x : E => ‖x‖)) μ hNormSn_meas := by exact Tendsto_dist_vec.map_continuous (Q := Q.toMeasure) (g := fun x : E => ‖x‖) continuous_norm hSn_meas hSnDist have hNormDist : Tendsto_dist (fun n ω => ‖Sn n ω‖) (Q.toMeasure.map (fun x : E => ‖x‖)) μ hNormSn_meas := by change Tendsto (β := ProbabilityMeasure ℝ) (fun n => ⟨μ.map ((fun n ω => ‖Sn n ω‖) n), Measure.isProbabilityMeasure_map (hNormSn_meas n)⟩) atTop (𝓝 ⟨Q.toMeasure.map (fun x : E => ‖x‖), inferInstance⟩) at hNormDistVec exact hNormDistVec have hSnBig : IsBigOp (fun n ω => ‖Sn n ω‖) (fun _ => (1 : ℝ)) μ := Tendsto_dist.tightness hNormSn_meas hNormDist have hInvSqrt : Tendsto (fun n : ℕ => (sqrt (n : ℝ))⁻¹) atTop (𝓝 0) := by have hsqrt_atTop : Tendsto (fun n : ℕ => sqrt (n : ℝ)) atTop atTop := by exact Real.tendsto_sqrt_atTop.comp tendsto_natCast_atTop_atTop exact tendsto_inv_atTop_zero.comp hsqrt_atTop have hDeltaScaled : IsLittleOp (fun n ω => (sqrt (n : ℝ))⁻¹ * ‖Sn n ω‖) (fun _ => (1 : ℝ)) μ := IsBigOp.const_mul_tendsto_zero hSnBig hInvSqrt have hEqD : ∀ᶠ (n : ℕ) in atTop, (fun ω => (sqrt (n : ℝ))⁻¹ * ‖Sn n ω‖) = (fun ω => ‖Tn n ω - t₀‖) := by filter_upwards [eventually_ge_atTop (1 : ℕ)] with n hn funext ω have hnpos_nat : 0 < n := lt_of_lt_of_le zero_lt_one hn have hnpos : 0 < (n : ℝ) := by exact_mod_cast hnpos_nat have hsqrt_ne : sqrt (n : ℝ) ≠ 0 := (Real.sqrt_pos.2 hnpos).ne' calc (sqrt (n : ℝ))⁻¹ * ‖Sn n ω‖ = (sqrt (n : ℝ))⁻¹ * ‖(sqrt (n : ℝ)) • (Tn n ω - t₀)‖ := by rfl _ = (sqrt (n : ℝ))⁻¹ * (sqrt (n : ℝ) * ‖Tn n ω - t₀‖) := by rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _)] _ = ‖Tn n ω - t₀‖ := by rw [← mul_assoc, inv_mul_cancel₀ hsqrt_ne, one_mul] have hDeltaProb : ∀ ρ : ℝ, 0 < ρ → Tendsto (fun n => μ {ω | ρ < ‖Tn n ω - t₀‖}) atTop (𝓝 0) := by intro ρ hρ have h := hDeltaScaled ρ hρ refine h.congr' ?_ filter_upwards [hEqD] with n hn congr 1 ext ω change ρ * (fun _ => (1 : ℝ)) n < |(fun ω => (sqrt (n : ℝ))⁻¹ * ‖Sn n ω‖) ω| ↔ ρ < ‖Tn n ω - t₀‖ have heq : (fun ω => (sqrt (n : ℝ))⁻¹ * ‖Sn n ω‖) ω = ‖Tn n ω - t₀‖ := congr_fun hn ω simp [heq] have hRn : IsLittleOp (fun n ω => ‖Yn n ω - Zn n ω‖) (fun _ => (1 : ℝ)) μ := by intro ε hε rw [ENNReal.tendsto_nhds_zero] intro δ hδ by_cases hδtop : δ = ⊤ · filter_upwards with n simp [hδtop] have hδpos : 0 < δ.toReal := ENNReal.toReal_pos (ne_of_gt hδ) hδtop let α : ℝ := δ.toReal / 8 have hαpos : 0 < α := by dsimp [α] linarith rcases hSnBig α hαpos with ⟨M0, hM0⟩ let M : ℝ := max M0 1 have hMpos : 0 < M := by dsimp [M] exact lt_of_lt_of_le zero_lt_one (le_max_right M0 1) have hM0le : M0 ≤ M := by dsimp [M] exact le_max_left M0 1 let A : ℕ → Set Ω := fun n => {ω | M < ‖Sn n ω‖} let C : ℕ → Set Ω := fun n => {ω | ε < ‖Yn n ω - Zn n ω‖} have hlimA : limsup (fun n => μ (A n)) atTopofReal α := by refine le_trans (Filter.limsup_le_limsup (Eventually.of_forall ?_)) hM0 intro n apply measure_mono intro ω hω dsimp [A] at hω ⊢ have hM0_lt : M0 < ‖Sn n ω‖ := lt_of_le_of_lt hM0le hω simpa [abs_of_nonneg (norm_nonneg (Sn n ω))] using hM0_lt have halpha_two : ofReal α < ofReal (2 * α) := by rw [ENNReal.ofReal_lt_ofReal_iff] · linarith · linarith have hAevent := Filter.eventually_lt_of_limsup_lt (lt_of_le_of_lt hlimA halpha_two) let η : ℝ := ε / M have hηpos : 0 < η := by dsimp [η] exact div_pos hε hMpos have hderiv_event : ∀ᶠ x in 𝓝 t₀, ‖g x - g t₀ - Dg (x - t₀)‖ ≤ η * ‖x - t₀‖ := by have hderiv_event0 := _hg.isLittleO.def hηpos filter_upwards [hderiv_event0] with x hx simpa using hx rcases Metric.eventually_nhds_iff.mp hderiv_event with ⟨ρ, hρpos, hρprop⟩ let B : ℕ → Set Ω := fun n => {ω | ρ ≤ ‖Tn n ω - t₀‖} have hDeltaHalf := hDeltaProb (ρ / 2) (by linarith) have hBsmall0 := (ENNReal.tendsto_nhds_zero.mp hDeltaHalf) (ofReal α) (by exact ENNReal.ofReal_pos.mpr hαpos) have hBevent : ∀ᶠ n in atTop, μ (B n) < ofReal (2 * α) := by filter_upwards [hBsmall0] with n hn exact lt_of_le_of_lt (le_trans (measure_mono (by intro ω hω dsimp [B] at hω have : ρ / 2 < ‖Tn n ω - t₀‖ := by linarith exact this)) hn) halpha_two have hpoint : ∀ n, μ (C n) ≤ μ (A n) + μ (B n) := by intro n have hsubset : C n ⊆ A n ∪ B n := by intro ω hω by_contra hnot have hnotA : ¬ M < ‖Sn n ω‖ := by intro hx exact hnot (inl hx) have hnotB : ¬ ρ ≤ ‖Tn n ω - t₀‖ := by intro hx exact hnot (inr hx) have hSnle : ‖Sn n ω‖ ≤ M := le_of_not_gt hnotA have hnear : ‖Tn n ω - t₀‖ < ρ := lt_of_not_ge hnotB have hder := hρprop (by simpa [dist_eq_norm] using hnear) have hRnorm : ‖Yn n ω - Zn n ω‖ ≤ η * ‖Sn n ω‖ := by calc ‖Yn n ω - Zn n ω‖ = ‖(sqrt (n : ℝ)) • (g (Tn n ω) - g t₀ - Dg (Tn n ω - t₀))‖ := by dsimp [Yn, Zn, Sn] rw [Dg.map_smul] congr 1 simp [smul_sub] _ = sqrt (n : ℝ) * ‖g (Tn n ω) - g t₀ - Dg (Tn n ω - t₀)‖ := by rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _)] _ ≤ sqrt (n : ℝ) * (η * ‖Tn n ω - t₀‖) := by exact mul_le_mul_of_nonneg_left hder (Real.sqrt_nonneg _) _ = η * ‖Sn n ω‖ := by dsimp [Sn] rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _)] ring have hRle : ‖Yn n ω - Zn n ω‖ ≤ ε := by calc ‖Yn n ω - Zn n ω‖ ≤ η * ‖Sn n ω‖ := hRnorm _ ≤ η * M := by exact mul_le_mul_of_nonneg_left hSnle (le_of_lt hηpos) _ = ε := by dsimp [η] field_simp [hMpos.ne'] exact not_lt_of_ge hRle hω calc μ (C n) ≤ μ (A n ∪ B n) := measure_mono hsubset _ ≤ μ (A n) + μ (B n) := MeasureTheory.measure_union_le (A n) (B n) have hfour_alpha_lt_delta : ofReal (4 * α) < δ := by rw [ENNReal.ofReal_lt_iff_lt_toReal] · dsimp [α] linarith · dsimp [α] linarith [le_of_lt hδpos] · exact hδtop filter_upwards [hAevent, hBevent] with n hAn hBn exact le_of_lt <| calc μ {ω | ε * (fun _ => (1 : ℝ)) n < |‖Yn n ω - Zn n ω‖|} = μ (C n) := by simp [C] _ ≤ μ (A n) + μ (B n) := hpoint n _ < ofReal (2 * α) + ofReal (2 * α) := ENNReal.add_lt_add hAn hBn _ = ofReal (4 * α) := by rw [← ENNReal.ofReal_add] · congr 1; ring · linarith · linarith _ < δ := hfour_alpha_lt_delta have hZdist : Tendsto_dist_vec Zn (Q.toMeasure.map Dg) μ hZn_meas := by exact Tendsto_dist_vec.map_continuous (Q := Q.toMeasure) (g := fun x : E => Dg x) Dg.continuous hSn_meas hSnDist change Tendsto_dist_vec Yn (Q.toMeasure.map Dg) μ hYn_meas exact Tendsto_dist_vec.add_isLittleOp_one (Q := Q.toMeasure.map Dg) (Xn := Zn) (Yn := Yn) hZn_meas hYn_meas hZdist hRn
Functional­Delta 2 core · 7 supporting This file develops the directional functional delta method for max/min lattice functionals. ★ deltaMethod_max_tie★ deltaMethod_min_tie

This file develops the directional functional delta method for max/min lattice functionals. It provides the reusable Slutsky lemma isLittleOp_one_of_measure_ne_tendsto_zero, probability-measure instances for Q.map max and Q.map min, exact tie identities sqrt_mul_max_sub and sqrt_mul_min_sub, and derived measurability lemmas for the image statistics.

The headline theorems deltaMethod_max_tie and deltaMethod_min_tie cover the binding case a = b: a joint CLT for √n • ((an,bn) - (a,a)) is pushed through the continuous lattice functional, yielding the generally non-Gaussian laws Q.map (fun z => max z.1 z.2) and Q.map (fun z => min z.1 z.2).

theorem deltaMethod_max_tie reviewed
Causalean.Stat

Directional delta method for max at a tie. Let ân, b̂n be two real-valued estimator sequences of a common value a. Suppose the joint rescaled deviation √n • ((ân, b̂n) − (a, a)) is measurable at every sample size and it converges in distribution to a probability measure Q on ℝ × ℝ. Then the rescaled deviation of the pointwise maximum, √n · (max(ân, b̂n) − a), converges in distribution to the pushforward of Q under the map (x, y) ↦ max(x, y).

Formal statement
an bn :
ℕ → Ω → ℝ
a :
Q :
hSn_meas :
∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) μ
hCLT :
Tendsto_dist_vec (fun (n : ℕ) ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) Q μ hSn_meas
Tendsto_dist (fun (n : ℕ) ω => sqrt (n : ℝ) * (max (an n ω) (bn n ω) - a)) (Q.map (fun z : ℝ × ℝ => max z.1 z.2)) μ (maxStat_aemeasurable an bn a hSn_meas)
Proof (Lean source)
theorem deltaMethod_max_tie (an bn : ℕ → Ω → ℝ) (a : ℝ) (Q : Measure (ℝ × ℝ)) [IsProbabilityMeasure Q] (hSn_meas : ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) μ) (hCLT : Tendsto_dist_vec (fun (n : ℕ) ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) Q μ hSn_meas) : Tendsto_dist (fun (n : ℕ) ω => sqrt (n : ℝ) * (max (an n ω) (bn n ω) - a)) (Q.map (fun z : ℝ × ℝ => max z.1 z.2)) μ (maxStat_aemeasurable an bn a hSn_meas) := by -- continuous mapping theorem on the joint CLT: the rescaled image is `max ∘ Sₙ` -- exactly (`sqrt_mul_max_sub`), with no linearization remainder. have hgmeas : ∀ (n : ℕ), AEMeasurable (fun ω => (fun z : ℝ × ℝ => max z.1 z.2) (sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a)))) μ := fun (n : ℕ) => (continuous_fst.max continuous_snd).measurable.comp_aemeasurable (hSn_meas n) have hmap : Tendsto_dist_vec (fun (n : ℕ) ω => (fun z : ℝ × ℝ => max z.1 z.2) (sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a)))) (Q.map (fun z : ℝ × ℝ => max z.1 z.2)) μ hgmeas := by exact Tendsto_dist_vec.map_continuous (continuous_fst.max continuous_snd) hSn_meas hCLT -- transport `max ∘ Sₙ ⇒ Q.map max` to the (pointwise-equal) rescaled image exact hmap.congr_ae hgmeas (maxStat_aemeasurable an bn a hSn_meas) (Eventually.of_forall fun n => Eventually.of_forall fun ω => (sqrt_mul_max_sub an bn a n ω).symm)
theorem deltaMethod_min_tie reviewed
Causalean.Stat

Directional delta method for min at a tie. Let ân, b̂n be two real-valued estimator sequences of a common value a. Suppose the joint rescaled deviation √n • ((ân, b̂n) − (a, a)) is measurable at every sample size and it converges in distribution to a probability measure Q on ℝ × ℝ. Then the rescaled deviation of the pointwise minimum, √n · (min(ân, b̂n) − a), converges in distribution to the pushforward of Q under the map (x, y) ↦ min(x, y).

Formal statement
an bn :
ℕ → Ω → ℝ
a :
Q :
hSn_meas :
∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) μ
hCLT :
Tendsto_dist_vec (fun (n : ℕ) ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) Q μ hSn_meas
Tendsto_dist (fun (n : ℕ) ω => sqrt (n : ℝ) * (min (an n ω) (bn n ω) - a)) (Q.map (fun z : ℝ × ℝ => min z.1 z.2)) μ (minStat_aemeasurable an bn a hSn_meas)
Proof (Lean source)
theorem deltaMethod_min_tie (an bn : ℕ → Ω → ℝ) (a : ℝ) (Q : Measure (ℝ × ℝ)) [IsProbabilityMeasure Q] (hSn_meas : ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) μ) (hCLT : Tendsto_dist_vec (fun (n : ℕ) ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) Q μ hSn_meas) : Tendsto_dist (fun (n : ℕ) ω => sqrt (n : ℝ) * (min (an n ω) (bn n ω) - a)) (Q.map (fun z : ℝ × ℝ => min z.1 z.2)) μ (minStat_aemeasurable an bn a hSn_meas) := by have hgmeas : ∀ (n : ℕ), AEMeasurable (fun ω => (fun z : ℝ × ℝ => min z.1 z.2) (sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a)))) μ := fun (n : ℕ) => (continuous_fst.min continuous_snd).measurable.comp_aemeasurable (hSn_meas n) have hmap : Tendsto_dist_vec (fun (n : ℕ) ω => (fun z : ℝ × ℝ => min z.1 z.2) (sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a)))) (Q.map (fun z : ℝ × ℝ => min z.1 z.2)) μ hgmeas := by exact Tendsto_dist_vec.map_continuous (continuous_fst.min continuous_snd) hSn_meas hCLT -- transport `min ∘ Sₙ ⇒ Q.map min` to the (pointwise-equal) rescaled image exact hmap.congr_ae hgmeas (minStat_aemeasurable an bn a hSn_meas) (Eventually.of_forall fun n => Eventually.of_forall fun ω => (sqrt_mul_min_sub an bn a n ω).symm)
7 supporting declarations (lemmas, instances)
  • isLittleOp_one_of_measure_ne_tendsto_zero theorem — If Yₙ and Xₙ agree except on an event of vanishing probability, then Yₙ − Xₙ = o_p(1). This is the device that handles the *off-diagonal* case of the directional delta method (where the lattice functional locally selects one coordinate, so the rescaled image equals that coordinate's marginal except when the estimated ordering is wrong — an event whose probability tends to 0).
    Xn Yn :
    ℕ → Ω → ℝ
    h :
    Tendsto (fun n => μ {ω | Yn n ω ≠ Xn n ω}) atTop (𝓝 0)
    IsLittleOp (fun n ω => Yn n ω - Xn n ω) (fun _ => (1 : ℝ)) μ
    Proof (Lean source)
    theorem isLittleOp_one_of_measure_ne_tendsto_zero {Xn Yn : ℕ → Ω → ℝ} (h : Tendsto (fun n => μ {ω | Yn n ω ≠ Xn n ω}) atTop (𝓝 0)) : IsLittleOp (fun n ω => Yn n ω - Xn n ω) (fun _ => (1 : ℝ)) μ := by intro ε hε have hsub : ∀ n, {ω | ε * (1 : ℝ) < |Yn n ω - Xn n ω|} ⊆ {ω | Yn n ω ≠ Xn n ω} := by intro n ω hω simp only [Set.mem_setOf_eq] at hω ⊢ intro heq rw [heq, sub_self, abs_zero, mul_one] at hω exact absurd hω (not_lt.2 (le_of_lt hε)) refine tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds h (fun n => zero_le) (fun n => measure_mono (hsub n))
    Causalean.Stat.isLittleOp_one_of_measure_ne_tendsto_zero · Causalean/Stat/Inference/FunctionalDelta.lean:66
  • instIsProbabilityMeasure_map_max instance — The maximum of a two-dimensional probability limit is itself a probability law.
    instance instIsProbabilityMeasure_map_max (Q : Measure (ℝ × ℝ)) [IsProbabilityMeasure Q] : IsProbabilityMeasure (Q.map (fun z : ℝ × ℝ => max z.1 z.2)) := Measure.isProbabilityMeasure_map (continuous_fst.max continuous_snd).measurable.aemeasurable
    Causalean.Stat.instIsProbabilityMeasure_map_max · Causalean/Stat/Inference/FunctionalDelta.lean:90
  • instIsProbabilityMeasure_map_min instance — The minimum of a two-dimensional probability limit is itself a probability law.
    instance instIsProbabilityMeasure_map_min (Q : Measure (ℝ × ℝ)) [IsProbabilityMeasure Q] : IsProbabilityMeasure (Q.map (fun z : ℝ × ℝ => min z.1 z.2)) := Measure.isProbabilityMeasure_map (continuous_fst.min continuous_snd).measurable.aemeasurable
    Causalean.Stat.instIsProbabilityMeasure_map_min · Causalean/Stat/Inference/FunctionalDelta.lean:97
  • sqrt_mul_max_sub lemma — The tie identity for max. √n (max âₙ b̂ₙ − a) = max (√n(âₙ−a)) (√n(b̂ₙ−a)) (no remainder).
    an bn :
    ℕ → Ω → ℝ
    a :
    n :
    ω :
    Ω
    sqrt (n : ℝ) * (max (an n ω) (bn n ω) - a)
    = (fun z : ℝ × ℝ => max z.1 z.2) (sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a)))
    Proof (Lean source)
    lemma sqrt_mul_max_sub (an bn : ℕ → Ω → ℝ) (a : ℝ) (n : ℕ) (ω : Ω) : sqrt (n : ℝ) * (max (an n ω) (bn n ω) - a) = (fun z : ℝ × ℝ => max z.1 z.2) (sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) := by have hsnn : (0 : ℝ) ≤ sqrt (n : ℝ) := Real.sqrt_nonneg _ simp only [Prod.fst_sub, Prod.snd_sub, Prod.smul_fst, Prod.smul_snd, smul_eq_mul] rw [← mul_max_of_nonneg _ _ hsnn] congr 1 rcases le_total (an n ω) (bn n ω) with h | h · rw [max_eq_right h, max_eq_right (by linarith)] · rw [max_eq_left h, max_eq_left (by linarith)]
    Causalean.Stat.sqrt_mul_max_sub · Causalean/Stat/Inference/FunctionalDelta.lean:112
  • sqrt_mul_min_sub lemma — The tie identity for min. Companion to sqrt_mul_max_sub.
    an bn :
    ℕ → Ω → ℝ
    a :
    n :
    ω :
    Ω
    sqrt (n : ℝ) * (min (an n ω) (bn n ω) - a)
    = (fun z : ℝ × ℝ => min z.1 z.2) (sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a)))
    Proof (Lean source)
    lemma sqrt_mul_min_sub (an bn : ℕ → Ω → ℝ) (a : ℝ) (n : ℕ) (ω : Ω) : sqrt (n : ℝ) * (min (an n ω) (bn n ω) - a) = (fun z : ℝ × ℝ => min z.1 z.2) (sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) := by have hsnn : (0 : ℝ) ≤ sqrt (n : ℝ) := Real.sqrt_nonneg _ simp only [Prod.fst_sub, Prod.snd_sub, Prod.smul_fst, Prod.smul_snd, smul_eq_mul] rw [← mul_min_of_nonneg _ _ hsnn] congr 1 rcases le_total (an n ω) (bn n ω) with h | h · rw [min_eq_left h, min_eq_left (by linarith)] · rw [min_eq_right h, min_eq_right (by linarith)]
    Causalean.Stat.sqrt_mul_min_sub · Causalean/Stat/Inference/FunctionalDelta.lean:127
  • maxStat_aemeasurable lemma — The image statistic √n (max âₙ b̂ₙ − a) is AEMeasurable for every n, *derived* from the joint rescaled deviation's measurability via sqrt_mul_max_sub — so deltaMethod_max_tie need not assume it.
    an bn :
    ℕ → Ω → ℝ
    a :
    hSn_meas :
    ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) μ
    ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) * (max (an n ω) (bn n ω) - a)) μ
    Proof (Lean source)
    lemma maxStat_aemeasurable (an bn : ℕ → Ω → ℝ) (a : ℝ) (hSn_meas : ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) μ) : ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) * (max (an n ω) (bn n ω) - a)) μ := fun n => ((continuous_fst.max continuous_snd).measurable.comp_aemeasurable (hSn_meas n)).congr (Filter.Eventually.of_forall fun ω => (sqrt_mul_max_sub an bn a n ω).symm)
    Causalean.Stat.maxStat_aemeasurable · Causalean/Stat/Inference/FunctionalDelta.lean:141
  • minStat_aemeasurable lemma — The image statistic √n (min âₙ b̂ₙ − a) is AEMeasurable for every n, derived likewise via sqrt_mul_min_sub.
    an bn :
    ℕ → Ω → ℝ
    a :
    hSn_meas :
    ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) μ
    ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) * (min (an n ω) (bn n ω) - a)) μ
    Proof (Lean source)
    lemma minStat_aemeasurable (an bn : ℕ → Ω → ℝ) (a : ℝ) (hSn_meas : ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) μ) : ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) * (min (an n ω) (bn n ω) - a)) μ := fun n => ((continuous_fst.min continuous_snd).measurable.comp_aemeasurable (hSn_meas n)).congr (Filter.Eventually.of_forall fun ω => (sqrt_mul_min_sub an bn a n ω).symm)
    Causalean.Stat.minStat_aemeasurable · Causalean/Stat/Inference/FunctionalDelta.lean:153
Hadamard­Deriv 4 core · 4 supporting This file defines Hadamard directional differentiability for maps between normed spaces and connects it to ordinary differentiability. ★ HasHadamardDirDerivAt★ hasHadamardDirDerivAt

Hadamard Directional Derivatives

This file defines Hadamard directional differentiability for maps between normed spaces and connects it to ordinary differentiability. It also develops the directional derivatives of maximum and minimum functionals that support delta-method arguments for nonsmooth statistical targets.

The central definition is HasHadamardDirDerivAt. The theorem HasFDerivAt.hasHadamardDirDerivAt shows that ordinary Fréchet differentiability implies Hadamard directional differentiability with the same linear derivative. The declarations maxDirDeriv, minDirDeriv, continuous_maxDirDeriv, continuous_minDirDeriv, hasHadamardDirDerivAt_max, and hasHadamardDirDerivAt_min give the lattice derivatives used by the functional delta-method file.

def HasHadamardDirDerivAt reviewed
Causalean.Stat

Hadamard directional differentiability. φ has Hadamard directional derivative φ' at θ if for every direction h, every sequence hₙ → h, and every step sequence tₙ → 0 with tₙ > 0,

Definition (Lean source)
def HasHadamardDirDerivAt (φ : E → F) (φ' : E → F) (θ : E) : Prop := ∀ (h : E) (hn : ℕ → E) (tn : ℕ → ℝ), Tendsto hn atTop (𝓝 h) → Tendsto tn atTop (𝓝 0) → (∀ n, 0 < tn n) → Tendsto (fun n => (tn n)⁻¹ • (φ (θ + tn n • hn n) - φ θ)) atTop (𝓝 (φ' h))
Causalean.Stat.HasHadamardDirDerivAt · Causalean/Stat/Inference/HadamardDeriv.lean:68
theorem hasHadamardDirDerivAt reviewed
Causalean.Stat.HasFDerivAt

Fréchet implies Hadamard. If the map φ is Fréchet-differentiable at the point θ, with continuous linear derivative L, then φ is Hadamard directionally differentiable at θ, with the same map L serving as its Hadamard directional derivative.

Formal statement
φ :
E → F
L :
E →L[ℝ] F
θ :
E
hL :
HasFDerivAt φ L θ
HasHadamardDirDerivAt φ (fun x => L x) θ
Proof (Lean source)
theorem HasFDerivAt.hasHadamardDirDerivAt {φ : E → F} {L : E →L[ℝ] F} {θ : E} (hL : HasFDerivAt φ L θ) : HasHadamardDirDerivAt φ (fun x => L x) θ := by intro h hn tn hhn htn htn_pos have hxn : Tendsto (fun n => θ + tn n • hn n) atTop (𝓝 θ) := by have h0 : Tendsto (fun n => tn n • hn n) atTop (𝓝 0) := by simpa using htn.smul hhn simpa using (tendsto_const_nhds (x := θ)).add h0 have hLhn : Tendsto (fun n => L (hn n)) atTop (𝓝 (L h)) := (L.continuous.tendsto h).comp hhn -- remainder `rₙ := φ(θ + tₙ•hₙ) − φθ − tₙ • L hₙ` set rn : ℕ → F := fun n => φ (θ + tn n • hn n) - φ θ - tn n • L (hn n) with hrn_def have hrec : ∀ n, (tn n)⁻¹ • (φ (θ + tn n • hn n) - φ θ) = L (hn n) + (tn n)⁻¹ • rn n := by intro n have htn_ne : tn n ≠ 0 := (htn_pos n).ne' have hsplit : (tn n)⁻¹ • rn n = (tn n)⁻¹ • (φ (θ + tn n • hn n) - φ θ) - L (hn n) := by rw [hrn_def] rw [smul_sub, smul_smul, inv_mul_cancel₀ htn_ne, one_smul] rw [hsplit]; abel have hrem : Tendsto (fun n => (tn n)⁻¹ • rn n) atTop (𝓝 0) := by -- Step 1: the Fréchet remainder composed with the curve `xₙ = θ + tₙ•hₙ` is -- little-o of `tₙ•hₙ` (`= xₙ − θ`). have hf : (fun n => φ (θ + tn n • hn n) - φ θ - L ((θ + tn n • hn n) - θ)) =ᶠ[atTop] rn := by apply Filter.Eventually.of_forall intro n simp only [hrn_def, add_sub_cancel_left, map_smul] have hg : (fun n => (θ + tn n • hn n) - θ) =ᶠ[atTop] (fun n => tn n • hn n) := by apply Filter.Eventually.of_forall intro n simp only [add_sub_cancel_left] have hlitt := (hL.isLittleO.comp_tendsto hxn).congr' hf hg -- Step 2: divide by the rate `tₙ`. Since `‖hₙ‖` is bounded, `(tₙ)⁻¹•rₙ → 0`. rw [NormedAddGroup.tendsto_nhds_zero] intro ε hε obtain ⟨M, hMpos, hMev⟩ : ∃ M : ℝ, 0 < M ∧ ∀ᶠ n in atTop, ‖hn n‖ ≤ M := by refine ⟨‖h‖ + 1, by positivity, ?_⟩ have hnorm : Tendsto (fun n => ‖hn n‖) atTop (𝓝 ‖h‖) := (continuous_norm.tendsto h).comp hhn filter_upwards [hnorm.eventually_lt_const (lt_add_one ‖h‖)] with n hn_ev exact hn_ev.le have hc : (0 : ℝ) < ε / (2 * M) := div_pos hε (by linarith) have hbound := hlitt.def hc filter_upwards [hbound, hMev] with n hb hMn have htn_pos' := htn_pos n have htn_ne : tn n ≠ 0 := htn_pos'.ne' have hsmul_norm : ‖tn n • hn n‖ = tn n * ‖hn n‖ := by rw [norm_smul, Real.norm_eq_abs, abs_of_pos htn_pos'] rw [hsmul_norm] at hb rw [norm_smul, norm_inv, Real.norm_eq_abs, abs_of_pos htn_pos'] calc (tn n)⁻¹ * ‖rn n‖ ≤ (tn n)⁻¹ * (ε / (2 * M) * (tn n * ‖hn n‖)) := mul_le_mul_of_nonneg_left hb (inv_nonneg.mpr htn_pos'.le) _ = ε / (2 * M) * ‖hn n‖ := by have he : (tn n)⁻¹ * (ε / (2 * M) * (tn n * ‖hn n‖)) = ε / (2 * M) * ((tn n)⁻¹ * tn n) * ‖hn n‖ := by ring rw [he, inv_mul_cancel₀ htn_ne, mul_one] _ ≤ ε / (2 * M) * M := mul_le_mul_of_nonneg_left hMn (div_nonneg hε.le (by linarith)) _ = ε / 2 := by field_simp _ < ε := by linarith have := hLhn.add hrem simpa [hrec] using this
Causalean.Stat.HasFDerivAt.hasHadamardDirDerivAt · Causalean/Stat/Inference/HadamardDeriv.lean:83 · uses HasHadamardDirDerivAt
def maxDirDeriv reviewed
Causalean.Stat

The directional derivative of max : ℝ × ℝ → ℝ at (a, b): fst if b < a, snd if a < b, and max itself at a tie a = b (where it is sublinear, not linear).

Definition (Lean source)
noncomputable def maxDirDeriv (a b : ℝ) : ℝ × ℝ → ℝ := fun z => if b < a then z.1 else if a < b then z.2 else max z.1 z.2
def minDirDeriv reviewed
Causalean.Stat

The directional derivative of min : ℝ × ℝ → ℝ at (a, b).

Definition (Lean source)
noncomputable def minDirDeriv (a b : ℝ) : ℝ × ℝ → ℝ := fun z => if a < b then z.1 else if b < a then z.2 else min z.1 z.2
4 supporting declarations (lemmas, instances)
  • continuous_maxDirDeriv theorem — The directional derivative of the maximum functional is continuous.
    a b :
    Proof (Lean source)
    theorem continuous_maxDirDeriv (a b : ℝ) : Continuous (maxDirDeriv a b) := by unfold maxDirDeriv split_ifs · exact continuous_fst · exact continuous_snd · exact continuous_fst.max continuous_snd
    Causalean.Stat.continuous_maxDirDeriv · Causalean/Stat/Inference/HadamardDeriv.lean:165
  • continuous_minDirDeriv theorem — The directional derivative of the minimum functional is continuous.
    a b :
    Proof (Lean source)
    theorem continuous_minDirDeriv (a b : ℝ) : Continuous (minDirDeriv a b) := by unfold minDirDeriv split_ifs · exact continuous_fst · exact continuous_snd · exact continuous_fst.min continuous_snd
    Causalean.Stat.continuous_minDirDeriv · Causalean/Stat/Inference/HadamardDeriv.lean:173
  • hasHadamardDirDerivAt_max theorem — max is Hadamard directionally differentiable. At (a, b) the derivative is maxDirDeriv a b (linear off the diagonal, sublinear at a tie).
    a b :
    HasHadamardDirDerivAt (fun z : ℝ × ℝ => max z.1 z.2) (maxDirDeriv a b) (a, b)
    Proof (Lean source)
    theorem hasHadamardDirDerivAt_max (a b : ℝ) : HasHadamardDirDerivAt (fun z : ℝ × ℝ => max z.1 z.2) (maxDirDeriv a b) (a, b) := by intro h hn tn hhn htn htn_pos have hh1 : Tendsto (fun n => (hn n).1) atTop (𝓝 h.1) := (continuous_fst.tendsto h).comp hhn have hh2 : Tendsto (fun n => (hn n).2) atTop (𝓝 h.2) := (continuous_snd.tendsto h).comp hhn unfold maxDirDeriv split_ifs with hba hab · -- b < a : the first coordinate eventually dominates, derivative = h.1 have hmax_ab : max a b = a := max_eq_left (le_of_lt hba) have hg : Tendsto (fun n => (a + tn n * (hn n).1) - (b + tn n * (hn n).2)) atTop (𝓝 (a - b)) := by have h0 : Tendsto (fun n => tn n * ((hn n).1 - (hn n).2)) atTop (𝓝 0) := by simpa using htn.mul (hh1.sub hh2) have hsum := (tendsto_const_nhds (x := a - b)).add h0 simp only [add_zero] at hsum refine hsum.congr ?_ intro n; ring have hev : ∀ᶠ n in atTop, b + tn n * (hn n).2 ≤ a + tn n * (hn n).1 := by filter_upwards [hg.eventually (eventually_gt_nhds (show (0:ℝ) < a - b by linarith))] with n hn_ev linarith refine hh1.congr' ?_ filter_upwards [hev] with n hge have htn_ne : tn n ≠ 0 := (htn_pos n).ne' simp only [Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, smul_eq_mul] rw [max_eq_left hge, hmax_ab, show a + tn n * (hn n).1 - a = tn n * (hn n).1 by ring, ← mul_assoc, inv_mul_cancel₀ htn_ne, one_mul] · -- a < b : the second coordinate eventually dominates, derivative = h.2 have hmax_ab : max a b = b := max_eq_right (le_of_lt hab) have hg : Tendsto (fun n => (b + tn n * (hn n).2) - (a + tn n * (hn n).1)) atTop (𝓝 (b - a)) := by have h0 : Tendsto (fun n => tn n * ((hn n).2 - (hn n).1)) atTop (𝓝 0) := by simpa using htn.mul (hh2.sub hh1) have hsum := (tendsto_const_nhds (x := b - a)).add h0 simp only [add_zero] at hsum refine hsum.congr ?_ intro n; ring have hev : ∀ᶠ n in atTop, a + tn n * (hn n).1 ≤ b + tn n * (hn n).2 := by filter_upwards [hg.eventually (eventually_gt_nhds (show (0:ℝ) < b - a by linarith))] with n hn_ev linarith refine hh2.congr' ?_ filter_upwards [hev] with n hle have htn_ne : tn n ≠ 0 := (htn_pos n).ne' simp only [Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, smul_eq_mul] rw [max_eq_right hle, hmax_ab, show b + tn n * (hn n).2 - b = tn n * (hn n).2 by ring, ← mul_assoc, inv_mul_cancel₀ htn_ne, one_mul] · -- a = b : the tie case collapses to `max (hₙ.1) (hₙ.2) → max h.1 h.2` have hab_eq : a = b := le_antisymm (not_lt.1 hba) (not_lt.1 hab) have key : ∀ n, (tn n)⁻¹ • ((fun z : ℝ × ℝ => max z.1 z.2) ((a, b) + tn n • hn n) - max a b) = max (hn n).1 (hn n).2 := by intro n have htn_ne : tn n ≠ 0 := (htn_pos n).ne' have hpos := htn_pos n simp only [Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, smul_eq_mul, hab_eq] have e1 : max (b + tn n * (hn n).1) (b + tn n * (hn n).2) = b + tn n * max (hn n).1 (hn n).2 := by rcases le_total (hn n).1 (hn n).2 with hle | hle · rw [max_eq_right hle, max_eq_right (by nlinarith [hpos])] · rw [max_eq_left hle, max_eq_left (by nlinarith [hpos])] rw [e1, max_self, show b + tn n * max (hn n).1 (hn n).2 - b = tn n * max (hn n).1 (hn n).2 by ring, ← mul_assoc, inv_mul_cancel₀ htn_ne, one_mul] simp only [key] exact hh1.max hh2
    Causalean.Stat.hasHadamardDirDerivAt_max · Causalean/Stat/Inference/HadamardDeriv.lean:181
  • hasHadamardDirDerivAt_min theorem — min is Hadamard directionally differentiable. At (a, b) the derivative is minDirDeriv a b.
    a b :
    HasHadamardDirDerivAt (fun z : ℝ × ℝ => min z.1 z.2) (minDirDeriv a b) (a, b)
    Proof (Lean source)
    theorem hasHadamardDirDerivAt_min (a b : ℝ) : HasHadamardDirDerivAt (fun z : ℝ × ℝ => min z.1 z.2) (minDirDeriv a b) (a, b) := by intro h hn tn hhn htn htn_pos have hh1 : Tendsto (fun n => (hn n).1) atTop (𝓝 h.1) := (continuous_fst.tendsto h).comp hhn have hh2 : Tendsto (fun n => (hn n).2) atTop (𝓝 h.2) := (continuous_snd.tendsto h).comp hhn unfold minDirDeriv split_ifs with hab hba · -- a < b : the first coordinate eventually dominates the min, derivative = h.1 have hmin_ab : min a b = a := min_eq_left (le_of_lt hab) have hg : Tendsto (fun n => (b + tn n * (hn n).2) - (a + tn n * (hn n).1)) atTop (𝓝 (b - a)) := by have h0 : Tendsto (fun n => tn n * ((hn n).2 - (hn n).1)) atTop (𝓝 0) := by simpa using htn.mul (hh2.sub hh1) have hsum := (tendsto_const_nhds (x := b - a)).add h0 simp only [add_zero] at hsum refine hsum.congr ?_ intro n; ring have hev : ∀ᶠ n in atTop, a + tn n * (hn n).1 ≤ b + tn n * (hn n).2 := by filter_upwards [hg.eventually (eventually_gt_nhds (show (0:ℝ) < b - a by linarith))] with n hn_ev linarith refine hh1.congr' ?_ filter_upwards [hev] with n hle have htn_ne : tn n ≠ 0 := (htn_pos n).ne' simp only [Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, smul_eq_mul] rw [min_eq_left hle, hmin_ab, show a + tn n * (hn n).1 - a = tn n * (hn n).1 by ring, ← mul_assoc, inv_mul_cancel₀ htn_ne, one_mul] · -- b < a : the second coordinate eventually dominates the min, derivative = h.2 have hmin_ab : min a b = b := min_eq_right (le_of_lt hba) have hg : Tendsto (fun n => (a + tn n * (hn n).1) - (b + tn n * (hn n).2)) atTop (𝓝 (a - b)) := by have h0 : Tendsto (fun n => tn n * ((hn n).1 - (hn n).2)) atTop (𝓝 0) := by simpa using htn.mul (hh1.sub hh2) have hsum := (tendsto_const_nhds (x := a - b)).add h0 simp only [add_zero] at hsum refine hsum.congr ?_ intro n; ring have hev : ∀ᶠ n in atTop, b + tn n * (hn n).2 ≤ a + tn n * (hn n).1 := by filter_upwards [hg.eventually (eventually_gt_nhds (show (0:ℝ) < a - b by linarith))] with n hn_ev linarith refine hh2.congr' ?_ filter_upwards [hev] with n hge have htn_ne : tn n ≠ 0 := (htn_pos n).ne' simp only [Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, smul_eq_mul] rw [min_eq_right hge, hmin_ab, show b + tn n * (hn n).2 - b = tn n * (hn n).2 by ring, ← mul_assoc, inv_mul_cancel₀ htn_ne, one_mul] · -- a = b : tie case collapses to `min (hₙ.1) (hₙ.2) → min h.1 h.2` have hab_eq : a = b := le_antisymm (not_lt.1 hba) (not_lt.1 hab) have key : ∀ n, (tn n)⁻¹ • ((fun z : ℝ × ℝ => min z.1 z.2) ((a, b) + tn n • hn n) - min a b) = min (hn n).1 (hn n).2 := by intro n have htn_ne : tn n ≠ 0 := (htn_pos n).ne' have hpos := htn_pos n simp only [Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, smul_eq_mul, hab_eq] have e1 : min (b + tn n * (hn n).1) (b + tn n * (hn n).2) = b + tn n * min (hn n).1 (hn n).2 := by rcases le_total (hn n).1 (hn n).2 with hle | hle · rw [min_eq_left hle, min_eq_left (by nlinarith [hpos])] · rw [min_eq_right hle, min_eq_right (by nlinarith [hpos])] rw [e1, min_self, show b + tn n * min (hn n).1 (hn n).2 - b = tn n * min (hn n).1 (hn n).2 by ring, ← mul_assoc, inv_mul_cancel₀ htn_ne, one_mul] simp only [key] exact hh1.min hh2
    Causalean.Stat.hasHadamardDirDerivAt_min · Causalean/Stat/Inference/HadamardDeriv.lean:254
Ratio­Delta­Method 2 core · 1 supporting This file specializes the multivariate delta method to ratio statistics such as Wald-ratio and LATE estimands. ★ deltaMethod_ratio

This file specializes the multivariate delta method to ratio statistics such as Wald-ratio and LATE estimands. It defines the closed-form derivative ratioDeriv t₀ = (1 / b) • proj₀ - (a / b ^ 2) • proj₁ on EuclideanSpace ℝ (Fin 2), proves hasFDerivAt_ratio for the map v ↦ v 0 / v 1 when the denominator coordinate is nonzero, and instantiates deltaMethod in deltaMethod_ratio.

def ratioDeriv reviewed
Causalean.Stat

The Fréchet derivative of v ↦ v 0 / v 1 at t₀, in closed form via smulRight on the coordinate projections EuclideanSpace.proj 0, EuclideanSpace.proj 1: ratioDeriv t₀ = (1/b) • proj₀ − (a / b²) • proj₁ with (a, b) = (t₀ 0, t₀ 1). This is the gradient of x/y at (a, b) paired against the coordinate functionals. (This Mathlib has no bundled HasFDerivAt.div, so we give the closed form explicitly and verify it via the product/inverse rules.)

Definition (Lean source)
noncomputable def ratioDeriv (t₀ : EuclideanSpace ℝ (Fin 2)) : EuclideanSpace ℝ (Fin 2) →L[ℝ] ℝ := (EuclideanSpace.proj (𝕜 := ℝ) 0).smulRight (t₀ 1)⁻¹ - (EuclideanSpace.proj (𝕜 := ℝ) 1).smulRight (t₀ 0 * ((t₀ 1) ^ 2)⁻¹)
theorem deltaMethod_ratio reviewed
Causalean.Stat

Ratio / quotient delta method. Let t₀ = (a, b) with b nonzero and let Tn n ω = (N̂ₙ, D̂ₙ) be a bivariate estimator sequence of t₀. Given that the rescaled deviation √n • (Tn − t₀) is measurable at every sample size and that the rescaled ratio √n • (Tn 0 / Tn 1 − a/b) is measurable at every sample size, if the laws of the rescaled deviation converge weakly to a probability measure Q on EuclideanSpace ℝ (Fin 2), then the laws of the rescaled ratio √n • (Tn 0 / Tn 1 − a/b) converge weakly to the pushforward of Q along the ratio derivative ratioDeriv t₀.

Formal statement
Tn :
ℕ → Ω → EuclideanSpace ℝ (Fin 2)
t₀ :
hb :
t₀ 1 ≠ 0
hTn :
∀ n, AEMeasurable (fun ω => (sqrt ((n : ℕ) : ℝ)) • (Tn n ω - t₀)) μ
hgTn :
∀ n,
AEMeasurable (fun ω => (sqrt ((n : ℕ) : ℝ)) • ((Tn n ω 0 / Tn n ω 1) - t₀ 0 / t₀ 1)) μ
_hCLT :
Tendsto (β := ProbabilityMeasure (EuclideanSpace ℝ (Fin 2))) (fun n => ⟨μ.map (fun ω => (sqrt ((n : ℕ) : ℝ)) • (Tn n ω - t₀)), Measure.isProbabilityMeasure_map (hTn n)⟩) atTop (𝓝 Q)
Tendsto (β := ProbabilityMeasure ℝ) (fun n => ⟨μ.map (fun ω => (sqrt ((n : ℕ) : ℝ)) • ((Tn n ω 0 / Tn n ω 1) - t₀ 0 / t₀ 1)), Measure.isProbabilityMeasure_map (hgTn n)⟩) atTop (𝓝 ⟨Q.toMeasure.map (ratioDeriv t₀), Measure.isProbabilityMeasure_map (ratioDeriv t₀).continuous.measurable.aemeasurable⟩)
Proof (Lean source)
theorem deltaMethod_ratio (Tn : ℕ → Ω → EuclideanSpace ℝ (Fin 2)) (t₀ : EuclideanSpace ℝ (Fin 2)) (hb : t₀ 1 ≠ 0) (Q : ProbabilityMeasure (EuclideanSpace ℝ (Fin 2))) (hTn : ∀ n, AEMeasurable (fun ω => (sqrt ((n : ℕ) : ℝ)) • (Tn n ω - t₀)) μ) (hgTn : ∀ n, AEMeasurable (fun ω => (sqrt ((n : ℕ) : ℝ)) • ((Tn n ω 0 / Tn n ω 1) - t₀ 0 / t₀ 1)) μ) (_hCLT : Tendsto (β := ProbabilityMeasure (EuclideanSpace ℝ (Fin 2))) (fun n => ⟨μ.map (fun ω => (sqrt ((n : ℕ) : ℝ)) • (Tn n ω - t₀)), Measure.isProbabilityMeasure_map (hTn n)⟩) atTop (𝓝 Q)) : Tendsto (β := ProbabilityMeasure ℝ) (fun n => ⟨μ.map (fun ω => (sqrt ((n : ℕ) : ℝ)) • ((Tn n ω 0 / Tn n ω 1) - t₀ 0 / t₀ 1)), Measure.isProbabilityMeasure_map (hgTn n)⟩) atTop (𝓝 ⟨Q.toMeasure.map (ratioDeriv t₀), Measure.isProbabilityMeasure_map (ratioDeriv t₀).continuous.measurable.aemeasurable⟩) := deltaMethod Tn t₀ (fun v => v 0 / v 1) (ratioDeriv t₀) Q hTn hgTn (hasFDerivAt_ratio hb) _hCLT
Causalean.Stat.deltaMethod_ratio · Causalean/Stat/Inference/RatioDeltaMethod.lean:99 · uses ratioDeriv
1 supporting declaration (lemmas, instances)
  • hasFDerivAt_ratio theorem — Fréchet derivative of the ratio map. On EuclideanSpace ℝ (Fin 2), the map v ↦ v 0 / v 1 is Fréchet-differentiable at any t₀ whose second coordinate is nonzero, with derivative ratioDeriv t₀.
    t₀ :
    hb :
    t₀ 1 ≠ 0
    HasFDerivAt (fun v : EuclideanSpace ℝ (Fin 2) => v 0 / v 1) (ratioDeriv t₀) t₀
    Proof (Lean source)
    theorem hasFDerivAt_ratio {t₀ : EuclideanSpace ℝ (Fin 2)} (hb : t₀ 1 ≠ 0) : HasFDerivAt (fun v : EuclideanSpace ℝ (Fin 2) => v 0 / v 1) (ratioDeriv t₀) t₀ := by have h0 : HasFDerivAt (fun v : EuclideanSpace ℝ (Fin 2) => v 0) (EuclideanSpace.proj (𝕜 := ℝ) 0) t₀ := (EuclideanSpace.proj (𝕜 := ℝ) 0).hasFDerivAt have h1 : HasFDerivAt (fun v : EuclideanSpace ℝ (Fin 2) => v 1) (EuclideanSpace.proj (𝕜 := ℝ) 1) t₀ := (EuclideanSpace.proj (𝕜 := ℝ) 1).hasFDerivAt -- derivative of `v ↦ (v 1)⁻¹` by composing scalar `hasFDerivAt_inv` with `h1` have hinv := (hasFDerivAt_inv hb).comp t₀ h1 -- `x / y = x * y⁻¹` have heq : (fun v : EuclideanSpace ℝ (Fin 2) => v 0 / v 1) = (fun v : EuclideanSpace ℝ (Fin 2) => v 0 * (v 1)⁻¹) := by funext v; rw [div_eq_mul_inv] rw [heq] have hmul := h0.mul hinv refine hmul.congr_fderiv ?_ ext v simp only [ratioDeriv, ContinuousLinearMap.sub_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.add_apply, ContinuousLinearMap.smul_apply, ContinuousLinearMap.comp_apply, ContinuousLinearMap.toSpanSingleton_apply, Function.comp_apply, smul_eq_mul] ring
    Causalean.Stat.hasFDerivAt_ratio · Causalean/Stat/Inference/RatioDeltaMethod.lean:62
Studentize 2 core · 3 supporting This file provides estimator-agnostic studentized CLT and Wald-interval coverage results. ★ div_tendsto_inProb_gaussian★ wald_coverage

This file provides estimator-agnostic studentized CLT and Wald-interval coverage results. The portmanteau helper Tendsto_dist.tendsto_measure_of_null_frontier converts convergence in distribution into convergence of probabilities for continuity sets, while gaussianMeasure_zero_one_singleton and gaussianMeasure_zero_one_frontier_Icc record the boundary-null facts needed for standard-normal intervals.

The main studentization theorem Tendsto_dist.div_tendsto_inProb_gaussian proves that Xn / σ_hat ⇒ N(0,1) from Xn ⇒ N(0, σ₀ ^ 2) and σ_hat →ₚ σ₀ > 0. The coverage theorem Tendsto_dist.wald_coverage then transfers the limiting probability of Sn ∈ Icc (-z) z to an abstract coverage sequence via a bridge hypothesis.

theorem div_tendsto_inProb_gaussian reviewed
Causalean.Stat.Tendsto_dist

Generic studentized convergence. Let Xn be a real-valued rescaled-estimator sequence and σ_hat a variance-estimator sequence, with σ₀ a positive scale. Suppose Xn is measurable at every sample size and it converges in distribution to the project's Gaussian law with mean zero and variance σ₀², that σ_hat converges in probability to σ₀, and the studentized ratio Xn / σ_hat is measurable at every sample size. Then the studentized ratio Xn / σ_hat converges in distribution to the standard Gaussian law.

Formal statement
Ω :
Xn :
ℕ → Ω → ℝ
σ_hat :
ℕ → Ω → ℝ
σ₀ :
hσ₀_pos :
0 < σ₀
hXn :
∀ n, AEMeasurable (Xn n) μ
hX :
Tendsto_dist Xn (gaussianMeasure 0 (σ₀ ^ 2)) μ hXn
:
Tendsto_inProb σ_hat (fun _ => σ₀) μ
hdiv :
∀ n, AEMeasurable (fun ω => Xn n ω / σ_hat n ω) μ
Tendsto_dist (fun n ω => Xn n ω / σ_hat n ω) (gaussianMeasure 0 1) μ hdiv
Proof (Lean source)
theorem Tendsto_dist.div_tendsto_inProb_gaussian {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {Xn : ℕ → Ω → ℝ} {σ_hat : ℕ → Ω → ℝ} {σ₀ : ℝ} (hσ₀_pos : 0 < σ₀) (hXn : ∀ n, AEMeasurable (Xn n) μ) (hX : Tendsto_dist Xn (gaussianMeasure 0 (σ₀ ^ 2)) μ hXn) (hσ : Tendsto_inProb σ_hat (fun _ => σ₀) μ) (hdiv : ∀ n, AEMeasurable (fun ω => Xn n ω / σ_hat n ω) μ) : Tendsto_dist (fun n ω => Xn n ω / σ_hat n ω) (gaussianMeasure 0 1) μ hdiv := by have hσ₀_ne : σ₀ ≠ 0 := ne_of_gt hσ₀_pos have hscaled_meas : ∀ n, AEMeasurable (fun ω => (1 / σ₀) * Xn n ω) μ := by intro n exact aemeasurable_const.mul (hXn n) have hscaled : Tendsto_dist (fun n ω => (1 / σ₀) * Xn n ω) (gaussianMeasure 0 1) μ hscaled_meas := by have h := Tendsto_dist.const_mul_tendsto_gaussian (Xn := Xn) (a := fun _ : ℕ => 1 / σ₀) (a₀ := 1 / σ₀) (v := σ₀ ^ 2) hXn hX tendsto_const_nhds have hvar : ((σ₀ ^ 2)⁻¹ * σ₀ ^ 2) = 1 := by have hσsq_ne : σ₀ ^ 2 ≠ 0 := pow_ne_zero 2 hσ₀_ne field_simp [hσsq_ne] simpa [hvar] using h have hXbig : IsBigOp Xn (fun _ => (1 : ℝ)) μ := Tendsto_dist.tightness hXn hX have hinv_little : IsLittleOp (fun n ω => 1 / σ_hat n ω - 1 / σ₀) (fun _ => (1 : ℝ)) μ := by exact Tendsto_inProb.isLittleOp_one (Tendsto_inProb.sub_const (Tendsto_inProb.inv hσ hσ₀_ne)) have hrem_prod : IsLittleOp (fun n ω => Xn n ω * (1 / σ_hat n ω - 1 / σ₀)) (fun _ => (1 : ℝ)) μ := IsBigOp.mul_isLittleOp_one_isLittleOp hXbig hinv_little have hrem : IsLittleOp (fun n ω => Xn n ω / σ_hat n ω - (1 / σ₀) * Xn n ω) (fun _ => (1 : ℝ)) μ := by convert hrem_prod using 1 funext n ω ring exact Tendsto_dist.add_isLittleOp_one hscaled_meas hdiv hscaled hrem
theorem wald_coverage reviewed
Causalean.Stat.Tendsto_dist

Generic Wald asymptotic coverage. Suppose a studentized statistic sequence Sn is measurable at every sample size and converges in distribution to the standard Gaussian law, and fix a positive half-width z. If a coverage-probability sequence coverProb is asymptotically equivalent to the studentized-interval event {Sn ∈ [-z, z]}, then coverProb converges to the standard-Gaussian probability of [-z, z].

Formal statement
Ω :
Sn :
ℕ → Ω → ℝ
hSn :
∀ n, AEMeasurable (Sn n) μ
hS :
z :
hz :
0 < z
coverProb :
ℕ → ℝ
h_bridge :
Tendsto (fun n => coverProb n - (μ {ω | Sn n ω ∈ Icc (-z) z}).toReal) atTop (𝓝 0)
Tendsto coverProb atTop (𝓝 ((gaussianMeasure 0 1) (Icc (-z) z)).toReal)
Proof (Lean source)
theorem Tendsto_dist.wald_coverage {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {Sn : ℕ → Ω → ℝ} (hSn : ∀ n, AEMeasurable (Sn n) μ) (hS : Tendsto_dist Sn (gaussianMeasure 0 1) μ hSn) {z : ℝ} (hz : 0 < z) (coverProb : ℕ → ℝ) (h_bridge : Tendsto (fun n => coverProb n - (μ {ω | Sn n ω ∈ Icc (-z) z}).toReal) atTop (𝓝 0)) : Tendsto coverProb atTop (𝓝 ((gaussianMeasure 0 1) (Icc (-z) z)).toReal) := by let studProb : ℕ → ℝ := fun n => (μ {ω | Sn n ω ∈ Icc (-z) z}).toReal change Tendsto (fun n => coverProb n - studProb n) atTop (𝓝 0) at h_bridge have hpm : Tendsto (fun n => ((μ.map (Sn n)) (Icc (-z) z)).toReal) atTop (𝓝 ((gaussianMeasure 0 1) (Icc (-z) z)).toReal) := by exact Tendsto_dist.tendsto_measure_of_null_frontier hSn hS (gaussianMeasure_zero_one_frontier_Icc hz) have hstudent_event : Tendsto studProb atTop (𝓝 ((gaussianMeasure 0 1) (Icc (-z) z)).toReal) := by refine hpm.congr' ?_ filter_upwards with n rw [Measure.map_apply_of_aemeasurable (hSn n) measurableSet_Icc] rfl have hsum := hstudent_event.add h_bridge have hsum' : Tendsto (fun n => studProb n + (coverProb n - studProb n)) atTop (𝓝 ((gaussianMeasure 0 1) (Icc (-z) z)).toReal) := by simpa using hsum refine hsum'.congr' ?_ filter_upwards with n ring
3 supporting declarations (lemmas, instances)
Variance­Estimation 2 core · 3 supporting This file proves variance and covariance consistency tools for i.i.d. ★ sampleCov_entry_tendsto_inProb★ sqrt_var_tendsto_inProb

This file proves variance and covariance consistency tools for i.i.d. samples. Inside IIDSample, sampleMean_mul_tendsto_inProb applies the WLLN to empirical means of products, and sampleCov_entry_tendsto_inProb turns a square-integrable vector influence function into entrywise covariance-matrix consistency for any pair of continuous linear coordinate functionals.

The helper abs_apply_mul_le_norm_sq supplies the domination bound needed for entrywise integrability. The final packaging lemmas Tendsto_inProb.sqrt and sqrt_var_tendsto_inProb convert variance-estimator consistency into standard-error consistency, the input expected by the studentized CLT.

theorem sampleCov_entry_tendsto_inProb reviewed
Causalean.Stat.IIDSample

Entrywise covariance-matrix consistency. For an i.i.d. sample S and two continuous linear coordinate functionals φ φ' : E →L[ℝ] ℝ, suppose a vector influence function ψ : X → E is measurable and has square-integrable norm along the sample. Then the empirical mean of the entry product φ(ψ·) · φ'(ψ·) converges in probability to the population integral ∫ x, φ(ψ x) · φ'(ψ x) ∂P.

Formal statement
S :
IIDSample Ω X μ P
ψ :
X → E
hψ_meas :
hψ_sq_int :
Integrable (fun ω => ‖ψ (S.Z 0 ω)‖ ^ 2) μ
φ φ' :
E →L[ℝ] ℝ
Tendsto_inProb (S.sampleMean (fun x => φ (ψ x) * φ' (ψ x))) (fun _ => ∫ x, φ (ψ x) * φ' (ψ x) ∂P) μ
Proof (Lean source)
theorem sampleCov_entry_tendsto_inProb (S : IIDSample Ω X μ P) [IsProbabilityMeasure P] {ψ : X → E} (hψ_meas : Measurable ψ) (hψ_sq_int : Integrable (fun ω => ‖ψ (S.Z 0 ω)‖ ^ 2) μ) (φ φ' : E →L[ℝ] ℝ) : Tendsto_inProb (S.sampleMean (fun x => φ (ψ x) * φ' (ψ x))) (fun _ => ∫ x, φ (ψ x) * φ' (ψ x) ∂P) μ := by -- coordinate measurability have hφ : Measurable (fun x => φ (ψ x)) := φ.continuous.measurable.comp hψ_meas have hφ' : Measurable (fun x => φ' (ψ x)) := φ'.continuous.measurable.comp hψ_meas -- entrywise integrability of the product, dominated by (‖φ‖‖φ'‖)·‖ψ‖² have hprod_int : Integrable (fun ω => φ (ψ (S.Z 0 ω)) * φ' (ψ (S.Z 0 ω))) μ := by have hmeas : AEStronglyMeasurable (fun ω => φ (ψ (S.Z 0 ω)) * φ' (ψ (S.Z 0 ω))) μ := ((hφ.comp (S.meas 0)).mul (hφ'.comp (S.meas 0))).aestronglyMeasurable refine Integrable.mono' (hψ_sq_int.const_mul (‖φ‖ * ‖φ'‖)) hmeas ?_ filter_upwards with ω simpa [Real.norm_eq_abs] using abs_apply_mul_le_norm_sq φ φ' ψ (S.Z 0 ω) exact S.sampleMean_mul_tendsto_inProb hφ hφ' hprod_int
Causalean.Stat.IIDSample.sampleCov_entry_tendsto_inProb · Causalean/Stat/Inference/VarianceEstimation.lean:126 · uses IIDSample , sampleMean , Tendsto_inProb
theorem sqrt_var_tendsto_inProb reviewed
Causalean.Stat

Standard-error consistency from variance consistency. Fix a positive scale σ₀. If a variance-estimator sequence varhat converges in probability to σ₀², then the standard-error estimator √varhat converges in probability to σ₀. This is exactly the σ̂ →ₚ σ₀ input required by the generic studentized CLT Tendsto_dist.div_tendsto_inProb_gaussian; callers feed fun N ω => Real.sqrt (varhat N ω) to it.

Formal statement
Ω :
Type*
ℕ → Ω → ℝ
σ₀ :
μ :
hσ₀_pos :
0 < σ₀
h :
Tendsto_inProb varhat (fun _ => σ₀ ^ 2) μ
Tendsto_inProb (fun n ω => sqrt (varhat n ω)) (fun _ => σ₀) μ
Proof (Lean source)
theorem sqrt_var_tendsto_inProb {Ω : Type*} [MeasurableSpace Ω] {varhat : ℕ → Ω → ℝ} {σ₀ : ℝ} {μ : Measure Ω} (hσ₀_pos : 0 < σ₀) (h : Tendsto_inProb varhat (fun _ => σ₀ ^ 2) μ) : Tendsto_inProb (fun n ω => sqrt (varhat n ω)) (fun _ => σ₀) μ := by have hsqrt := Tendsto_inProb.sqrt h have heq : sqrt (σ₀ ^ 2) = σ₀ := by rw [Real.sqrt_sq (le_of_lt hσ₀_pos)] rwa [heq] at hsqrt
Causalean.Stat.sqrt_var_tendsto_inProb · Causalean/Stat/Inference/VarianceEstimation.lean:180 · uses Tendsto_inProb
3 supporting declarations (lemmas, instances)
  • sampleMean_mul_tendsto_inProb theorem — Empirical mean of a product. For two measurable real-valued statistics g₁, g₂ of an i.i.d. sample whose product is integrable, the empirical mean S.sampleMean (g₁ · g₂) N converges in probability to the population integral ∫ x, g₁ x * g₂ x ∂P. Direct application of the generic WLLN to the product g := fun x => g₁ x * g₂ x.
    S :
    IIDSample Ω X μ P
    g₁ g₂ :
    X → ℝ
    hg₁_meas :
    hg₂_meas :
    hint :
    Integrable (fun ω => g₁ (S.Z 0 ω) * g₂ (S.Z 0 ω)) μ
    Tendsto_inProb (S.sampleMean (fun x => g₁ x * g₂ x)) (fun _ => ∫ x, g₁ x * g₂ x ∂P) μ
    Proof (Lean source)
    theorem sampleMean_mul_tendsto_inProb (S : IIDSample Ω X μ P) [IsProbabilityMeasure P] {g₁ g₂ : X → ℝ} (hg₁_meas : Measurable g₁) (hg₂_meas : Measurable g₂) (hint : Integrable (fun ω => g₁ (S.Z 0 ω) * g₂ (S.Z 0 ω)) μ) : Tendsto_inProb (S.sampleMean (fun x => g₁ x * g₂ x)) (fun _ => ∫ x, g₁ x * g₂ x ∂P) μ := have hintP : Integrable (fun x => g₁ x * g₂ x) P := by have hint_map : Integrable (fun x => g₁ x * g₂ x) (μ.map (S.Z 0)) := (MeasureTheory.integrable_map_measure (hg₁_meas.mul hg₂_meas).aestronglyMeasurable (S.meas 0).aemeasurable).mpr (by simpa [Function.comp_def] using hint) rwa [S.law] at hint_map S.sampleMean_tendsto_inProb (hg₁_meas.mul hg₂_meas) hintP
    Causalean.Stat.IIDSample.sampleMean_mul_tendsto_inProb · Causalean/Stat/Inference/VarianceEstimation.lean:62
  • abs_apply_mul_le_norm_sq theorem — The pointwise product of two functional-evaluations is dominated by a constant times ‖ψ x‖²: |φ (ψ x) * φ' (ψ x)| ≤ (‖φ‖ * ‖φ'‖) * ‖ψ x‖². Used to derive entrywise integrability of the product from the single hypothesis Integrable (fun x => ‖ψ x‖²) P.
    φ φ' :
    E →L[ℝ] ℝ
    ψ :
    X → E
    x :
    X
    |φ (ψ x) * φ' (ψ x)| ≤ (‖φ‖ * ‖φ'‖) * ‖ψ x‖ ^ 2
    Proof (Lean source)
    theorem abs_apply_mul_le_norm_sq (φ φ' : E →L[ℝ] ℝ) (ψ : X → E) (x : X) : |φ (ψ x) * φ' (ψ x)| ≤ (‖φ‖ * ‖φ'‖) * ‖ψ x‖ ^ 2 := by rw [abs_mul] have hb1 : |φ (ψ x)| ≤ ‖φ‖ * ‖ψ x‖ := (Real.norm_eq_abs _).symm.le.trans (φ.le_opNorm (ψ x)) have hb2 : |φ' (ψ x)| ≤ ‖φ'‖ * ‖ψ x‖ := (Real.norm_eq_abs _).symm.le.trans (φ'.le_opNorm (ψ x)) calc |φ (ψ x)| * |φ' (ψ x)| ≤ (‖φ‖ * ‖ψ x‖) * (‖φ'‖ * ‖ψ x‖) := mul_le_mul hb1 hb2 (abs_nonneg _) (mul_nonneg (norm_nonneg _) (norm_nonneg _)) _ = (‖φ‖ * ‖φ'‖) * ‖ψ x‖ ^ 2 := by ring
    Causalean.Stat.IIDSample.abs_apply_mul_le_norm_sq · Causalean/Stat/Inference/VarianceEstimation.lean:107
  • sqrt theorem — Square root preserves convergence in probability. If Vn →ₚ v₀ under μ, then √Vn →ₚ √v₀. Continuous mapping with the (everywhere continuous) Real.sqrt, via Tendsto_inProb.comp_continuousAt.
    Ω :
    Type*
    ℕ → Ω → ℝ
    v₀ :
    μ :
    h :
    Tendsto_inProb Vn (fun _ => v₀) μ
    Tendsto_inProb (fun n ω => sqrt (Vn n ω)) (fun _ => sqrt v₀) μ
    Proof (Lean source)
    theorem Tendsto_inProb.sqrt {Ω : Type*} [MeasurableSpace Ω] {Vn : ℕ → Ω → ℝ} {v₀ : ℝ} {μ : Measure Ω} (h : Tendsto_inProb Vn (fun _ => v₀) μ) : Tendsto_inProb (fun n ω => sqrt (Vn n ω)) (fun _ => sqrt v₀) μ := Tendsto_inProb.comp_continuousAt (Real.continuous_sqrt.continuousAt) h
    Causalean.Stat.Tendsto_inProb.sqrt · Causalean/Stat/Inference/VarianceEstimation.lean:171
Wald­Vec 2 core · 0 supporting This file reduces multivariate Wald ellipsoid coverage to scalar convergence of the Wald statistic. ★ wald_coverage_Iic★ wald_coverage_Iic_of_noAtoms

This file reduces multivariate Wald ellipsoid coverage to scalar convergence of the Wald statistic. The theorem Tendsto_dist.wald_coverage_Iic says that if Wn ⇒ χ, the limit has zero mass on the boundary of Iic c, and a coverage sequence is asymptotically equivalent to the event {ω | Wn n ω ≤ c}, then the coverage sequence converges to χ (Iic c).

The variant Tendsto_dist.wald_coverage_Iic_of_noAtoms discharges the boundary-null hypothesis when the Wald-statistic limit law has no atoms. The chi-squared specialization lives in Causalean.Stat.Inference.ChiSquaredWald, which identifies the Gaussian quadratic-form limit.

theorem wald_coverage_Iic reviewed
Causalean.Stat.Tendsto_dist

Wald / confidence-ellipsoid asymptotic coverage. Suppose the scalar Wald statistic sequence Wₙ is measurable at every sample size and converges in distribution to a limit law χ, and that χ gives zero mass to the boundary frontier (Iic c) = {c}. If a real sequence coverProb is asymptotically equivalent to the ellipsoid event {ω | Wₙ ω ≤ c}, then coverProb converges to χ(Iic c).

Formal statement
Ω :
Wn :
ℕ → Ω → ℝ
hWn :
∀ n, AEMeasurable (Wn n) μ
hW :
Tendsto_dist Wn χ μ hWn
c :
hfront :
χ (frontier (Iic c)) = 0
coverProb :
ℕ → ℝ
h_bridge :
Tendsto (fun n => coverProb n - (μ {ω | Wn n ω ≤ c}).toReal) atTop (𝓝 0)
Tendsto coverProb atTop (𝓝 ((χ (Iic c)).toReal))
Proof (Lean source)
theorem Tendsto_dist.wald_coverage_Iic {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {Wn : ℕ → Ω → ℝ} (hWn : ∀ n, AEMeasurable (Wn n) μ) {χ : Measure ℝ} [IsProbabilityMeasure χ] (hW : Tendsto_dist Wn χ μ hWn) {c : ℝ} (hfront : χ (frontier (Iic c)) = 0) (coverProb : ℕ → ℝ) (h_bridge : Tendsto (fun n => coverProb n - (μ {ω | Wn n ω ≤ c}).toReal) atTop (𝓝 0)) : Tendsto coverProb atTop (𝓝 ((χ (Iic c)).toReal)) := by let ellProb : ℕ → ℝ := fun n => (μ {ω | Wn n ω ≤ c}).toReal change Tendsto (fun n => coverProb n - ellProb n) atTop (𝓝 0) at h_bridge have hpm : Tendsto (fun n => ((μ.map (Wn n)) (Iic c)).toReal) atTop (𝓝 ((χ (Iic c)).toReal)) := Tendsto_dist.tendsto_measure_of_null_frontier hWn hW hfront have hell : Tendsto ellProb atTop (𝓝 ((χ (Iic c)).toReal)) := by refine hpm.congr' ?_ filter_upwards with n rw [Measure.map_apply_of_aemeasurable (hWn n) measurableSet_Iic] rfl have hsum := hell.add h_bridge have hsum' : Tendsto (fun n => ellProb n + (coverProb n - ellProb n)) atTop (𝓝 ((χ (Iic c)).toReal)) := by simpa using hsum refine hsum'.congr' ?_ filter_upwards with n ring
Causalean.Stat.Tendsto_dist.wald_coverage_Iic · Causalean/Stat/Inference/WaldVec.lean:70 · uses Tendsto_dist
theorem wald_coverage_Iic_of_noAtoms reviewed
Causalean.Stat.Tendsto_dist

Wald / ellipsoid coverage with an atomless limit. Suppose the scalar Wald statistic sequence Wₙ is measurable at every sample size and converges in distribution to a limit law χ with no atoms (which holds for any non-degenerate χ²_d, and more generally for any continuous limit). If a real sequence coverProb is asymptotically equivalent to the ellipsoid event {ω | Wₙ ω ≤ c}, then coverProb converges to χ(Iic c). The boundary-null hypothesis of wald_coverage_Iic is automatic here: frontier (Iic c) = {c} and χ {c} = 0.

Formal statement
Ω :
Wn :
ℕ → Ω → ℝ
hWn :
∀ n, AEMeasurable (Wn n) μ
hW :
Tendsto_dist Wn χ μ hWn
c :
coverProb :
ℕ → ℝ
h_bridge :
Tendsto (fun n => coverProb n - (μ {ω | Wn n ω ≤ c}).toReal) atTop (𝓝 0)
Tendsto coverProb atTop (𝓝 ((χ (Iic c)).toReal))
Proof (Lean source)
theorem Tendsto_dist.wald_coverage_Iic_of_noAtoms {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {Wn : ℕ → Ω → ℝ} (hWn : ∀ n, AEMeasurable (Wn n) μ) {χ : Measure ℝ} [IsProbabilityMeasure χ] [NullSingletonClass χ] (hW : Tendsto_dist Wn χ μ hWn) (c : ℝ) (coverProb : ℕ → ℝ) (h_bridge : Tendsto (fun n => coverProb n - (μ {ω | Wn n ω ≤ c}).toReal) atTop (𝓝 0)) : Tendsto coverProb atTop (𝓝 ((χ (Iic c)).toReal)) := by refine Tendsto_dist.wald_coverage_Iic hWn hW ?_ coverProb h_bridge rw [frontier_Iic] exact measure_singleton c
Causalean.Stat.Tendsto_dist.wald_coverage_Iic_of_noAtoms · Causalean/Stat/Inference/WaldVec.lean:110 · uses Tendsto_dist