Stat.Bootstrap.SmoothFunctionOfMeans
The bootstrap delta method.
Basic 7 core · 1 supporting This module defines estimators obtained by applying a scalar function to the canonical finite mean, together with a reusable notion of almost-sure conditional bootstrap tightness and the basic ratio-of-means specializati ★ measurable_smoothMeanEstimator
Smooth functions of finite-dimensional sample means
This module defines estimators obtained by applying a scalar function to the canonical finite mean, together with a reusable notion of almost-sure conditional bootstrap tightness and the basic ratio-of-means specialization.
Given a finite vector of observations, its finite mean is the coordinate sum scaled by the reciprocal of the vector length.
Definition (Lean source)
Given a moment function, a scalar transform, a sample size, and data of that size, the smooth-function-of-means estimator applies the transform to the finite average of the moment vectors.
If the moment function and the transform are measurable, then the smooth-function-of-means estimator is measurable at every sample size.
Formal statement
Proof (Lean source)
For an iid sample and a bootstrap statistic, almost-sure conditional bootstrap tightness means that, for almost every realized data sequence, the conditional bootstrap norm tails are eventually uniformly small.
Definition (Lean source)
For a bivariate moment function, a sample size, and observed data, the ratio-of-means estimator divides the first finite sample moment by the second.
Definition (Lean source)
Given a bivariate vector, its coordinate ratio is its first coordinate divided by its second coordinate.
Definition (Lean source)
Given a bivariate moment function, its population mean, and an observation, the ratio influence function is the quotient-rule linearization of the first moment divided by the second.
Definition (Lean source)
1 supporting declaration (lemmas, instances)
-
ratioOfMeansEstimator_eq_smoothMeanEstimatortheorem — The ratio-of-means estimator built from a moment function, at a sample size and data vector, equals the smooth mean estimator using the coordinate ratio.hypothesesconclusionProof (Lean source)
theorem ratioOfMeansEstimator_eq_smoothMeanEstimator (g : X → EuclideanSpace ℝ (Fin 2)) (n : ℕ) (x : Fin n → X) : ratioOfMeansEstimator g n x = smoothMeanEstimator g coordinateRatio n x := by rfl
Tightness 3 core · 2 supporting This module gives the exact finite-sample Chebyshev bound for the centered bootstrap mean and deduces almost-sure conditional tightness. ★ bootstrapMean_chebyshev★ scaledBootstrapMeanDifferenceVec_conditionallyBounded
Conditional bootstrap tightness for sample means
This module gives the exact finite-sample Chebyshev bound for the centered bootstrap mean and deduces almost-sure conditional tightness. Coordinate bounds and a norm-tightness theorem cover finite-dimensional moment vectors.
Given a moment function, a sample size, observed data, and resampled data, the scaled centered bootstrap mean is the square-root-size multiple of the difference between the resample and data means.
Exact conditional Chebyshev bound. For a measurable real statistic, nonempty observed data, and a positive threshold, the conditional tail of the square-root-scaled bootstrap mean is at most the empirical variance divided by the threshold squared.
Formal statement
Proof (Lean source)
Finite-dimensional bootstrap tightness. For an iid sample and a measurable vector statistic with integrable squared norm, the norm of its square-root-scaled centered bootstrap mean is conditionally bounded in probability almost surely in the data.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
scaledBootstrapMeanDifference_conditionallyBoundedtheorem — For an iid sample and a measurable square-integrable real statistic, the square-root-scaled centered bootstrap mean is conditionally bounded in probability for almost every data sequence.hypothesesOmega :sharedType u_1X :sharedType u_2S :IIDSample Omega X mu Pg :X → ℝhg :hg2 :Integrable (fun x ↦ (g x) ^ 2) PconclusionProof (Lean source)
theorem scaledBootstrapMeanDifference_conditionallyBounded (S : IIDSample Omega X mu P) (g : X → ℝ) (hg : Measurable g) (hg2 : Integrable (fun x ↦ (g x) ^ 2) P) : ConditionallyBoundedInProbability S (scaledBootstrapMeanDifference g) := by unfold ConditionallyBoundedInProbability filter_upwards [empiricalVar_tendsto_ae S g hg hg2] with omega hvar intro epsilon hepsilon let B : ℝ := |variance g P| + 1 have hB : 0 < B := by dsimp [B]; positivity let M : ℝ := sqrt (B / epsilon + 1) have hM : 0 < M := by dsimp [M] exact Real.sqrt_pos.2 (by positivity) refine ⟨M, hM, ?_⟩ have hvar_bound : ∀ᶠ n : ℕ in atTop, S.empiricalVar g n omega < B := hvar.eventually (eventually_lt_nhds (by dsimp [B] linarith [le_abs_self (variance g P)])) filter_upwards [hvar_bound, eventually_ne_atTop 0] with n hnvar hn have hcheb := bootstrapMean_chebyshev g hg (S.sampleVector n omega) hn M hM have hemp : finMean (fun i ↦ (g (S.sampleVector n omega i)) ^ 2) - (finMean (fun i ↦ g (S.sampleVector n omega i))) ^ 2 = S.empiricalVar g n omega := by rw [finMean_sampleVector_real S (fun x ↦ (g x) ^ 2) n omega, finMean_sampleVector_real S g n omega] rfl calc (bootstrapResample (S.sampleVector n omega)).real {xstar | M < ‖scaledBootstrapMeanDifference g n (S.sampleVector n omega) xstar‖} ≤ S.empiricalVar g n omega / M ^ 2 := by simpa [Real.norm_eq_abs, hemp] using hcheb _ < B / M ^ 2 := by exact div_lt_div_of_pos_right hnvar (sq_pos_of_pos hM) _ < epsilon := by dsimp [M] rw [Real.sq_sqrt (by positivity : 0 ≤ B / epsilon + 1)] rw [div_lt_iff₀ (by positivity : 0 < B / epsilon + 1)] calc B < B + epsilon := lt_add_of_pos_right B hepsilon _ = epsilon * (B / epsilon + 1) := by field_simp -
bootstrapMeanVec_coordinate_chebyshevtheorem — For a measurable finite-dimensional moment function, nonempty observed data, a coordinate, and a positive threshold, that coordinate of the scaled bootstrap mean obeys the empirical-variance Chebyshev bound.hypothesesX :sharedType u_2d :ℕg :X → EuclideanSpace ℝ (Fin d)hg :n :ℕx :Fin n → Xj :Fin dhn :n ≠ 0M :ℝhM :0 < MconclusionProof (Lean source)
theorem bootstrapMeanVec_coordinate_chebyshev {d : ℕ} (g : X → EuclideanSpace ℝ (Fin d)) (hg : Measurable g) {n : ℕ} (x : Fin n → X) (j : Fin d) (hn : n ≠ 0) (M : ℝ) (hM : 0 < M) : (bootstrapResample x).real {xstar | M < |(scaledBootstrapMeanDifference g n x xstar) j|} ≤ (finMean (fun i ↦ (g (x i) j) ^ 2) - (finMean (fun i ↦ g (x i) j)) ^ 2) / M ^ 2 := by have h := bootstrapMean_chebyshev (fun z ↦ g z j) (by fun_prop) x hn M hM simpa only [scaledBootstrapMeanDifference, PiLp.smul_apply, PiLp.sub_apply, finMean_apply_real, smul_eq_mul] using h
Linearization 2 core · 0 supporting This module turns Fréchet differentiability at the population moment into the two first-order expansions needed by BootstrapAsymLinear: one under the original iid sampling law and one under the conditional Efron resampli ★ samplingLinearization_smoothFunctionOfMeans★ bootstrapLinearization_smoothFunctionOfMeans
Sampling and bootstrap linearization of smooth moment estimators
This module turns Fréchet differentiability at the population moment into the two first-order
expansions needed by BootstrapAsymLinear: one under the original iid sampling law and one under
the conditional Efron resampling law. Only differentiability at the target is used.
Sampling delta linearization. For an iid sample, a measurable vector moment with integrable squared norm, and a transform Fréchet differentiable at the population moment, the square-root-scaled estimator remainder after its influence-function sum converges to zero in probability.
Formal statement
Proof (Lean source)
Conditional bootstrap delta linearization. For an iid sample, a measurable vector moment with integrable squared norm, and a transform Fréchet differentiable at the population moment, for every positive tolerance the outer sampling probability of a conditional bootstrap linearization failure tends to zero.
Formal statement
Proof (Lean source)
Main 3 core · 2 supporting This module packages the sampling and conditional bootstrap delta expansions into the BootstrapAsymLinear interface. ★ smoothFunctionOfMeans★ percentileCI_coverage_smoothFunctionOfMeans★ ratioOfMeans
Bootstrap validity for smooth functions of sample means
This module packages the sampling and conditional bootstrap delta expansions into the
BootstrapAsymLinear interface. It supplies the user-facing percentile-interval corollary and
the ratio of two sample moments as a worked specialization.
Smooth-function-of-means constructor. For an iid sample, a measurable finite-dimensional moment function with integrable squared norm, a measurable scalar transform differentiable at the population moment, and a strictly positive influence-function second moment, the transformed sample mean is bootstrap asymptotically linear with derivative-applied centered moment as influence function.
Formal statement
Proof (Lean source)
Under the smooth-function-of-means assumptions and an interior nominal error level, the percentile bootstrap interval has asymptotic coverage one minus that level.
Formal statement
Proof (Lean source)
Ratio-of-means instance. For an iid sample, a measurable square-integrable bivariate moment, a nonzero population denominator, and a strictly positive ratio-influence second moment, the ratio of the two sample moments is bootstrap asymptotically linear with the quotient-rule influence function.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
coordinateRatio_hasFDerivAttheorem — At a bivariate population moment with nonzero denominator, the coordinate-ratio map is Fréchet differentiable.Proof (Lean source)
theorem coordinateRatio_hasFDerivAt (m : EuclideanSpace ℝ (Fin 2)) (hm : m 1 ≠ 0) : HasFDerivAt coordinateRatio (fderiv ℝ coordinateRatio m) m := by unfold coordinateRatio have hratio := hasFDerivAt_ratio hm rw [hratio.fderiv] exact hratio -
fderiv_coordinateRatio_applytheorem — At a bivariate population moment with nonzero denominator, the derivative of the coordinate ratio applied to a displacement is the usual quotient-rule expression.hypothesesm v :EuclideanSpace ℝ (Fin 2)hm :m 1 ≠ 0conclusionfderiv ℝ coordinateRatio m v = v 0 / m 1 - m 0 * v 1 / (m 1) ^ 2Proof (Lean source)
theorem fderiv_coordinateRatio_apply (m v : EuclideanSpace ℝ (Fin 2)) (hm : m 1 ≠ 0) : fderiv ℝ coordinateRatio m v = v 0 / m 1 - m 0 * v 1 / (m 1) ^ 2 := by have hratio := hasFDerivAt_ratio hm change fderiv ℝ (fun z : EuclideanSpace ℝ (Fin 2) ↦ z 0 / z 1) m v = _ rw [hratio.fderiv] simp only [ratioDeriv, sub_apply, ContinuousLinearMap.smulRight_apply, EuclideanSpace.coe_proj, smul_eq_mul] ring_nf
Measurability 1 core · 0 supporting This module supplies the joint-measurability bridge needed when a conditional bootstrap event depends on both the observed data and the resample. ★ measurable_bootstrapResample_real_of_measurableSet
Measurability of data-dependent bootstrap event probabilities
This module supplies the joint-measurability bridge needed when a conditional bootstrap event depends on both the observed data and the resample. The finite atomic representation of Efron resampling reduces the conditional probability to a finite sum of measurable indicators.
For a jointly measurable event in the data and resample, its probability under the data-dependent Efron resampling law is a measurable function of the observed data.
Formal statement
Proof (Lean source)
SmoothRemainder 1 core · 0 supporting This module isolates the deterministic analytic input to the smooth-function-of-means delta method: Fréchet differentiability makes the nonlinear remainder little-o of the displacement. ★ smoothRemainder_isLittleO
First-order remainder for smooth transforms
This module isolates the deterministic analytic input to the smooth-function-of-means delta method: Fréchet differentiability makes the nonlinear remainder little-o of the displacement.
If a scalar transform is Fréchet differentiable at a point, its nonlinear remainder after subtracting the derivative is little-o of displacement from that point.
Formal statement
Proof (Lean source)
Uniformization 1 core · 1 supporting This module isolates the measure-theoretic step that turns an almost-everywhere pointwise limit of measurable conditional-probability majorants into convergence of their outer sampling tails. ★ scaledBootstrapMeanDifferenceVec_outer_tight
Uniformizing almost-sure conditional probability bounds
This module isolates the measure-theoretic step that turns an almost-everywhere pointwise limit of measurable conditional-probability majorants into convergence of their outer sampling tails. It is the final generic bridge needed before constructing the smooth bootstrap remainder majorant.
Outer uniformization of conditional bootstrap tightness. For an iid sample and a measurable square-integrable finite-dimensional moment, given positive inner and outer tail tolerances, there is one deterministic positive radius such that the sampling probability of data sets whose conditional scaled-bootstrap-mean tail exceeds the inner tolerance is eventually below the outer tolerance.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
measureReal_gt_tendsto_zero_of_ae_tendstotheorem — If a sequence of measurable real functions converges pointwise to zero almost everywhere, then for every positive threshold the real measure of its strict upper-tail event tends to zero.hypothesesProof (Lean source)
theorem measureReal_gt_tendsto_zero_of_ae_tendsto [IsFiniteMeasure mu] {f : ℕ → Omega → ℝ} (hf : ∀ n, Measurable (f n)) (hlim : ∀ᵐ omega ∂mu, Tendsto (fun n ↦ f n omega) atTop (𝓝 0)) (epsilon : ℝ) (hepsilon : 0 < epsilon) : Tendsto (fun n ↦ mu.real {omega | epsilon < f n omega}) atTop (𝓝 0) := by have hmeasure : TendstoInMeasure mu f atTop (fun _ ↦ 0) := tendstoInMeasure_of_tendsto_ae (fun n ↦ (hf n).aestronglyMeasurable) hlim have htail : Tendsto (fun n ↦ mu.real {omega | epsilon ≤ ‖f n omega - 0‖}) atTop (𝓝 0) := (tendstoInMeasure_iff_measureReal_norm.mp hmeasure) epsilon hepsilon apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds htail · exact Eventually.of_forall fun _ ↦ measureReal_nonneg · exact Eventually.of_forall fun n ↦ measureReal_mono fun omega homega ↦ by change epsilon ≤ ‖f n omega - 0‖ simpa only [sub_zero, Real.norm_eq_abs] using homega.le.trans (le_abs_self (f n omega))
WeakLaw 2 core · 1 supporting This module proves scalar conditional bootstrap weak laws under a first moment, centered either at the data mean or at the population mean. ★ bootstrapMean_sub_dataMean_tendsto_zero_ae★ bootstrapMean_sub_populationMean_tendsto_zero_ae
Conditional bootstrap weak laws for sample means
This module proves scalar conditional bootstrap weak laws under a first moment, centered either
at the data mean or at the population mean. The finite-dimensional coordinate reduction is kept
in the downstream WeakLawVector module.
Conditional bootstrap weak law. For an iid sample and a measurable integrable real statistic, for almost every data sequence and every positive tolerance, the conditional probability that the resample mean differs from the data mean tends to zero.
Formal statement
Proof (Lean source)
For an iid sample and a measurable integrable real statistic, for almost every data sequence and every positive tolerance, the conditional probability that the bootstrap mean differs from the population mean tends to zero.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
sampleMean_integrable_tendsto_aetheorem — For an iid sample and a measurable integrable real statistic, the sample mean converges almost surely to its population mean.hypothesesOmega :sharedType u_1X :sharedType u_2S :IIDSample Omega X mu Pg :X → ℝhg :hg_int :Integrable g PProof (Lean source)
theorem sampleMean_integrable_tendsto_ae (S : IIDSample Omega X mu P) (g : X → ℝ) (hg : Measurable g) (hg_int : Integrable g P) : ∀ᵐ omega ∂mu, Tendsto (fun n ↦ S.sampleMean g n omega) atTop (𝓝 (∫ x, g x ∂P)) := by haveI : IsProbabilityMeasure mu := S.indep.isProbabilityMeasure have hg_int_sample : Integrable (fun omega ↦ g (S.Z 0 omega)) mu := by have hmap : Integrable g (mu.map (S.Z 0)) := by simpa [S.law] using hg_int exact hmap.comp_measurable (S.meas 0) have hindep : Pairwise (onFun (fun f₁ f₂ ↦ IndepFun f₁ f₂ mu) (fun i omega ↦ g (S.Z i omega))) := by have hi : iIndepFun (fun i ↦ g ∘ S.Z i) mu := S.indep.comp (fun _ ↦ g) (fun _ ↦ hg) intro i j hij exact hi.indepFun hij have hident : ∀ i, IdentDistrib (fun omega ↦ g (S.Z i omega)) (fun omega ↦ g (S.Z 0 omega)) mu mu := by intro i exact ((S.identDist i).symm.comp hg) have hslln := strong_law_ae_real (fun i omega ↦ g (S.Z i omega)) hg_int_sample hindep hident have hint : (∫ omega, g (S.Z 0 omega) ∂mu) = ∫ x, g x ∂P := by rw [← integral_map (S.meas 0).aemeasurable hg.aestronglyMeasurable, S.law] filter_upwards [hslln] with omega homega unfold IIDSample.sampleMean simpa [hint, div_eq_mul_inv, mul_comm] using homega
WeakLawVector 1 core · 1 supporting This module derives finite-dimensional norm-valued bootstrap weak laws from the scalar result, using coordinate projections and a finite union bound. ★ bootstrapMeanVec_sub_dataMean_tendsto_zero_ae
Vector conditional bootstrap weak laws
This module derives finite-dimensional norm-valued bootstrap weak laws from the scalar result, using coordinate projections and a finite union bound.
Finite-dimensional conditional bootstrap weak law. For an iid sample and a measurable integrable vector statistic, for almost every data sequence and every positive tolerance, the conditional probability that the resample vector mean differs in norm from the data vector mean tends to zero.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
bootstrapMeanVec_sub_populationMean_tendsto_zero_aetheorem — For an iid sample and a measurable integrable finite-dimensional statistic, for almost every data sequence and every positive tolerance, the conditional bootstrap vector mean converges to the population vector mean.hypothesesOmega :sharedType u_1X :sharedType u_2d :ℕS :IIDSample Omega X mu Pg :X → EuclideanSpace ℝ (Fin d)hg :hg_int :Integrable g Pconclusion∀ᵐ omega ∂mu, ∀ epsilon : ℝ, 0 < epsilon → Tendsto (fun n ↦ (bootstrapResample (S.sampleVector n omega)).real {xstar | epsilon < ‖finMean (fun i ↦ g (xstar i)) - ∫ x, g x ∂P‖}) atTop (𝓝 0)Proof (Lean source)
theorem bootstrapMeanVec_sub_populationMean_tendsto_zero_ae {d : ℕ} (S : IIDSample Omega X mu P) (g : X → EuclideanSpace ℝ (Fin d)) (hg : Measurable g) (hg_int : Integrable g P) : ∀ᵐ omega ∂mu, ∀ epsilon : ℝ, 0 < epsilon → Tendsto (fun n ↦ (bootstrapResample (S.sampleVector n omega)).real {xstar | epsilon < ‖finMean (fun i ↦ g (xstar i)) - ∫ x, g x ∂P‖}) atTop (𝓝 0) := by have hcoord : ∀ᵐ omega ∂mu, ∀ j : Fin d, ∀ epsilon : ℝ, 0 < epsilon → Tendsto (fun n ↦ (bootstrapResample (S.sampleVector n omega)).real {xstar | epsilon < |finMean (fun i ↦ g (xstar i) j) - ∫ x, g x j ∂P|}) atTop (𝓝 0) := by rw [ae_all_iff] intro j exact bootstrapMean_sub_populationMean_tendsto_zero_ae S (fun x ↦ g x j) (by fun_prop) (hg_int.eval_piLp j) filter_upwards [hcoord] with omega homega intro epsilon hepsilon by_cases hd : d = 0 · subst d have hvzero : ∀ n (xstar : Fin n → X), finMean (fun i ↦ g (xstar i)) - ∫ x, g x ∂P = 0 := fun n xstar ↦ Subsingleton.elim _ _ simp_rw [hvzero, norm_zero, not_lt_of_ge hepsilon.le] simp · let eta : ℝ := epsilon / d have heta : 0 < eta := by dsimp [eta] positivity have hsum : Tendsto (fun n ↦ ∑ j : Fin d, (bootstrapResample (S.sampleVector n omega)).real {xstar | eta < |finMean (fun i ↦ g (xstar i) j) - ∫ x, g x j ∂P|}) atTop (𝓝 0) := by simpa using tendsto_finset_sum univ (fun j hj ↦ homega j eta heta) apply squeeze_zero' · exact Eventually.of_forall fun n ↦ measureReal_nonneg · filter_upwards [eventually_ne_atTop 0] with n hn let data : Fin n → X := S.sampleVector n omega let V : (Fin n → X) → EuclideanSpace ℝ (Fin d) := fun xstar ↦ finMean (fun i ↦ g (xstar i)) - ∫ x, g x ∂P have hint : ∀ j : Fin d, (∫ x, g x ∂P) j = ∫ x, g x j ∂P := eval_integral_piLp (fun j ↦ hg_int.eval_piLp j) have hset : {xstar | epsilon < ‖V xstar‖} ⊆ ⋃ j : Fin d, {xstar | eta < |finMean (fun i ↦ g (xstar i) j) - ∫ x, g x j ∂P|} := by have hs := euclidean_norm_event_subset hd V epsilon simpa only [V, eta, finMean_apply, PiLp.sub_apply, hint] using hs let _ : IsProbabilityMeasure (bootstrapResample data) := bootstrapResample_isProbabilityMeasure data hn calc (bootstrapResample (S.sampleVector n omega)).real {xstar | epsilon < ‖finMean (fun i ↦ g (xstar i)) - ∫ x, g x ∂P‖} = (bootstrapResample data).real {xstar | epsilon < ‖V xstar‖} := rfl _ ≤ (bootstrapResample data).real (⋃ j : Fin d, {xstar | eta < |finMean (fun i ↦ g (xstar i) j) - ∫ x, g x j ∂P|}) := measureReal_mono hset (measure_ne_top _ _) _ ≤ ∑ j : Fin d, (bootstrapResample data).real {xstar | eta < |finMean (fun i ↦ g (xstar i) j) - ∫ x, g x j ∂P|} := measureReal_iUnion_fintype_le _ · exact hsum