Centered Moving Average

This online calculator calculates centered moving average, which is used instead of moving average then number of periods is even

This page exists due to the efforts of the following people:

Timur

Timur

Created: 2018-09-08 13:00:56, Last updated: 2021-02-18 12:22:17

Let's start with a bit of theory.

In statistics, a moving average (rolling average or running average) is a calculation to analyze data points by creating series of averages of different subsets of the full data set. It is also called a moving mean (MM) or rolling mean and is a finite impulse response filter... Given a series of numbers and a fixed subset size, the moving average's first element is obtained by taking the average of the initial fixed subset of the number series. The subset is then modified by "shifting forward"; that is, excluding the first number of the series and including the next value in the subset. A moving average is commonly used with time-series data to smooth out short-term fluctuations and highlight longer-term trends or cycles.1

Moving average described above is also called one-sided moving average, and can be expressed using the following formula:
MA_t=\frac{1}{k+1}\sum^{k}_{j=0}x_{t-j}, where t changes from k+1 to n.

There is also two-sided moving average, which can be expressed as:
MA_t=\frac{1}{2k+1}\sum^{k}_{j=-k}x_{t+j}, where t changes from k+1 to n-k.

The difference is the placement of the moving average. For a one-sided moving average, the moving average is placed at the end of values being averaged. For a two-sided moving average, the moving average is centered at the middle of the values being averaged. Here is a little example for 3 periods moving average

Values One-sided 3MA Two-sided 3MA
4 N/A N/A
5 N/A 4
3 4 4
4 4 4
5 4 N/A

Two-sided moving averages are used to smooth a time series and estimate or see the trend; one-sided moving averages can be used as a simple forecasting method.

As you can see, both types of moving averages use an odd number of periods. However, when working with time series, you often smooth to remove seasonality effects, which requires a period to be equal to the seasonal length, often an even number, such as 12 months or 4 quarters. Where to place the two-sided moving average value in case of an even smoothing period?

The solution is centered moving average. Idea is simple. Let's consider 4-period MA. At given time t we can calculate either \frac{x_{t-2}+x_{t-1}+x_t+x_{t+1}}{4} or \frac{x_{t-1}+x_{t}+x_{t+1}+x_{t+2}}{4}. In the first case, we can say that we have MA_{t-0.5} and in the second case - MA_{t+0.5}. Now we can smooth the smoothed values again, and get MA_t=\frac{MA_{t-0.5}+MA_{t+0.5}}{2}.

This is our centered moving average (CMA) aka 2*4 MA. Note that smoothing moving averages by another moving average, in general, is known as double moving average and CMA is the example of it (2*n MA).

The calculator below plots CMA for given time series and period (even value). If you want to smooth the edges, it simply adds first and last values to the calculation, as needed.

PLANETCALC, Centered Moving Average

Centered Moving Average

Time Series

TimeValue
Items per page:

Digits after the decimal point: 2
Centered Moving Average
The file is very large. Browser slowdown may occur during loading and creation.

URL copied to clipboard
PLANETCALC, Centered Moving Average

Comments