homechevron_rightProfessionalchevron_rightStatistics

# 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:

 TimurArticle : Centered Moving Average - AuthorCalculator : Centered Moving Average - Author

Let's start from 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 type of finite impulse response filter... Given a series of numbers and a fixed subset size, the first element of the moving average is obtained by taking the average of the initial fixed subset of the number series. Then the subset is 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 one-sided moving average the moving average is placed at the end of values being averaged. For 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 be able to estimate or see the trend, one-sided moving averages can be used as simple forecasting method.

As you can see, both types of moving averages use odd number of periods. However, when working with time series you often smooth to remove seasonality effects, which requires period to be equal to seasonal length, which is often an even number, for example, 12 months or 4 quarters. Where to place two-sided moving average value is case of 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}$.

It 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 calculation, as needed.

### Centered Moving Average

#### Time Series

TimeValue
Items per page:

Digits after the decimal point: 2
Centered Moving Average