Within-group cross-scatter
DefinitionSampleRemoval_Supplement_withinCrossleast-squaresoptimizationp2o-gran-per-chapterp2o-plan-paperp2o-v1robustness-auditsample-removal
For retained observations in group , the within-group cross-scatter is
It is defined to be zero when . The sum of these terms is the numerator of the re-estimated one-way fixed-effects slope.
Formalization Note Lean uses the algebraically equivalent formula ; at the empty set all sums vanish, so total real division by zero yields the required value zero.
Definition code
import Mathlib
import Definitions.Def_SampleRemoval_Supplement_FixedEffectsModel
set_option autoImplicit false
namespace SampleRemoval.Supplement
/-- The within-group cross-scatter `C_g(A)` of a retained subset (Xu, Gao, Hu, STOC 2027
submission, §4, eq. (2), p.7 (PDF p.9)). The algebraically equivalent centered-sum formula
is used. At `A = ∅` all sums vanish and real division by zero returns zero; at a singleton the
two terms cancel, so this agrees with the paper's explicit convention `C_g(A)=0` for `|A|≤1`. -/
noncomputable def withinCross {Γ : ℕ} (M : FixedEffectsModel Γ) (g : Fin Γ)
(A : Finset (Fin (M.nobs g))) : ℝ :=
∑ i ∈ A, M.x g i * M.y g i -
((∑ i ∈ A, M.x g i) * (∑ i ∈ A, M.y g i)) / (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)