Exponential smoothing

From HandWiki
Short description: Generates a forecast of future values of a time series

Exponential smoothing or exponential moving average (EMA) is a rule of thumb technique for smoothing time series data using the exponential window function. Whereas in the simple moving average the past observations are weighted equally, exponential functions are used to assign exponentially decreasing weights over time. It is an easily learned and easily applied procedure for making some determination based on prior assumptions by the user, such as seasonality. Exponential smoothing is often used for analysis of time-series data.

Exponential smoothing is one of many window functions commonly applied to smooth data in signal processing, acting as low-pass filters to remove high-frequency noise. This method is preceded by Poisson's use of recursive exponential window functions in convolutions from the 19th century, as well as Kolmogorov and Zurbenko's use of recursive moving averages from their studies of turbulence in the 1940s.

The raw data sequence is often represented by [math]\displaystyle{ \{x_t\} }[/math] beginning at time [math]\displaystyle{ t = 0 }[/math], and the output of the exponential smoothing algorithm is commonly written as [math]\displaystyle{ \{s_t\} }[/math], which may be regarded as a best estimate of what the next value of [math]\displaystyle{ x }[/math] will be. When the sequence of observations begins at time [math]\displaystyle{ t = 0 }[/math], the simplest form of exponential smoothing is given by the formulas:[1]

[math]\displaystyle{ \begin{align} s_0& = x_0\\ s_t & = \alpha x_{t} + (1-\alpha)s_{t-1},\quad t\gt 0 \end{align} }[/math]

where [math]\displaystyle{ \alpha }[/math] is the smoothing factor, and [math]\displaystyle{ 0 \lt \alpha \lt 1 }[/math].

Basic (simple) exponential smoothing

The use of the exponential window function is first attributed to Poisson[2] as an extension of a numerical analysis technique from the 17th century, and later adopted by the signal processing community in the 1940s. Here, exponential smoothing is the application of the exponential, or Poisson, window function. Exponential smoothing was first suggested in the statistical literature without citation to previous work by Robert Goodell Brown in 1956,[3] and then expanded by Charles C. Holt in 1957.[4] The formulation below, which is the one commonly used, is attributed to Brown and is known as "Brown’s simple exponential smoothing".[5] All the methods of Holt, Winters and Brown may be seen as a simple application of recursive filtering, first found in the 1940s[2] to convert finite impulse response (FIR) filters to infinite impulse response filters.

The simplest form of exponential smoothing is given by the formula:

[math]\displaystyle{ s_t = \alpha x_t + (1-\alpha) s_{t-1} = s_{t-1} + \alpha (x_t - s_{t-1}). }[/math]

where [math]\displaystyle{ \alpha }[/math] is the smoothing factor, and [math]\displaystyle{ 0 \le \alpha \le 1 }[/math]. In other words, the smoothed statistic [math]\displaystyle{ s_t }[/math] is a simple weighted average of the current observation [math]\displaystyle{ x_t }[/math] and the previous smoothed statistic [math]\displaystyle{ s_{t-1} }[/math]. Simple exponential smoothing is easily applied, and it produces a smoothed statistic as soon as two observations are available. The term smoothing factor applied to [math]\displaystyle{ \alpha }[/math] here is something of a misnomer, as larger values of [math]\displaystyle{ \alpha }[/math] actually reduce the level of smoothing, and in the limiting case with [math]\displaystyle{ \alpha }[/math] = 1 the output series is just the current observation. Values of [math]\displaystyle{ \alpha }[/math] close to one have less of a smoothing effect and give greater weight to recent changes in the data, while values of [math]\displaystyle{ \alpha }[/math] closer to zero have a greater smoothing effect and are less responsive to recent changes.

There is no formally correct procedure for choosing [math]\displaystyle{ \alpha }[/math]. Sometimes the statistician's judgment is used to choose an appropriate factor. Alternatively, a statistical technique may be used to optimize the value of [math]\displaystyle{ \alpha }[/math]. For example, the method of least squares might be used to determine the value of [math]\displaystyle{ \alpha }[/math] for which the sum of the quantities [math]\displaystyle{ (s_t - x_{t+1})^2 }[/math] is minimized.[6]

