EconBase
← All papers

$2B$ or Not $2B$: A Tale of Three Algorithms for Streaming: Covariance Estimation after Welford and Chan-Golub-LeVeque

Felix Reichel

arXiv 30 Apr 2026 · Statistics — Computation

arXiv:2605.00247 · PDF · DOI · OpenAlex · Extracted main text

Abstract

We place three algorithms for computing the unbiased sample covariance matrix in streaming and distributed settings on a common algebraic, numerical, and statistical foundation. The Gram algorithm, derived from the variance reformulation, maintains the running cross-product matrix $G_t = \sum_{i=1}^t x_i x_i^\top$ and the column-sum vector $s_t = \sum_{i=1}^t x_i$, yielding the unbiased covariance estimator $S_t = (t-1)^{-1}(G_t - t^{-1}s_t s_t^\top)$ in $O(p^2)$ time per update. The Welford algorithm propagates a running mean $m_t$ and outer-product corrections $M_t$, with updates $m_t = m_{t-1} + (x_t - m_{t-1})/t$ and $M_t = M_{t-1} + (x_t - m_{t-1})(x_t - m_t)^\top$, achieving the same asymptotic cost with improved numerical stability under large data shifts. The Chan-Golub-LeVeque algorithm supports block-parallel merging through the exact identity $M = M_A + M_B + \frac{n_A n_B}{n_A+n_B}(m_B - m_A)(m_B - m_A)^\top$, making it the natural choice for distributed and map-reduce architectures. All three algorithms produce the same estimator $S_t = M_t/(t-1)$ in exact arithmetic, although their finite-precision behavior differs markedly. Beyond runtime and numerical comparisons, we introduce a conformal prediction framework for streaming covariance estimation that yields finite-sample, distribution-free confidence sets $C_{t,jk}$ for each entry $S_{t,jk}$ of the covariance matrix at any step $t$ of the data stream. Experiments confirm that the Gram algorithm is fastest for batch computation, Welford is uniquely robust to catastrophic cancellation under large mean shifts, CGL is optimal for distributed settings, and conformal intervals achieve the nominal coverage level across all three algorithms.

Citation extraction

11
references
23
in-text mentions
9
distinct cited
1
self-citations
7,692
main-text words

appendix boundary found by none_found · 100% of the source is main text. Read the extracted text to check this.

Most heavily cited references

The works this paper leans on most, across its whole bibliography — not restricted to papers in our corpus. Ranked by composite intensity, which combines how often a work is mentioned, how many sections mention it, and how much of that falls in the main text rather than the appendix.

ReferenceIntensityMentionsSectionsMain text
1Chan, T. F., Golub, G. H., and LeVeque, R. J (1979) Updating formulae and a pairwise algorithm for computing sample variances1.00054100%
2Reichel, F (2025) High-Performance Variance-–Covariance Matrix Construction Using an Uncentered Gram Formulation, Forthcoming in self0.92844100%
3Vovk, V., Gammerman, A., and Shafer, G (2005) Algorithmic Learning in a Random World0.92843100%
4Higham, N. J (2002) Accuracy and Stability of Numerical Algorithms0.73732100%
5Angelopoulos, A. N. and Bates, S (2023) Conformal prediction: A gentle introduction0.64422100%
6Welford, B. P (1962) Note on a method for calculating corrected sums of squares and products0.64422100%
7Newey, W. K. and West, K. D (1987) A simple, positive semi-definite, heteroskedasticity and autocorrelation consistent covariance matrix0.40511100%
8Papadopoulos, H., Proedrou, K., Vovk, V., and Gammerman, A (2002) Inductive confidence machines for regression0.40511100%
9White, H (1980) A heteroskedasticity-consistent covariance matrix estimator and a direct test for heteroskedasticity0.40511100%

Showing the top 9 of 9 scored citations.