Stat.Inference
Inferential tooling: delta methods (scalar, functional, Hadamard), Wald/chi-squared statistics, and Slutsky ingredients.
AffineInversion 2 core · 6 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.
Given a real parameter region, real-valued intercept, slope, and radius parameters, the affine-inversion acceptance set consists exactly of those parameter values in the region whose affine discrepancy is at most .
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
Proof (Lean source)
6 supporting declarations (lemmas, instances)
-
affineInterval_witness_of_nonneg_slopetheorem — Given a nonnegative affine slope, a nonnegative radius, and an intercept whose absolute value is at most the slope plus the radius, there is a parameter in the interval from minus one to one whose affine discrepancy is at most the radius.hypothesesA B r :ℝhB :0 ≤ Bhr :0 ≤ rhA :|A| ≤ B + rProof (Lean source)
theorem affineInterval_witness_of_nonneg_slope (A B r : ℝ) (hB : 0 ≤ B) (hr : 0 ≤ r) (hA : |A| ≤ B + r) : ∃ theta ∈ Icc (-1 : ℝ) 1, |A - theta * B| ≤ r := by by_cases hB0 : B = 0 · refine ⟨0, by norm_num, ?_⟩ simpa [hB0] using hA have hBpos : 0 < B := lt_of_le_of_ne hB (Ne.symm hB0) have hA' := abs_le.mp hA by_cases hlo : A < -B · refine ⟨-1, by norm_num, ?_⟩ rw [abs_le] constructor <;> linarith by_cases hhi : B < A · refine ⟨1, by norm_num, ?_⟩ rw [abs_le] constructor <;> linarith refine ⟨A / B, ⟨?_, ?_⟩, ?_⟩ · rw [le_div_iff₀ hBpos] linarith · rw [div_le_iff₀ hBpos] linarith · simpa [div_mul_cancel₀ A hB0] using hr -
affineInterval_nonempty_ifftheorem — For an affine intercept, slope, and radius, the affine-inversion set over the interval from minus one to one is nonempty exactly when the radius is nonnegative and the intercept's absolute value is at most the slope's absolute value plus the radius.hypothesesA B r :ℝconclusion(affineInversionSet (Icc (-1 : ℝ) 1) A B r).Nonempty ↔ 0 ≤ r ∧ |A| ≤ |B| + rProof (Lean source)
theorem affineInterval_nonempty_iff (A B r : ℝ) : (affineInversionSet (Icc (-1 : ℝ) 1) A B r).Nonempty ↔ 0 ≤ r ∧ |A| ≤ |B| + r := by constructor · rintro ⟨theta, htheta, hdist⟩ have htheta' : |theta| ≤ 1 := abs_le.mpr htheta refine ⟨(abs_nonneg _).trans hdist, ?_⟩ calc |A| = |(A - theta * B) + theta * B| := by ring_nf _ ≤ |A - theta * B| + |theta * B| := abs_add_le _ _ _ ≤ r + |B| := add_le_add hdist (by rw [abs_mul] exact (mul_le_mul_of_nonneg_right htheta' (abs_nonneg B)).trans_eq (one_mul _)) _ = |B| + r := add_comm _ _ · rintro ⟨hr, hA⟩ obtain ⟨theta, htheta, hdist⟩ := affineInterval_witness_of_nonneg_slope A |B| r (abs_nonneg B) hr hA by_cases hB : 0 ≤ B · refine ⟨theta, htheta, ?_⟩ simpa [abs_of_nonneg hB] using hdist · refine ⟨-theta, ⟨by linarith [htheta.2], by linarith [htheta.1]⟩, ?_⟩ simpa [abs_of_neg (lt_of_not_ge hB)] using hdist -
affineInversionSet_restrictedVolume_letheorem — Affine inversion has restricted volume at most the parameter-region volume and at most twice the radius divided by the nonzero slope.hypothesesconclusionrestrictedSetVolume region (affineInversionSet region A B r)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 -
affineInversionSet_restrictedVolume_le_regiontheorem — Affine inversion is always bounded by the volume of its parameter region.hypothesesconclusionProof (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) -
expectedRestrictedVolume_affineInversion_letheorem — 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.hypothesesΩ :Type*Q :region :Set ℝhregionFinite :volume region ≠ ⊤A B K :Ω → ℝn :ℕL mu Kbar q :ℝhL :0 ≤ Lhmu :0 < muhn :0 < nhK :∀ w, 0 ≤ K whKint :Integrable K QhKbar :(∫ w, K w ∂Q) ≤ Kbarhbad :(Q {w | mu / 2 < |B w - mu|}).toReal ≤ qconclusionProof (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 -
inverseStrength_to_frontiertheorem — An inverse-root plus inverse-strength bound, capped by a nonnegative region volume, is bounded by the compact inverse-square-root frontier form.hypothesescap A B t :ℝhB :0 ≤ Bht :0 < tProof (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 _)
ChiSquaredWald 4 core · 3 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 Modes.TendstoInLaw.wald_coverage_chiSq plugs that chi-squared
limit into the generic ellipsoid-coverage theorem from
Causalean.Stat.Inference.WaldVec.
√Σ as a linear equivalence (injective + finite-dimensional ⇒ bijective).
Definition (Lean source)
Let be a measure on a measurable sample space, and let a measurable function take values in a finite-dimensional real inner-product space equipped with its Borel σ-algebra. Given that function is measurable, its squared norm is integrable under , and its second-moment operator is injective, the inverse second-moment operator is the continuous linear map obtained by applying twice the inverse of the positive square root of that operator.
Definition (Lean source)
χ² 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
Proof (Lean source)
If a Wald statistic converges in distribution to a chi-squared law, the degrees of freedom are positive, and a coverage-probability sequence is asymptotically equivalent to the probability that the statistic lies in a lower half-line, then coverage converges to the chi-squared probability of that half-line.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
posSqrt_injectivetheorem — If the second-moment operator Σ is injective, so is its square root √Σ (Σ = √Σ ∘ √Σ, so √Σ x = 0 ⇒ Σ x = 0).Proof (Lean source)
theorem posSqrt_injective (hinj : Injective (secondMomentLM hψ hvar)) : Injective (secondMomentLM_isPositive hψ hvar).posSqrt := by intro x y hxy refine hinj ?_ have h := congrArg (secondMomentLM_isPositive hψ hvar).posSqrt hxy rwa [← LinearMap.comp_apply, ← LinearMap.comp_apply, (secondMomentLM_isPositive hψ hvar).posSqrt_mul_self] at h -
secondMomentInv_secondMomentLMtheorem — Σ⁻¹ is a left inverse of Σ.hypothesesconclusionsecondMomentInv hψ hvar hinj (secondMomentLM hψ hvar x) = xProof (Lean source)
theorem secondMomentInv_secondMomentLM (hinj : Injective (secondMomentLM hψ hvar)) (x : E) : secondMomentInv hψ hvar hinj (secondMomentLM hψ hvar x) = x := by have hsig : secondMomentLM hψ hvar x = posSqrtEquiv hψ hvar hinj (posSqrtEquiv hψ hvar hinj x) := by rw [posSqrtEquiv_apply, posSqrtEquiv_apply, ← LinearMap.comp_apply, (secondMomentLM_isPositive hψ hvar).posSqrt_mul_self] rw [secondMomentInv_apply, hsig, (posSqrtEquiv hψ hvar hinj).symm_apply_apply, (posSqrtEquiv hψ hvar hinj).symm_apply_apply] -
secondMomentLM_secondMomentInvtheorem — Σ⁻¹ is a right inverse of Σ.hypothesesconclusionsecondMomentLM hψ hvar (secondMomentInv hψ hvar hinj x) = xProof (Lean source)
theorem secondMomentLM_secondMomentInv (hinj : Injective (secondMomentLM hψ hvar)) (x : E) : secondMomentLM hψ hvar (secondMomentInv hψ hvar hinj x) = x := by have hsig : ∀ z, secondMomentLM hψ hvar z = posSqrtEquiv hψ hvar hinj (posSqrtEquiv hψ hvar hinj z) := fun z => by rw [posSqrtEquiv_apply, posSqrtEquiv_apply, ← LinearMap.comp_apply, (secondMomentLM_isPositive hψ hvar).posSqrt_mul_self] rw [secondMomentInv_apply, hsig, (posSqrtEquiv hψ hvar hinj).apply_symm_apply, (posSqrtEquiv hψ hvar hinj).apply_symm_apply]
DeltaMethod 5 core · 0 supporting This file proves smooth delta-method results at any nonnegative rate diverging to infinity. ★ deltaMethod_scalar_rate★ deltaMethod_scalar★ deltaMethod_rate★ deltaMethod★ gaussian_pushforward_covariance
This file proves smooth delta-method results at any nonnegative rate diverging
to infinity. The scalar theorem deltaMethod_scalar_rate transforms a Gaussian
limit through a differentiable real map and returns the Gaussian limit with
variance parameter g' ^ 2 * σsq.
The multivariate theorem deltaMethod_rate works at the probability-measure
level and maps the limiting law through the Fréchet derivative. The proofs use
the stochastic-order and tightness
utilities from Causalean.Stat.Limit.Convergence.
Scalar delta method at a general rate. For a real-valued estimator sequence Tn of a target t₀, suppose the nonnegative rate r diverges to infinity, the rescaled deviation r n * (Tn − t₀) is measurable at every sample size, and the rescaled image r 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
Proof (Lean source)
Square-root-rate scalar delta method. Given measurability of the scaled original statistic, measurability of the scaled transform, differentiability of g at t₀, and the square-root-rate Gaussian limit for Tn, the transformed statistic has the derivative-scaled Gaussian limit.
Formal statement
Proof (Lean source)
Multivariate delta method at a general rate. Let Tn be a sequence of E-valued estimators of a target t₀, let the nonnegative rate r diverge to infinity, and let g : E → F be Fréchet-differentiable at t₀ with derivative Dg. Given that the rescaled deviations r n • (Tn − t₀) are measurable and that their images r n • (g(Tn) − g(t₀)) are measurable, if the laws of r n • (Tn − t₀) converge weakly to a probability measure Q on E, then the laws of r n • (g(Tn) − g(t₀)) converge weakly to the pushforward of Q along the linear map Dg.
Formal statement
Proof (Lean source)
Square-root-rate multivariate delta method. Given measurability of the scaled original statistic, measurability of the scaled transform, Fréchet differentiability at the target, and the square-root-rate weak limit, the transformed statistic converges to the derivative pushforward.
Formal statement
Proof (Lean source)
Linear image of a Gaussian law. For a Gaussian probability law Q and a continuous linear map Dg, the pushforward is Gaussian and its covariance bilinear form is Σ(Dg₀⁺ u, Dg₀⁺ v), equivalently the operator covariance Dg ∘ Σ ∘ Dg⁺.
Formal statement
Proof (Lean source)
OracleInfluenceWald 4 core · 1 supporting For an asymptotically linear estimator with influence function ψ, the asymptotic standard deviation of √n (θ̂ₙ − θ₀) is √(∫ ψ² dP). ★ oracleStudentized_tendsto★ oracle_wald_coverage
Wald intervals with the influence-function standard error
For an asymptotically linear estimator with influence function ψ, the asymptotic standard
deviation of √n (θ̂ₙ − θ₀) is √(∫ ψ² dP). This file estimates it by the square root of the
plug-in variance of ψ(Z₁), …, ψ(Zₙ) and proves the resulting studentized CLT and Wald
coverage.
The standard error is an oracle: it evaluates the true influence function ψ, which
generally depends on the unknown distribution. A feasible interval replaces ψ by an
estimate and needs an extra consistency argument, which is not given here.
Main declarations: IIDSample.oracleInfluenceSE, its consistency
IIDSample.oracleInfluenceSE_tendsto_inProb, the studentized statistic
IIDSample.oracleStudentized, the limit law oracleStudentized_tendsto, and the coverage
theorem oracle_wald_coverage.
For a measurable sample space, measurable observation space, sample-space measure, and observation-space measure, an independent, identically distributed sample, a real-valued influence function, and a sample size, the oracle influence-function standard error is the square root of the plug-in variance of the influence function over the first n observations.
Definition (Lean source)
For a measurable sample space, measurable observation space, sample-space measure, and observation-space measure, a sequence of real-valued estimators, a target real value, an independent, identically distributed sample, a real-valued influence function, and a sample size, the oracle studentized statistic is , where the denominator is the oracle influence-function standard error computed from the full sample of that size.
Definition (Lean source)
Studentized CLT with the oracle standard error. Let θ̂ₙ be asymptotically linear at θ₀ with influence function ψ along the i.i.d. sample S, where ψ is measurable, integrable, and square-integrable; suppose further that the influence function is nondegenerate, , the rescaled estimator is a.e. measurable at every sample size, and the oracle studentized statistic is a.e. measurable at every sample size. Then the oracle-studentized statistic converges in distribution to the standard normal law, where is the oracle influence-function standard error.
Formal statement
Proof (Lean source)
Wald asymptotic coverage with the oracle standard error. Under the asymptotic-linearity hypothesis, measurability, integrability, and square-integrability of ψ, influence-function nondegeneracy, and measurability of the rescaled estimator and of the studentized statistic at every sample size — the hypotheses of oracleStudentized_tendsto — fix a positive critical value z and a coverage-probability sequence coverProb that asymptotically tracks the studentized interval's true coverage event; then coverProb converges to the standard normal probability of the interval [-z, z], so the oracle studentized interval has asymptotic -coverage.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
oracleInfluenceSE_tendsto_inProbtheorem — Consistency of the oracle influence-function standard error. Along an i.i.d. sample S, if the influence function ψ is measurable, integrable, square-integrable, and has population mean zero, then the oracle standard error converges in probability to the asymptotic standard deviation $\sqrt{\int \psi^2\,dP}$.hypothesesΩ :sharedType u_1X :sharedType u_2S :IIDSample Ω X μ Pψ :X → ℝhψ_meas :hψ_int :Integrable (fun ω => ψ (S.Z 0 ω)) μhψ_sq_int :Integrable (fun ω => (ψ (S.Z 0 ω)) ^ 2) μhmean :∫ x, ψ x ∂P = 0conclusionModes.TendstoInProbability (fun _ : ℕ => μ) (oracleInfluenceSE S ψ) atTop (fun _ _ => sqrt (∫ x, (ψ x) ^ 2 ∂P))Proof (Lean source)
theorem oracleInfluenceSE_tendsto_inProb (S : IIDSample Ω X μ P) [IsProbabilityMeasure P] {ψ : X → ℝ} (hψ_meas : Measurable ψ) (hψ_int : Integrable (fun ω => ψ (S.Z 0 ω)) μ) (hψ_sq_int : Integrable (fun ω => (ψ (S.Z 0 ω)) ^ 2) μ) (hmean : ∫ x, ψ x ∂P = 0) : Modes.TendstoInProbability (fun _ : ℕ => μ) (oracleInfluenceSE S ψ) atTop (fun _ _ => sqrt (∫ x, (ψ x) ^ 2 ∂P)) := Modes.TendstoInProbability.sqrt (empiricalVar_tendsto_inProb S hψ_meas hψ_int hψ_sq_int hmean)
RatioDeltaMethod 3 core · 1 supporting This file specializes the multivariate delta method to ratio statistics such as Wald-ratio and LATE estimands. ★ deltaMethod_ratio_rate★ 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.
For a two-dimensional real vector with coordinates , the ratio derivative is the linear map sending an increment to , namely the derivative of the ratio whenever is nonzero.
Definition (Lean source)
General-rate ratio delta method. Let t₀ have nonzero denominator, let the nonnegative rate r diverge, suppose the scaled bivariate estimator is measurable and the scaled ratio is measurable, and assume the scaled estimator has weak limit Q. Then the scaled ratio converges to the pushforward of Q by ratioDeriv t₀.
Formal statement
Proof (Lean source)
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
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
hasFDerivAt_ratiotheorem — 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₀.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
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
Modes.TendstoInLaw.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
Modes.TendstoInLaw.div_tendsto_inProb_gaussian proves that Xn / σ_hat ⇒ N(0,1)
from Xn ⇒ N(0, σ₀ ^ 2) and σ_hat →ₚ σ₀ > 0. The coverage theorem
Modes.TendstoInLaw.wald_coverage then transfers the limiting probability of
Sn ∈ Icc (-z) z to an abstract coverage sequence via a bridge hypothesis.
If a real sequence converges in distribution to a centered Gaussian law, its limiting standard deviation is positive, an estimated standard deviation converges in probability to that value, and the studentized sequence is a.e. measurable, then the studentized sequence converges in distribution to the standard Gaussian law.
Formal statement
Proof (Lean source)
If a studentized statistic converges in distribution to the standard Gaussian law, the interval half-width is positive, and a coverage-probability sequence is asymptotically equivalent to the probability that the statistic lies in the symmetric interval, then coverage converges to the standard Gaussian probability of that interval.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
tendsto_measure_of_null_frontiertheorem — If a real sequence converges in distribution and the limiting law gives zero mass to a set's frontier, then the probabilities of that set under the sequence's laws converge to its probability under the limiting law.hypothesesProof (Lean source)
theorem Modes.TendstoInLaw.tendsto_measure_of_null_frontier {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {Xn : ℕ → Ω → ℝ} {Q : Measure ℝ} [IsProbabilityMeasure Q] {E : Set ℝ} (hX : Modes.TendstoInLaw (fun _ : ℕ => μ) Xn atTop Q) (hE : Q (frontier E) = 0) : Tendsto (fun n => ((μ.map (Xn n)) E).toReal) atTop (𝓝 (Q E).toReal) := by have hXn : ∀ n, AEMeasurable (Xn n) μ := hX.forall_aemeasurable rw [Tendsto_dist_iff _ _ _ hXn] at hX let μs : ℕ → ProbabilityMeasure ℝ := fun n => ⟨μ.map (Xn n), Measure.isProbabilityMeasure_map (hXn n)⟩ let ν : ProbabilityMeasure ℝ := ⟨Q, inferInstance⟩ have hE' : ν (frontier E) = 0 := by change (Q (frontier E)).toNNReal = 0 simp [hE] have hpm := MeasureTheory.ProbabilityMeasure.tendsto_measure_of_null_frontier_of_tendsto (μs := μs) (μ := ν) hX (E := E) hE' have hreal := NNReal.continuous_coe.tendsto _ |>.comp hpm simpa [μs, ν, ENNReal.coe_toNNReal_eq_toReal, Function.comp_def] using hreal -
gaussianMeasure_zero_one_singletontheorem — The standard normal has no atom at any real point.Proof (Lean source)
theorem gaussianMeasure_zero_one_singleton (x : ℝ) : gaussianMeasure 0 1 ({x} : Set ℝ) = 0 := by haveI : NullSingletonClass (gaussianMeasure 0 1) := by unfold gaussianMeasure exact ProbabilityTheory.nullSingletonClass_gaussianReal (by norm_num) exact MeasureTheory.NullSingletonClass.measure_singleton x -
gaussianMeasure_zero_one_frontier_Icctheorem — The standard normal gives zero mass to the boundary of a symmetric closed interval.Proof (Lean source)
theorem gaussianMeasure_zero_one_frontier_Icc {z : ℝ} (hz : 0 < z) : gaussianMeasure 0 1 (frontier (Icc (-z) z)) = 0 := by have hle : -z ≤ z := by linarith rw [frontier_Icc hle] rw [show ({-z, z} : Set ℝ) = {-z} ∪ {z} by ext x; simp [or_comm]] exact le_antisymm (by calc gaussianMeasure 0 1 (({-z} : Set ℝ) ∪ {z}) ≤ gaussianMeasure 0 1 ({-z} : Set ℝ) + gaussianMeasure 0 1 ({z} : Set ℝ) := measure_union_le _ _ _ = 0 := by simp [gaussianMeasure_zero_one_singleton]) zero_le
VarianceEstimation 4 core · 5 supporting This file proves variance and covariance consistency tools for i.i.d. ★ sampleCov_entry_tendsto_inProb★ empiricalVar_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.
IIDSample.empiricalVar is the plug-in variance of a scalar statistic; the file proves its
centred form, nonnegativity, and consistency for a mean-zero square-integrable statistic.
The helper abs_apply_mul_le_norm_sq supplies the domination bound needed for
entrywise integrability. The final packaging lemmas Modes.TendstoInProbability.sqrt and
sqrt_var_tendsto_inProb convert variance-estimator consistency into
standard-error consistency, the input expected by the studentized CLT.
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
Proof (Lean source)
For an independent and identically distributed sample, a real-valued statistic of one observation, and a sample size, the plug-in (empirical) variance is the function that assigns to each sample-space outcome the empirical mean of the statistic squared minus the square of its empirical mean, computed from the first observations at that outcome.
Consistency of the empirical variance. Along the i.i.d. sample S, if the influence function ψ is measurable, integrable, square-integrable, and has population mean zero, then the empirical variance converges in probability to the population second moment .
Formal statement
Proof (Lean source)
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 Modes.TendstoInLaw.div_tendsto_inProb_gaussian; callers feed fun N ω => Real.sqrt (varhat N ω) to it.
Formal statement
Proof (Lean source)
5 supporting declarations (lemmas, instances)
-
sampleMean_mul_tendsto_inProbtheorem — 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.hypothesesΩ :sharedType u_1X :sharedType u_2S :IIDSample Ω X μ Pg₁ g₂ :X → ℝhg₁_meas :Measurable g₁hg₂_meas :Measurable g₂hint :Integrable (fun ω => g₁ (S.Z 0 ω) * g₂ (S.Z 0 ω)) μconclusionModes.TendstoInProbability (fun _ : ℕ => μ) (S.sampleMean (fun x => g₁ x * g₂ x)) atTop (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 ω)) μ) : Modes.TendstoInProbability (fun _ : ℕ => μ) (S.sampleMean (fun x => g₁ x * g₂ x)) atTop (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 -
abs_apply_mul_le_norm_sqtheorem — 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.hypothesesX :sharedType u_2E :sharedType u_3φ φ' :E →L[ℝ] ℝψ :X → Ex :Xconclusion|φ (ψ x) * φ' (ψ x)| ≤ (‖φ‖ * ‖φ'‖) * ‖ψ x‖ ^ 2Proof (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 -
empiricalVar_eq_centeredtheorem — Centred form of the empirical variance. For an iid sample S, a statistic ψ, a sample size n, and a sample-path outcome ω, the plug-in variance of ψ equals the centered empirical second moment of ψ over the first n observations.hypothesesconclusionempiricalVar S ψ n ω= (n : ℝ)⁻¹ * ∑ i ∈ range n, (ψ (S.Z i ω) - S.sampleMean ψ n ω) ^ 2Proof (Lean source)
theorem empiricalVar_eq_centered (S : IIDSample Ω X μ P) (ψ : X → ℝ) (n : ℕ) (ω : Ω) : empiricalVar S ψ n ω = (n : ℝ)⁻¹ * ∑ i ∈ range n, (ψ (S.Z i ω) - S.sampleMean ψ n ω) ^ 2 := by rcases eq_or_ne n 0 with hn | hn · subst hn; simp [empiricalVar, IIDSample.sampleMean] · have hncast : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hn simp only [empiricalVar, IIDSample.sampleMean] set f : ℕ → ℝ := fun i => ψ (S.Z i ω) with hf have hA : ∑ i ∈ range n, (f i - (n : ℝ)⁻¹ * ∑ j ∈ range n, f j) ^ 2 = (∑ i ∈ range n, (f i) ^ 2) - 2 * ((n : ℝ)⁻¹ * ∑ j ∈ range n, f j) * (∑ i ∈ range n, f i) + (n : ℝ) * ((n : ℝ)⁻¹ * ∑ j ∈ range n, f j) ^ 2 := by have hpt : ∀ i, (f i - (n : ℝ)⁻¹ * ∑ j ∈ range n, f j) ^ 2 = (f i) ^ 2 - 2 * ((n : ℝ)⁻¹ * ∑ j ∈ range n, f j) * (f i) + ((n : ℝ)⁻¹ * ∑ j ∈ range n, f j) ^ 2 := fun i => by ring simp_rw [hpt] rw [Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum, Finset.sum_const, Finset.card_range, nsmul_eq_mul] rw [hA] field_simp ring -
empiricalVar_nonnegtheorem — The empirical variance is nonnegative, for any sample, statistic, sample size, and outcome: it is a centred empirical second moment (empiricalVar_eq_centered).hypothesesconclusion0 ≤ empiricalVar S ψ n ωProof (Lean source)
theorem empiricalVar_nonneg (S : IIDSample Ω X μ P) (ψ : X → ℝ) (n : ℕ) (ω : Ω) : 0 ≤ empiricalVar S ψ n ω := by rw [empiricalVar_eq_centered] apply mul_nonneg · positivity · exact Finset.sum_nonneg (fun i _ => sq_nonneg _) -
sqrttheorem — Square root preserves convergence in probability. If Vn →ₚ v₀ under μ, then √Vn →ₚ √v₀. Continuous mapping with the (everywhere continuous) Real.sqrt, via Modes.TendstoInProbability.comp_continuousAt.hypothesesProof (Lean source)
theorem Modes.TendstoInProbability.sqrt {Ω : Type*} [MeasurableSpace Ω] {Vn : ℕ → Ω → ℝ} {v₀ : ℝ} {μ : Measure Ω} (h : Modes.TendstoInProbability (fun _ : ℕ => μ) Vn atTop (fun _ _ => v₀)) : Modes.TendstoInProbability (fun _ : ℕ => μ) (fun n ω => sqrt (Vn n ω)) atTop (fun _ _ => sqrt v₀) := Modes.TendstoInProbability.comp_continuousAt (Real.continuous_sqrt.continuousAt) h
WaldVec 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 Modes.TendstoInLaw.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 Modes.TendstoInLaw.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.
If a scalar Wald statistic converges in distribution, the limiting law gives zero mass to the frontier of the lower half-line, and a coverage-probability sequence is asymptotically equivalent to the probability that the statistic lies in that half-line, then coverage converges to the limiting law's probability of the half-line.
Formal statement
Proof (Lean source)
If a scalar Wald statistic converges in distribution to an atomless probability law and a coverage-probability sequence is asymptotically equivalent to the probability that the statistic lies in a lower half-line, then coverage converges to the limiting law's probability of that half-line.