TOPICS
Search

Moving Average


MovingAverage

Given a sequence {a_i}_(i=1)^N, an n-moving average is a new sequence {s_i}_(i=1)^(N-n+1) defined from the a_i by taking the arithmetic mean of subsequences of n terms,

 s_i=1/nsum_(j=i)^(i+n-1)a_j.
(1)

So the sequences S_n giving n-moving averages are

S_2=1/2(a_1+a_2,a_2+a_3,...,a_(n-1)+a_n)
(2)
S_3=1/3(a_1+a_2+a_3,a_2+a_3+a_4,...,a_(n-2)+a_(n-1)+a_n).
(3)

and so on. The plot above shows the 2- (red), 4- (yellow), 6- (green), and 8- (blue) moving averages for a set of 100 data points.

Moving averages are implemented in the Wolfram Language as MovingAverage[data, n].


See also

Cumulative Sum, Exponential Moving Average, Mean, Moving Median, Spencer's 15-Point Moving Average, Spencer's Formula

Explore with Wolfram|Alpha

References

Kenney, J. F. and Keeping, E. S. "Moving Averages." §14.2 in Mathematics of Statistics, Pt. 1, 3rd ed. Princeton, NJ: Van Nostrand, pp. 221-223, 1962.Whittaker, E. T. and Robinson, G. "Graduation, or the Smoothing of Data." Ch. 11 in The Calculus of Observations: A Treatise on Numerical Mathematics, 4th ed. New York: Dover, pp. 285-316, 1967.

Referenced on Wolfram|Alpha

Moving Average

Cite this as:

Weisstein, Eric W. "Moving Average." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/MovingAverage.html

Subject classifications