Exponential Smoothing Methods with R

Last Update: February 6, 2020

Exponential smoothing methods consist of forecast based on previous periods data with exponentially decaying influence the older they become. Their notation is ETS (error, trend, seasonality) where each can be none (N), additive (A), additive damped (Ad), multiplicative (M) or multiplicative damped (Md).

This topic is part of Forecasting Models with R course. Feel free to take a look at Course Curriculum.

This tutorial has an educational and informational purpose and doesn’t constitute any type of forecasting, business, trading or investment advice. All content, including code and data, is presented for personal educational use exclusively and with no guarantee of exactness of completeness. Past performance doesn’t guarantee future results. Please read full Disclaimer.

An example of exponential smoothing methods is Brown simple exponential smoothing [1] which consists of forecast with no trend or seasonal patterns.

1. Method notation.

  • ETS(A,N,N): error = additive, trend = none, seasonality = none

2. Formula notation.

\hat{y}_{t+h}=l_{t}

l_{t}=\alpha y_{t}+\left ( 1-\alpha \right )l_{t-1}

0\leq \alpha \leq 1,h\geq 1

Where \hat{y}_{t+h} = h step forecast, l_{t} = current period level forecast, y_{t} = current period data, \alpha = level smoothing coefficient.

3. R script code example.

3.1. Load R package [2].

library('forecast')

3.2. Exponential smoothing methods data reading, training and testing ranges delimiting.

  • Data: S&P 500® index replicating ETF (ticker symbol: SPY) daily adjusted close prices (2007-2015).
  • Training and testing ranges delimiting not fixed and only included for educational purposes.
data <- read.csv('Exponential-Smoothing-Methods-Data.txt',header=T)
spy <- ts(data[,2],frequency=21)

spyt <- window(spy,end=c(84,19))
spyf <- window(spy,start=c(84,20))

3.3. Brown simple exponential smoothing method calculation and chart.

brown <- ses(spyt,h=504) 

plot(brown,main='Brown Simple Exponential Smoothing ETS(A,N,N) Method',ylab='Price',xlab='Month')
lines(spyf,lty=3)
4. References.

[1] Robert G. Brown. “Exponential Smoothing for Predicting Demand”. Arthur D. Little Inc. 1956.

[2] Hyndman RJ, Khandakar Y. “Automatic time series forecasting: the forecast package for R”. Journal of Statistical Software. 2008.