MovingAverage - Maple Help

Statistics

 MovingAverage
 compute moving averages for a data set

 Calling Sequence MovingAverage(X, m, options)

Parameters

 X - m - posint; moving window size options - (optional) equation(s) of the form ignore=value; specify options for the MovingAverage function

Description

 • The MovingAverage function computes moving averages for a set of observations. To compute weighted moving averages see Statistics[WeightedMovingAverage] or Statistics[LinearFilter].
 • The first parameter X is a single data sample - given as e.g. a Vector. Each value represents an individual observation.
 • The second parameter m is the size of the moving window. The size of the moving window cannot exceed the number of elements in X (or the number of non-missing elements if ignore is set to true). The number of items in the answer is less than the number of items in data. Only complete neighborhoods are included, so the number of items is reduced by m-$1$.

Options

 The options argument can contain one or more of the options shown below. These options are described in more detail in the Statistics[Mean] help page.
 • ignore=truefalse -- This option is used to specify how to handle non-numeric data. If ignore is set to true all non-numeric items in X will be ignored.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $A≔⟨\mathrm{seq}\left(\mathrm{sin}\left(i\right),i=1..100\right)⟩:$
 > $B≔\mathrm{MovingAverage}\left(A,5\right)$
 ${B}{≔}\begin{array}{c}\left[\begin{array}{c}{0.0352323299444757}\\ {-0.188944966656889}\\ {-0.239407132278267}\\ {-0.0697594845655643}\\ {0.164024711544373}\\ {0.247005344299126}\\ {0.102890402628771}\\ {-0.135821500715074}\\ {-0.249659742674422}\\ {-0.133961968583799}\\ {⋮}\end{array}\right]\\ \hfill {\text{96 element Vector[column]}}\end{array}$ (1)
 > $C≔\mathrm{MovingAverage}\left(A,10\right)$
 ${C}{≔}\begin{array}{c}\left[\begin{array}{c}{0.141118837121801}\\ {-0.0430272820140590}\\ {-0.187614316496671}\\ {-0.159709613619993}\\ {0.0150313714802866}\\ {0.175952582962312}\\ {0.175103801115698}\\ {0.0132653920558636}\\ {-0.160769157283642}\\ {-0.186993284841523}\\ {⋮}\end{array}\right]\\ \hfill {\text{91 element Vector[column]}}\end{array}$ (2)
 > $\mathrm{LineChart}\left(\left[A,B,C\right]\right)$