I've tried some recursive moving average formulae (to reuse a previous output instead of summing the whole n-long set for every i) I've managed to find but none of them produces the same results as a bare moving mean does. Is there a reliable recursive formula which would produce exactly (or almost exactly) the same output as a bare moving mean?
Tell me more
×
Cross Validated is a question and answer site for
statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.
|
|
|||||
|
|
Just try to remove the last value of the window and add the new one. If $$MA(t)=\frac{1}{w}\sum\limits_{i=t-w+1}^t{y_i}$$ then $$MA(t+1)=MA(t)+\frac{y(t+1)-y(t-w+1)}{w}.$$ |
|||||||||||||||
|
|
||||
|