Featured image for the Weighted Moving Average blog with a candlestick chart and mean lines.

Weighted Moving Average (WMA) – Smoothing

A moving average is commonly used with time-series data to smooth out short-term fluctuations and highlight longer-term trends or cycles. A weighted moving average has multiplying factors to give different weights to data at different positions in the sample window.

$$Y_t=\frac{\sum_{i=1}^N{W_i X_{t-i}}}{\sum_{i=1}^N W_i}$$

Where :
  • $W_i$ is the i-th position weight-factor
  • $\{X_t\}$ is the original time series
  • $\{Y_t\}$ is the smoothed time series
  • $Y_t$ uses the prior N-values of $X_t$ observations (i.e. $\{X_{t-1},X_{t-2},\cdots ,X_{t-N}\}$)

The weighted moving average has a fixed window (i.e., N), and the factors are typically chosen to give more weight to recent observations.

The window size (N) determines the number of points averaged at each time, so a larger windows size is less responsive to new changes in the original time series, and a small window size can cause the smoothed output to be noisy.

For out of sample forecasting purposes:

$$Y_{T+1}=\sum_{i=1}^N \left ( {w_i X_{T+1-i}}\right )$$ $$Y_{T+2}= w_1 Y_{T+1}+\sum_{i=2}^N \left ( {w_i X_{T+2-i}}\right ) = w_1 \sum_{i=1}^N \left ( {w_i X_{T+1-i}}\right ) + \sum_{i=2}^N \left ( {w_i X_{T+2-i}}\right )$$ $$Y_{T+3}= (w_1^2 +w_2)\sum_{i=1}^N \left ( {w_i X_{T+1-i}}\right ) + w_1 \sum_{i=2}^N \left ( {w_i X_{T+2-i}}\right ) + \sum_{i=3}^N \left ( {w_i X_{T+3-i}}\right )$$ $$Y_{T+4}=(w_1^3+2w_2w_1+w_3)\sum_{i=1}^N \left ( {w_i X_{T+1-i}}\right )+ (w_1^2+w_2)\sum_{i=2}^N \left ( {w_i X_{T+2-i}}\right )+w_1\sum_{i=3}^N \left ( {w_i X_{T+3-i}}\right )+ \sum_{i=4}^N \left ( {w_i X_{T+4-i}}\right )$$
Where :
  • $\{w_i\}$ is the normalized weight-factors

Example 1 :

Let’s consider monthly sales for Company X, using a 4-month (equal-weighted) moving average.

Note that the moving average always lags behind the data, and the out-of-sample forecast converges to a constant value.

Let’s try to use a weighting scheme (see below) that emphasizes the latest observation.

We plotted the equal-weighted moving average and WMA on the same graph. The WMA seems more responsive to recent changes, and the out-of-sample forecast converges to the same value as the moving average.

Example 2:

Let’s examine the WMA in the presence of trend and seasonality. For this example, we’ll use the international passenger airline data. The moving average window is 12 months.

The MA and the WMA keep pace with the trend, but the out-of-sample forecast flattens. Furthermore, although the WMA exhibits some seasonality, it is always lagging behind the original data.

Tutorial Video

Files Examples

Please click the button below to download Weighted Moving Average example.


Weighted Moving Average (WMA) 0.00 KB

Demonstrates the steps for calculating the Weighted Moving Average Smoothing method. ...

Leave a Reply

Your email address will not be published. Required fields are marked *

We are glad you have chosen to leave a comment. Please keep in mind that comments are moderated according to our comment policy.