Unlike some other smoothing methods, such as the simple moving average, this technique does not require any minimum number of observations to be made before it begins to produce results. In practice, however, a "good average" will not be achieved until several samples have been averaged together; for example, a constant signal will take approximately [math]\displaystyle{ 3 / \alpha }[/math] stages to reach 95% of the actual value. To accurately reconstruct the original signal without information loss, all stages of the exponential moving average must also be available, because older samples decay in weight exponentially. This is in contrast to a simple moving average, in which some samples can be skipped without as much loss of information due to the constant weighting of samples within the average. If a known number of samples will be missed, one can adjust a weighted average for this as well, by giving equal weight to the new sample and all those to be skipped.

This simple form of exponential smoothing is also known as an exponentially weighted moving average (EWMA). Technically it can also be classified as an autoregressive integrated moving average (ARIMA) (0,1,1) model with no constant term.[7]

Time constant

The time constant of an exponential moving average is the amount of time for the smoothed response of a unit step function to reach [math]\displaystyle{ 1-1/e \approx 63.2\,\% }[/math] of the original signal. The relationship between this time constant, [math]\displaystyle{ \tau }[/math], and the smoothing factor, [math]\displaystyle{ \alpha }[/math], is given by the formula:

[math]\displaystyle{ \alpha = 1 - e^{-\Delta T/\tau} }[/math], thus [math]\displaystyle{ \tau = - \frac{\Delta T}{\ln(1 - \alpha)} }[/math]

where [math]\displaystyle{ \Delta T }[/math] is the sampling time interval of the discrete time implementation. If the sampling time is fast compared to the time constant ([math]\displaystyle{ \Delta T \ll \tau }[/math]) then

[math]\displaystyle{ \alpha \approx \frac{\Delta T} \tau }[/math]

Choosing the initial smoothed value

Note that in the definition above, [math]\displaystyle{ s_0 }[/math] is being initialized to [math]\displaystyle{ x_0 }[/math]. Because exponential smoothing requires that at each stage we have the previous forecast, it is not obvious how to get the method started. We could assume that the initial forecast is equal to the initial value of demand; however, this approach has a serious drawback. Exponential smoothing puts substantial weight on past observations, so the initial value of demand will have an unreasonably large effect on early forecasts. This problem can be overcome by allowing the process to evolve for a reasonable number of periods (10 or more) and using the average of the demand during those periods as the initial forecast. There are many other ways of setting this initial value, but it is important to note that the smaller the value of [math]\displaystyle{ \alpha }[/math], the more sensitive your forecast will be on the selection of this initial smoother value [math]\displaystyle{ s_0 }[/math].[8][9]


For every exponential smoothing method we also need to choose the value for the smoothing parameters. For simple exponential smoothing, there is only one smoothing parameter (α), but for the methods that follow there is usually more than one smoothing parameter.

There are cases where the smoothing parameters may be chosen in a subjective manner – the forecaster specifies the value of the smoothing parameters based on previous experience. However, a more robust and objective way to obtain values for the unknown parameters included in any exponential smoothing method is to estimate them from the observed data.

The unknown parameters and the initial values for any exponential smoothing method can be estimated by minimizing the sum of squared errors (SSE). The errors are specified as [math]\displaystyle{ e_t=y_t-\hat{y}_{t\mid t-1} }[/math] for [math]\displaystyle{ t=1, \ldots,T }[/math] (the one-step-ahead within-sample forecast errors). Hence we find the values of the unknown parameters and the initial values that minimize

[math]\displaystyle{ \text{SSE} = \sum_{t=1}^T (y_t-\hat{y}_{t\mid t-1})^2=\sum_{t=1}^T e_t^2 }[/math][10]

Unlike the regression case (where we have formulae to directly compute the regression coefficients which minimize the SSE) this involves a non-linear minimization problem and we need to use an optimization tool to perform this.

"Exponential" naming

