Exponential Weighting

Overview

The exponential weighting is a method of smoothing a time series of values. It uses all the data points prior to the current time to compute the smoothed value of the time series at the current time. This means that it will not suffer from the issues that standard moving averages have when large data points drop out of the calculation window.

Calculation

The exponentially weighted forecast is defined by a simple recursive equation. The current periods forecast is equal to alpha times last periods value + 1 minus alpha times last periods forecast. Here, alpha is a tuning parameter that allows us to fine tune the forecast.

{% forecast_t = \alpha \times p_{t-1} + (1-\alpha) forecast_{t-1} %}
api

Of course, this equation needs an initial forecast to start it off. The traditional first period forecast is equal to the first period value

{% forecast_0 = p_{0} %}

Comparison to Moving Average

The standard moving average has a period size attached to it, that is, you could calculate a 20 day moving average, or a 50 day moving average. The exponentially weighted moving average has this obscure parameter lambda, which specifies a period of sorts. It indicates how much weight to give to recent observations over past observations.

There is no direct comparison between the two, however, the following is a heuristic for comparing the two:
{% \lambda = 2/(Number \; of \; Periods) %}
In this way, a lambda of 0.1 is roughly equivalent to a 20 period moving average.

Exponentially Weighted Moving Average API

The exponentially weighted moving average is implemented in the EWMA Library