Exponential Smoothing

Simon U., Michael Y., Ben H., Sachid Deshmukh

March 3, 2020

Introduction

  1. Naive—all weight is given to the last observation
  2. Average—each past observation is given equal weight
  3. Exponential weighted average—Recent observations get higher weight, older observations less weight
  4. Holt linear—Same as 3, but accounts for time series with trend
  5. Holt-Winters—Same as 4, but also accounts for time series with seasonality
  6. State Space—ETS models - also generate forecast/prediction intervals

\(ES_{1}\): Naive model

forecast_naive <- function(y, h) {
    n <- length(y)
    y_hat <- rep(y[n], h)
    return( y_hat )
}

\(ES_{1}\): Naive model: Example

y <- c(1, 4, 5, 2, 3, 6, 8)
y_hat <- forecast_naive(y, h=7)

plot_forecast(y, y_hat)

\(ES_{2}\): Average model

forecast_avg <- function(y, h) {
    y_hat <- rep(mean(y), h)
    return( y_hat )
}

\(ES_{2}\): Average model: Example

y_hat <- forecast_avg(y, h=7)
plot_forecast(y, y_hat)

\(ES_{3}\): Simple Exponential Smoothing [SES]

Exploring “Exponential” aspect

Geometric Distribution

Geometric Distribution graph for various values of \(\alpha\)

Exploring “Smoothing” aspect

SES - Mathematical Formulations

Interlude

\(ES_{4}\): Holt Linear Trend Model

Appropriate for time series that can be described with

\[y_t = \beta_0 + \beta_1 t + \epsilon_t\]

where \(\beta_1\) quantifies the trend

\(ES_{4}\): Holt Linear Trend Model: Linear Time Series

beta_0 <- 0
beta_1 <- 1.5
t_ <- 1:7
( y_1 <- beta_0 + y + beta_1*t_ )
## [1]  2.5  7.0  9.5  8.0 10.5 15.0 18.5

\(ES_{4}\): Holt Linear Trend Model: Linear Time Series

\(ES_{4}\): Holt Linear Trend Model: Equations

\[\begin{aligned} \text{Forecast equation}&& \hat{y}_{t+h|t} &= L_{t} + h T_{t} \\ \text{Level equation} && L_{t} &= \alpha y_{t} + (1 - \alpha)(L_{t-1} + T_{t-1})\\ \text{Trend equation} && T_{t} &= \beta (L_{t} - L_{t-1}) + (1 -\beta)L_{t-1}, \end{aligned}\]

where

\(ES_{4}\): Holt Linear Trend Model: Example

In the FPP2 package there is data set of the Google share price over 1000 days, from 2/25/2013 to 2/13/2017.

We can make a train/test split, and then train Holt’s Linear Trend model on the first 900 days, and generate a prediction for the next 100 days:

# create training and validation of the Google stock data
goog.train <- window(goog, end = 900)
goog.test <- window(goog, start = 901)
# run holt's model on the training data
holt.goog <- holt(goog.train, h = 100)

\(ES_{4}\): Holt Linear Trend Model: Graph

autoplot(holt.goog)

\(ES_{4}\): Holt Linear Trend Model: Accuracy

We can check the accuracy of the model predictions vs. the test data:

accuracy(holt.goog,goog.test)[,c("RMSE","MAE","MAPE")]
##                   RMSE       MAE     MAPE
## Training set  8.795267  5.821057 1.000720
## Test set     16.328680 12.876836 1.646261

This indicates a Mean Average Percentage Error (MAPE) of about 1.6% on the test data.

\(ES_{5}\): Holt-Winters method: incorporating seasonality

The Holt-Winters method accomodates both trend and seasonality.

There are two flavors: Additive and Multiplicative.

Each flavor involves four equations:

\(ES_{5}\): Holt-Winters method - Equations

Additive:

Multiplicative:

where

\(ES_{5}\): Holt-Winters method - Example

The fpp2 package includes a dataset on Australian cement production, qcement, which exhibits both trend and seasonality:

\(ES_{5}\): Holt-Winters method - Additive Example

autoplot(forecast(hw(qcement.train)))

\(ES_{5}\): Holt-Winters method - Multiplicative Example

autoplot(forecast(hw(qcement.train,
                     seasonal = "multiplicative")))

\(ES_{6}\): ETS modeling (Innovations state space models) - 1

\(ES_{6}\): ETS modeling (Innovations state space models) - 2

\(ES_{6}\): ETS(A,N,N) - Simple Exponential Smoothing with additive errors

autoplot(forecast(ets(qcement.train, model = "ANN")))

\(ES_{6}\): ETS(M,N,N) - Simple Exponential Smoothing with multiplicative errors

autoplot(forecast(ets(qcement.train, model = "MNN")))

\(ES_{6}\): ETS(A,A,N) - Holt’s Linear Method with additive errors

autoplot(forecast(ets(qcement.train, model = "AAN")))

\(ES_{6}\): ETS(M,A,N) - Holt’s Linear Method with multiplicative errors

autoplot(forecast(ets(qcement.train, model = "MAN")))

\(ES_{6}\): ETS(A,A,A) = Holt-Winters Additive

autoplot(forecast(ets(qcement.train, model = "AAA")))

\(ES_{6}\): ETS(M,M,M) = Multiplicative Errors, Trend, Seasonality

autoplot(forecast(ets(qcement.train, model = "MMM")))

Resources & Further Readings