The name 'exponential smoothing' is attributed to the use of the exponential window function during convolution. It is no longer attributed to Holt, Winters & Brown.

By direct substitution of the defining equation for simple exponential smoothing back into itself we find that

[math]\displaystyle{ \begin{align} s_t& = \alpha x_t + (1-\alpha)s_{t-1}\\[3pt] & = \alpha x_t + \alpha (1-\alpha)x_{t-1} + (1 - \alpha)^2 s_{t-2}\\[3pt] & = \alpha \left[x_t + (1-\alpha)x_{t-1} + (1-\alpha)^2 x_{t-2} + (1-\alpha)^3 x_{t-3} + \cdots + (1-\alpha)^{t-1} x_1 \right] + (1-\alpha)^t x_0. \end{align} }[/math]

In other words, as time passes the smoothed statistic [math]\displaystyle{ s_t }[/math] becomes the weighted average of a greater and greater number of the past observations [math]\displaystyle{ s_{t-1},\ldots, s_{t-n},\ldots }[/math], and the weights assigned to previous observations are proportional to the terms of the geometric progression

[math]\displaystyle{ 1, (1-\alpha), (1-\alpha)^2,\ldots, (1-\alpha)^n,\ldots }[/math]

A geometric progression is the discrete version of an exponential function, so this is where the name for this smoothing method originated according to Statistics lore.

Comparison with moving average

Exponential smoothing and moving average have similar defects of introducing a lag relative to the input data. While this can be corrected by shifting the result by half the window length for a symmetrical kernel, such as a moving average or gaussian, it is unclear how appropriate this would be for exponential smoothing. They also both have roughly the same distribution of forecast error when α = 2/(k + 1). They differ in that exponential smoothing takes into account all past data, whereas moving average only takes into account k past data points. Computationally speaking, they also differ in that moving average requires that the past k data points, or the data point at lag k + 1 plus the most recent forecast value, to be kept, whereas exponential smoothing only needs the most recent forecast value to be kept.[11]

In the signal processing literature, the use of non-causal (symmetric) filters is commonplace, and the exponential window function is broadly used in this fashion, but a different terminology is used: exponential smoothing is equivalent to a first-order infinite-impulse response (IIR) filter and moving average is equivalent to a finite impulse response filter with equal weighting factors.

Double exponential smoothing (Holt linear)

Simple exponential smoothing does not do well when there is a trend in the data. [1] In such situations, several methods were devised under the name "double exponential smoothing" or "second-order exponential smoothing," which is the recursive application of an exponential filter twice, thus being termed "double exponential smoothing". This nomenclature is similar to quadruple exponential smoothing, which also references its recursion depth.[12] The basic idea behind double exponential smoothing is to introduce a term to take into account the possibility of a series exhibiting some form of trend. This slope component is itself updated via exponential smoothing.

One method, works as follows:[13]

Again, the raw data sequence of observations is represented by [math]\displaystyle{ x_t }[/math], beginning at time [math]\displaystyle{ t=0 }[/math]. We use [math]\displaystyle{ s_t }[/math] to represent the smoothed value for time [math]\displaystyle{ t }[/math], and [math]\displaystyle{ b_t }[/math] is our best estimate of the trend at time [math]\displaystyle{ t }[/math]. The output of the algorithm is now written as [math]\displaystyle{ F_{t+m} }[/math], an estimate of the value of [math]\displaystyle{ x_{t+m} }[/math] at time [math]\displaystyle{ m \gt 0 }[/math] based on the raw data up to time [math]\displaystyle{ t }[/math]. Double exponential smoothing is given by the formulas

[math]\displaystyle{ \begin{align} s_0 & = x_0\\ b_0 & = x_1 - x_0\\ \end{align} }[/math]

And for [math]\displaystyle{ t \gt 0 }[/math] by

[math]\displaystyle{ \begin{align} s_t & = \alpha x_t + (1-\alpha)(s_{t-1} + b_{t-1})\\ b_t & = \beta (s_t - s_{t-1}) + (1-\beta)b_{t-1}\\ \end{align} }[/math]

