Welford’s Online Method for Numerically Stable Variance
Summary
The document explains why computing variance from sums of squares can be numerically unstable, particularly with large values, and describes Welford’s method as a single-pass alternative. The method updates a running mean and an accumulated squared-deviation quantity as each observation arrives, then divides by the sample count minus one to obtain sample variance. This makes it useful when observations arrive incrementally or retaining the full dataset is inconvenient.
An example applies the recurrence to a rolling period of closing prices in an indicator. The author asserts that the method appears less noisy and more stable than a standard formula, but supplies no measured comparison, dataset, or validation. The example is a variance calculation, not a complete volatility-based trading strategy, and its period and input would need to be adapted to the intended use.
Key ideas
- Welford’s method calculates variance in one pass by updating a running mean and squared-deviation total.
- The recurrence avoids relying directly on sums of squares, which can cause numerical instability or overflow.
- Sample variance is obtained by dividing the accumulated squared deviations by the sample count minus one.
- The example computes variance from rolling closing-price observations.
- The claimed stability advantage is not supported by a quantitative comparison in the document.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.