MOSUM: Sliding Window Sum & Change Detection
- Moving Sum (MOSUM) is a sliding-window operation that computes summations over sequential data segments, fundamental in signal processing and change-point detection.
- It employs efficient recurrence relations such as the subtract-old/add-new scheme and optimized algorithms like DEW to ensure O(1) per output and minimal memory usage.
- Advanced implementations, including parallel vectorized methods using semidirect products, facilitate high-performance computations in large-scale and high-dimensional data analysis.
A moving sum (MOSUM) scheme comprises sliding-window computations where a function—typically summation or related linear operations—traverses a stream of data, yielding iterated windowed outputs. Moving sums feature extensively in natural sciences, engineering, economics, and computational practice, both as low-level primitives in time-series signal processing and as core ingredients of statistical change-detection algorithms. The computational and statistical properties of MOSUM approaches have spurred broad theoretical development, unifying perspectives across sequential and batched computation, parallel and vectorization strategies, and foundational algebraic structures.
1. Formal Definition and Classical Recurrence
Given a data stream and window size , the moving sum at position is: Initialization proceeds with: Then classical recurrence exploits
This "subtract-old/add-new" recurrence yields time per output, working memory, and is used universally for streaming windowed summation (Maslen et al., 30 Aug 2025).
2. Sequential Algorithms: Double-Ended Window (DEW) and Complexity Bounds
A new low-latency sequential scheme ("Double-Ended Window," DEW, see Ch. 2–4 of (Maslen et al., 30 Aug 2025)) achieves work for outputs, with worst-case constant latency per windowed sum. The DEW algorithm organizes two stack-like buffers for efficient online input/output synchronization; it provably minimizes auxiliary work in the strict streaming regime. The monograph demonstrates that no sequential windowed-sum approach with fixed-latency output can improve on this $3N$ additions bound without increasing memory beyond two -long buffers. Precise recurrence relations and step-by-step complexity analysis reside in subsequent chapters (not included here).
3. Parallel and Vectorized MOSUM via Semidirect Products
Part III of the monograph (Maslen et al., 30 Aug 2025) generalizes MOSUM calculation for parallel/vector contexts using semidirect product algebra. For batch-computation of windowed sums across positions, each input is encoded as
and full-window products are exponentiated using addition-chain or divide-and-conquer schedules. Algorithms such as Brauer’s or Thurber’s methods support logarithmic depth (), total work, and explicit vectorization. These constructions are correct for all associative operators, with source code and matrix formulas developed in Chapter 7–8.
4. Algebraic Foundations: Semi-Associativity, Correctness, and Domain of Validity
The monograph (Maslen et al., 30 Aug 2025) introduces semi-associativity (Ch. 6) as the algebraic backdrop enabling decomposition and reordering of windowed recurrences. For addition on (or standard data types), associativity guarantees that both streaming (sequential, recurrence-based) and batch (parallel, semidirect-product) schemes yield outputs identical to the sliding-window definition. Correctness proofs and algebraic lemmas systematize practitioner heuristics for parallelizing recurrent computations.
5. MOSUM in Statistical Change Point Detection
MOSUM statistics are central in change-point detection, modeling, and segmentation. The archetype is the difference of adjacent windowed sums: as in the PULSE criterion (Zhao et al., 2020). Statistical treatments generalize to robust/score-type variants (Kirch et al., 2022), regression parameters (Kirch et al., 2022), or covariance-matrix estimators for high-dimensional time series under factor models (Barigozzi et al., 2024).
Algorithmic variants:
- Double averaging of consecutive MOSUMs yields trapezoidal signal shapes underlying ridge-ratio change detection (Zhao et al., 2020).
- -aggregation across multiple series or spatial clusters enhances power for dense/high-dimensional changes; Two-Way MOSUM generalizes spatial scanning (Li et al., 2022).
- Multiscale MOSUM algorithms traverse (position, bandwidth)-triangles, systematically extracting change-points, circumventing arbitrary bandwidth choice (Levajkovic et al., 2021).
Consistency, minimax localization, and thresholding principles follow from limit theory (extreme-value laws, invariance principles) across mean, regression, and covariance-change scenarios.
6. Computational Performance, Implementations, and Benchmarks
Empirical studies in (Maslen et al., 30 Aug 2025) and related work confirm the efficiency of sequential and parallel MOSUM:
- The DEW algorithm beats classical two-stack and DABA schemes in end-to-end latency on streaming hardware for moderate window sizes.
- Vectorized semidirect-product implementations achieve 80–90% of peak memory bandwidth on modern CPUs/GPUs, with scalability up to thousands of inputs per window.
- Hybrid strategies (DEW for small , vector/parallel for large ) optimize throughput.
Tables of performance metrics and practical timings are documented in the respective chapters and benchmark galleries, with implementations available in packages such as mosum and mscp.
| Algorithm | Work (Additions) | Latency per Output | Memory Usage |
|---|---|---|---|
| Classical Recurrence | |||
| Double-Ended Window | constant | (2 buffers) | |
| Parallel/Vectorized | (depth) | typically |
Efficiency claims and optimality proofs are derived under associativity and strict streaming constraints.
7. Application Domains, Limitations, and Extensions
Moving sums are foundational in real-time signal processing, financial analytics, genomics (read-depth windows), change-point analysis, and high-throughput data segmentation. Extensions span:
- Statistical formulations—robust M-estimation, regression, Poisson/INARCH modeling.
- Bandwidth selection, window-size adaptation, and multiscale schemes (Levajkovic et al., 2021).
- High-dimensional and spatially adaptive procedures (Li et al., 2022), covariance-break detection in large factor models (Barigozzi et al., 2024). Limitations of MOSUM approaches center on narrow-signal detection (changes closer than window size) and heavy-noise scenarios. Innovations in iterative, multi-scale, and spatially adaptive schemes address these to varying degrees. All core algorithmic and theoretical properties depend on associative operators and the isolation of change events within windowed neighborhoods.
MOSUM remains both a computational primitive and a unifying principle for efficient, theoretically grounded sliding-window calculations and change-point estimation in contemporary data analysis.