where [math]\displaystyle{ \alpha }[/math] ([math]\displaystyle{ 0 \le \alpha \le 1 }[/math]) is the data smoothing factor, and [math]\displaystyle{ \beta }[/math] ([math]\displaystyle{ 0 \le \beta \le 1 }[/math]) is the trend smoothing factor.

To forecast beyond [math]\displaystyle{ x_t }[/math] is given by the approximation:

[math]\displaystyle{ F_{t+m} = s_t + m \cdot b_t }[/math]

Setting the initial value [math]\displaystyle{ b }[/math] is a matter of preference. An option other than the one listed above is [math]\displaystyle{ \frac{x_n-x_0} n }[/math] for some [math]\displaystyle{ n }[/math].

Note that F0 is undefined (there is no estimation for time 0), and according to the definition F1=s0+b0, which is well defined, thus further values can be evaluated.

A second method, referred to as either Brown's linear exponential smoothing (LES) or Brown's double exponential smoothing works as follows.[14]

[math]\displaystyle{ \begin{align} s'_0 & = x_0\\ s''_0 & = x_0\\ s'_t & = \alpha x_t + (1-\alpha)s'_{t-1}\\ s''_t & = \alpha s'_t + (1-\alpha)s''_{t-1}\\ F_{t+m} & = a_t + mb_t, \end{align} }[/math]

where at, the estimated level at time t and bt, the estimated trend at time t are:

[math]\displaystyle{ \begin{align} a_t & = 2s'_t - s''_t\\[5pt] b_t & = \frac \alpha {1-\alpha} (s'_t - s''_t). \end{align} }[/math]

Triple exponential smoothing (Holt Winters)

Triple exponential smoothing applies exponential smoothing three times, which is commonly used when there are three high frequency signals to be removed from a time series under study. There are different types of seasonality: 'multiplicative' and 'additive' in nature, much like addition and multiplication are basic operations in mathematics.

If every month of December we sell 10,000 more apartments than we do in November the seasonality is additive in nature. However, if we sell 10% more apartments in the summer months than we do in the winter months the seasonality is multiplicative in nature. Multiplicative seasonality can be represented as a constant factor, not an absolute amount. [15]

Triple exponential smoothing was first suggested by Holt's student, Peter Winters, in 1960 after reading a signal processing book from the 1940s on exponential smoothing.[16] Holt's novel idea was to repeat filtering an odd number of times greater than 1 and less than 5, which was popular with scholars of previous eras.[16] While recursive filtering had been used previously, it was applied twice and four times to coincide with the Hadamard conjecture, while triple application required more than double the operations of singular convolution. The use of a triple application is considered a rule of thumb technique, rather than one based on theoretical foundations and has often been over-emphasized by practitioners. - Suppose we have a sequence of observations [math]\displaystyle{ x_t, }[/math] beginning at time [math]\displaystyle{ t=0 }[/math] with a cycle of seasonal change of length [math]\displaystyle{ L }[/math].

The method calculates a trend line for the data as well as seasonal indices that weight the values in the trend line based on where that time point falls in the cycle of length [math]\displaystyle{ L }[/math].

Let [math]\displaystyle{ s_t }[/math] represent the smoothed value of the constant part for time [math]\displaystyle{ t }[/math], [math]\displaystyle{ b_t }[/math] is the sequence of best estimates of the linear trend that are superimposed on the seasonal changes, and [math]\displaystyle{ c_t }[/math] is the sequence of seasonal correction factors. We wish to estimate [math]\displaystyle{ c_t }[/math] at every time [math]\displaystyle{ t }[/math]mod [math]\displaystyle{ L }[/math] in the cycle that the observations take on. As a rule of thumb, a minimum of two full seasons (or [math]\displaystyle{ 2L }[/math] periods) of historical data is needed to initialize a set of seasonal factors.

