@movavc |

Centered moving averages (propagate NAs).

n-period centered moving averages, propagating NAs.

Syntax: @movavc(x, n)

x: series

n integer, series

Return: series

For each observation and integer ,

• If is odd, compute the average of the current, and previous and subsequent observations of a series, propagating missing values (NAs)

where .

• If is even, compute the period centered moving sum, weighting the endpoints by 1/2 and propagating missing values (NAs), then divide by :

where and .

If n is not an integer, the integer floor will be used.

Examples

show @movavc(x, 12)

produces a linked series of the centered moving average of the series x where NAs are propagated.

Cross-references

See also
@movav for trailing moving averages.

For the NA-excluding variant of this function, see
@mavc.