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

Examples

open allclose all

Basic Examples  (2)

Compute a pairwise simple moving average:

Compute weighted moving averages:

Scope  (5)

Lists of integers yield rational numbers:

Lists of approximate numbers yield approximate numbers:

Moving averages of matrices are matrices:

Obtain results for lists of any precision:

Obtain results for weights of any precision:

Filter large datasets:

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:

Applications  (2)

Smooth noisy data:

Compute the 100-day moving average of a financial time series:

Properties & Relations  (7)

A moving average is a sequence of means:

A twoterm MovingAverage is equivalent to a twoterm MovingMedian:

MovingAverage is equivalent to MovingMap of Mean:

An nterm moving average is equivalent to a moving average with n equal weights:

An nterm moving average is equivalent to a ListCorrelate:

An nterm weighted moving average is equivalent to a ListCorrelate:

Multiplying weights by a constant gives the same moving average:

Wolfram Research (2007), MovingAverage, Wolfram Language function, https://reference.wolfram.com/language/ref/MovingAverage.html.

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

BibTeX

@misc{reference.wolfram_2024_movingaverage, author="Wolfram Research", title="{MovingAverage}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/MovingAverage.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_movingaverage, organization={Wolfram Research}, title={MovingAverage}, year={2007}, url={https://reference.wolfram.com/language/ref/MovingAverage.html}, note=[Accessed: 22-December-2024 ]}