Moving to Tidy Forecasting in R: Exponential Smoothing Methods — Updated: 2/4/21
By: Joon Im
Tags: R, Time Series Forecasting, Tidyverse, Time Series Analysis, Forecasting

How to forecast using ETS models with a code comparison of three frameworks: fpp2, fpp3, and modeltime+timetk. Updated: 2/4/21.

Automatic ETS forecasting on seasonal and non-seasonal data

Note: This article has been updated to include the modeltime+timetk framework. It is also published on my personal blog.

1. Set Up

1.1 Introduction

This article is the second in a series comparing the fpp2 , fpp3 , and timetk + modeltime forecasting frameworks in R . It will focus on how to manually and automatically choose an exponential smoothing model for fitting various types of time series data. It will also show how to evaluate these models to see if the residuals can be considered white noise. Exponential smoothing models are also known as Error, Trend, Seasonality (ETS) models.

1.2 Load Libraries

# Load libraries

library(fpp2) # The forecasting OG

library(fpp3) # The tidy version of fpp2

library(modeltime) # The tidy forecasting newcomer

library(timetk) # Companion to modeltime

library(parsnip) # Common interface for specifying models

library(tidyverse) # Data manipulation tools

library(cowplot) # Arranging plots

1.3 About Exponentially Weighted Forecasts

In a nutshell, an ETS model is a mathematical formula which calculates a forecast by weighing the averages of past observations: the more recent an observation, or lag, the higher the associated weight to the formula. The formula can also add additional components depending on the patterns in the data. These components are:

- A trend component which is either missing, additive or damped.

- A seasonal component which is either missing, additive, or multiplicative.

Every forecaster needs to understand ETS models because they are an effective tool in creating forecasts for many types of univariate time series data. In fact, a major forecasting study showed that they generally out-perform even the latest machine learning and deep learning methods for one-step forecasting on univariate data. For a breakdown of this study, read Jason Brownlee’s excellent article which compares the effectiveness of classical forecasting vs machine-learning methods here.

Forecasts using ETS models can be quickly computed and generalize well to many different types of time series data.

1.4 About ETS Residuals

The residuals of a time series are the values that are left after fitting a model. They are essentially the differences between the observations and their fitted values, otherwise known as one-step forecast errors. If the residuals show no outliers or patterns, then this means the forecasting method that was utilized captured all of the available information i.e. the residuals can be considered white noise.

A good ETS model will have residuals with the following properties:

- Essential: The residuals should have zero mean. If not, then the forecasts are considered biased and may require adjustment. Check the residuals plot.

- Essential: The residuals should be uncorrelated. They will resemble white noise because the forecasting method captured all the available information. Check the ACF plot.

- Non-Essential: The residuals have constant variance and are normally distributed. If they don’t, then the prediction intervals will be larger and less accurate. Check the histogram plot.

Once the residuals have been examined, a good metric for finding the best-fitting model is to minimize the bias-corrected Akaike’s Information Criterion (AICc). This process is similar to cross-validation but is faster and may be a better option for really long time series data. To learn more about how to use information criteria for model selection, read Professor Hyndman’s explanation here.