English

On Sketching Trimmed Statistics

Data Structures and Algorithms 2025-06-10 v1

Abstract

We present space-efficient linear sketches for estimating trimmed statistics of an nn-dimensional frequency vector xx, e.g., the sum of pp-th powers of the largest kk frequencies (i.e., entries) in absolute value, or the kk-trimmed vector, which excludes the top and bottom kk frequencies. This is called the FpF_p moment of the trimmed vector. Trimmed measures are used in robust estimation, as seen in the R programming language's `trim.var' function and the `trim' parameter in the mean function. Linear sketches improve time and memory efficiency and are applicable to streaming and distributed settings. We initiate the study of sketching these statistics and give a new condition for capturing their space complexity. When kn/polylognk \ge n/poly\log n, we give a linear sketch using poly(1/ε,logn)poly(1/\varepsilon, \log n) space which provides a (1±ε)(1 \pm \varepsilon) approximation to the top-kk FpF_p moment for p[0,2]p \in [0,2]. For general kk, we give a sketch with the same guarantees under a condition relating the kk-th largest frequency to the tail mass, and show this condition is necessary. For the kk-trimmed version, our sketch achieves optimal error guarantees under the same condition. We extend our methods to p>2p > 2 and also address related problems such as computing the FpF_p moment of frequencies above a threshold, finding the largest kk such that the FpF_p moment of the top kk exceeds kp+1k^{p+1}, and the FpF_p moment of the top kk frequencies such that each entry is at least kk. Notably, our algorithm for this third application improves upon the space bounds of the algorithm of Govindan, Monemizadeh, and Muthukrishnan (PODS '17) for computing the hh-index. We show empirically that our top kk algorithm uses much less space compared to Count-Sketch while achieving the same error.

Keywords

Cite

@article{arxiv.2506.07342,
  title  = {On Sketching Trimmed Statistics},
  author = {Honghao Lin and Hoai-An Nguyen and David P. Woodruff},
  journal= {arXiv preprint arXiv:2506.07342},
  year   = {2025}
}
R2 v1 2026-07-01T03:06:11.332Z