'Incremental rolling variance with no memory
How can I compute a rolling variance WITHOUT keeping a buffer of input or other values?
In this old article:
https://www.dsprelated.com/showthread/comp.dsp/97276-1.php
I see that the mean required can be approximated with a exponential moving average, but I don't understand how I can then use that for calculating a variance?
In the article "John E. Hadstate" states:
A simpler way is to do this....
s(k+1)=beta*s(k)+(1-beta)*u^2(k)
where beta is a forgetting factor less than unity.
u is the input and s is the variance.
The correct equation for recursive variance can be found by addoing an extra sample to batch variance
s(k+1)=s(k)+(1/(k+1)[s(k)-u^2(k)]
But I don't understand that last line.
Does any one have a python version of this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
