MovingAverage
MovingAverage[list,r]
gives the moving average of list, computed by averaging runs of r elements.
MovingAverage[list,{w1,w2,…,wr}]
gives the moving average of list, computed with weights wi.
Details
- MovingAverage[list,r] gives a list of the means of elements in list taken in blocks of length r. »
- MovingAverage[list,wts] is equivalent to ListCorrelate[wts/Total[wts],list]. »
- MovingAverage handles both numerical and symbolic data.
- MovingAverage gives a list of length Length[list]-r+1.
- MovingAverage works with SparseArray and TemporalData objects. »
Examples
open allclose allScope (5)
Generalizations & Extensions (4)
Compute results for a SparseArray:
A moving average of TemporalData places the result on the right end of the moving windows:
Incomplete windows are dropped:
The values of a moving average of TemporalData are equivalent to the moving average of its values:
The results of a moving average of TemporalData are placed on the right end of the window, and the windows with the smaller number of observations then requested are dropped:
The moving average of a numeric TimeSeries for various window lengths:
Incomplete windows are dropped, and the result is placed on the right end of each window:
Properties & Relations (7)
A moving average is a sequence of means:
A two‐term MovingAverage is equivalent to a two‐term MovingMedian:
MovingAverage is equivalent to MovingMap of Mean:
An n‐term moving average is equivalent to a moving average with n equal weights:
An n‐term moving average is equivalent to a ListCorrelate:
An n‐term weighted moving average is equivalent to a ListCorrelate:
Multiplying weights by a constant gives the same moving average:
Text
Wolfram Research (2007), MovingAverage, Wolfram Language function, https://reference.wolfram.com/language/ref/MovingAverage.html.
CMS
Wolfram Language. 2007. "MovingAverage." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MovingAverage.html.
APA
Wolfram Language. (2007). MovingAverage. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MovingAverage.html