The output of the algorithm is again written as [math]\displaystyle{ F_{t+m} }[/math], an estimate of the value of [math]\displaystyle{ x_{t+m} }[/math] at time [math]\displaystyle{ t+m\gt 0 }[/math] based on the raw data up to time [math]\displaystyle{ t }[/math]. Triple exponential smoothing with multiplicative seasonality is given by the formulas[1]

[math]\displaystyle{ \begin{align} s_0 & = x_0\\[5pt] s_t & = \alpha \frac{x_t}{c_{t-L}} + (1-\alpha)(s_{t-1} + b_{t-1})\\[5pt] b_t & = \beta (s_t - s_{t-1}) + (1-\beta)b_{t-1}\\[5pt] c_t & = \gamma \frac{x_t}{s_t}+(1-\gamma)c_{t-L}\\[5pt] F_{t+m} & = (s_t + mb_t)c_{t-L+1+(m-1)\bmod L}, \end{align} }[/math]

where [math]\displaystyle{ \alpha }[/math] ([math]\displaystyle{ 0 \le \alpha \le 1 }[/math]) is the data smoothing factor, [math]\displaystyle{ \beta }[/math] ([math]\displaystyle{ 0 \le \beta \le 1 }[/math]) is the trend smoothing factor, and [math]\displaystyle{ \gamma }[/math] ([math]\displaystyle{ 0 \le \gamma \le 1 }[/math]) is the seasonal change smoothing factor.

The general formula for the initial trend estimate [math]\displaystyle{ b }[/math] is:

[math]\displaystyle{ \begin{align} b_0 & = \frac{1}{L} \left(\frac{x_{L+1}-x_1}{L} + \frac{x_{L+2}-x_2}{L} + \cdots + \frac{x_{L+L}-x_L}{L}\right) \end{align} }[/math]

Setting the initial estimates for the seasonal indices [math]\displaystyle{ c_i }[/math] for [math]\displaystyle{ i = 1,2,\ldots,L }[/math] is a bit more involved. If [math]\displaystyle{ N }[/math] is the number of complete cycles present in your data, then:

[math]\displaystyle{ c_i = \frac{1}{N} \sum_{j=1}^N \frac{x_{L(j-1)+i}}{A_j} \quad \text{for } i = 1,2,\ldots,L }[/math]


[math]\displaystyle{ A_j = \frac{\sum_{i=1}^{L} x_{L(j-1)+i}}{L} \quad \text{for } j = 1,2,\ldots,N }[/math]

Note that [math]\displaystyle{ A_j }[/math] is the average value of [math]\displaystyle{ x }[/math] in the [math]\displaystyle{ j^\text{th} }[/math] cycle of your data.

Triple exponential smoothing with additive seasonality is given by:

[math]\displaystyle{ \begin{align} s_0 & = x_0\\ s_t & = \alpha (x_t-c_{t-L}) + (1-\alpha)(s_{t-1} + b_{t-1})\\ b_t & = \beta (s_t - s_{t-1}) + (1-\beta)b_{t-1}\\ c_t & = \gamma (x_t-s_{t-1}-b_{t-1})+(1-\gamma)c_{t-L}\\ F_{t+m} & = s_t + mb_t+c_{t-L+1+(m-1) \bmod L}, \end{align} }[/math]

Implementations in statistics packages

  • R: the HoltWinters function in the stats package[17] and ets function in the forecast package[18] (a more complete implementation, generally resulting in a better performance[19]).
  • Python: the holtwinters module of the statsmodels package allow for simple, double and triple exponential smoothing.
  • IBM SPSS includes Simple, Simple Seasonal, Holt's Linear Trend, Brown's Linear Trend, Damped Trend, Winters' Additive, and Winters' Multiplicative in the Time-Series modeling procedure within its Statistics and Modeler statistical packages. The default Expert Modeler feature evaluates all seven exponential smoothing models and ARIMA models with a range of nonseasonal and seasonal p, d, and q values, and selects the model with the lowest Bayesian Information Criterion statistic.
  • Stata: tssmooth command[20]
  • LibreOffice 5.2[21]
  • Microsoft Excel 2016[22]

