Within-group regressor scatter
DefinitionSampleRemoval_Supplement_withinXScatterleast-squaresoptimizationp2o-gran-per-chapterp2o-plan-paperp2o-v1robustness-auditsample-removal
For retained observations in group , the within-group regressor scatter is
It is zero when . The re-estimated fixed-effects slope is defined precisely when .
Formalization Note Lean uses ; its empty-set value is zero.
Definition code
import Mathlib
import Definitions.Def_SampleRemoval_Supplement_FixedEffectsModel
set_option autoImplicit false
namespace SampleRemoval.Supplement
/-- The within-group regressor scatter `V_g(A)` of a retained subset (Xu, Gao, Hu, STOC 2027
submission, §4, eq. (2), p.7 (PDF p.9)). At the empty set the sums vanish and division by zero
returns zero; at a singleton the terms cancel, agreeing with `V_g(A)=0` for `|A|≤1`. -/
noncomputable def withinXScatter {Γ : ℕ} (M : FixedEffectsModel Γ) (g : Fin Γ)
(A : Finset (Fin (M.nobs g))) : ℝ :=
∑ i ∈ A, (M.x g i) ^ 2 - ((∑ i ∈ A, M.x g i) ^ 2) / (A.card : ℝ)
end SampleRemoval.Supplement
Source
Xu, Gao, Hu, Rounding, Ranges, and Exact Sample-Removal Audits for Least Squares, STOC 2027 submission (manuscript sha256 dcd33acebc1ccdc626c7ee41bfabc29795abe2e1cd9267d8cbd66d98f81c4b26), Section 4, p.7 (PDF p.9)