See also


  1. 1.0 1.1 1.2 "NIST/SEMATECH e-Handbook of Statistical Methods". NIST. http://www.itl.nist.gov/div898/handbook/. 
  2. 2.0 2.1 Oppenheim, Alan V.; Schafer, Ronald W. (1975). Digital Signal Processing. Prentice Hall. p. 5. ISBN 0-13-214635-5. 
  3. Brown, Robert G. (1956). Exponential Smoothing for Predicting Demand. Cambridge, Massachusetts: Arthur D. Little Inc.. pp. 15. http://legacy.library.ucsf.edu/tid/dae94e00;jsessionid=104A0CEFFA31ADC2FA5E0558F69B3E1D.tobacco03. 
  4. Holt, Charles C. (1957). "Forecasting Trends and Seasonal by Exponentially Weighted Averages". Office of Naval Research Memorandum 52.  reprinted in Holt, Charles C. (January–March 2004). "Forecasting Trends and Seasonal by Exponentially Weighted Averages". International Journal of Forecasting 20 (1): 5–10. doi:10.1016/j.ijforecast.2003.09.015. 
  5. Brown, Robert Goodell (1963). Smoothing Forecasting and Prediction of Discrete Time Series. Englewood Cliffs, NJ: Prentice-Hall. http://babel.hathitrust.org/cgi/pt?id=mdp.39015004514728;view=1up;seq=1. 
  6. "NIST/SEMATECH e-Handbook of Statistical Methods, Single Exponential Smoothing". NIST. http://www.itl.nist.gov/div898/handbook/pmc/section4/pmc431.htm. 
  7. Nau, Robert. "Averaging and Exponential Smoothing Models". http://www.duke.edu/~rnau/411avg.htm. 
  8. "Production and Operations Analysis" Nahmias. 2009.
  9. Čisar, P., & Čisar, S. M. (2011). "Optimization methods of EWMA statistics." Acta Polytechnica Hungarica, 8(5), 73–87. Page 78.
  10. 7.1 Simple exponential smoothing | Forecasting: Principles and Practice. https://www.otexts.org/fpp/7/1. 
  11. Nahmias, Steven (3 March 2008). Production and Operations Analysis (6th ed.). ISBN 978-0-07-337785-8. [page needed]
  12. "Model: Second-Order Exponential Smoothing". SAP AG. http://help.sap.com/saphelp_45b/helpdata/en/7d/c27a14454011d182b40000e829fbfe/content.htm. 
  13. " Double Exponential Smoothing". itl.nist.gov. http://www.itl.nist.gov/div898/handbook/pmc/section4/pmc433.htm. 
  14. "Averaging and Exponential Smoothing Models". duke.edu. http://www.duke.edu/~rnau/411avg.htm. 
  15. Kalehar, Prajakta S.. "Time series Forecasting using Holt–Winters Exponential Smoothing". http://www.it.iitb.ac.in/~praj/acads/seminar/04329008_ExponentialSmoothing.pdf. 
  16. 16.0 16.1 Winters, P. R. (April 1960). "Forecasting Sales by Exponentially Weighted Moving Averages". Management Science 6 (3): 324–342. doi:10.1287/mnsc.6.3.324. 
  17. "R: Holt–Winters Filtering". https://stat.ethz.ch/R-manual/R-patched/library/stats/html/HoltWinters.html. 
  18. "ets {forecast} | inside-R | A Community Site for R". http://www.inside-r.org/packages/cran/forecast/docs/ets. 
  19. "Comparing HoltWinters() and ets()" (in en-US). 2011-05-29. http://robjhyndman.com/hyndsight/estimation2/. 
  20. tssmooth in Stata manual
  21. "LibreOffice 5.2: Release Notes – the Document Foundation Wiki". https://wiki.documentfoundation.org/ReleaseNotes/5.2#New_spreadsheet_functions. 
  22. "Excel 2016 Forecasting Functions | Real Statistics Using Excel". http://www.real-statistics.com/time-series-analysis/basic-time-series-forecasting/excel-2016-forecasting-functions/. 

External links