oildata <- window(oil, start = 1996)
autoplot(oildata) +
ylab("Oil (millions of tonnes)") +
xlab("Year")
Exponential smoothing was proposed in the late 1950s (Brown, 1959; Holt, 1957; Winters, 1960), and has motivated some of the most successful forecasting methods. Forecasts produced using exponential smoothing methods are weighted averages of past observations, with the weights decaying exponentially as the observations get older. In other words, the more recent the observation the higher the associated weight. This framework generates reliable forecasts quickly and for a wide range of time series, which is a great advantage and of major importance to applications in industry.
This chapter is divided into two parts. In the first part (Sections 7.1–7.4) we present the mechanics of the most important exponential smoothing methods, and their application in forecasting time series with various characteristics. This helps us develop an intuition to how these methods work. In this setting, selecting and using a forecasting method may appear to be somewhat ad hoc. The selection of the method is generally based on recognising key components of the time series (trend and seasonal) and the way in which these enter the smoothing method (e.g., in an additive, damped or multiplicative manner).
In the second part of the chapter (Sections 7.5–7.7) we present the statistical models that underlie exponential smoothing methods. These models generate identical point forecasts to the methods discussed in the first part of the chapter, but also generate prediction intervals. Furthermore, this statistical framework allows for genuine model selection between competing models.
The simplest of the exponentially smoothing methods is naturally called simple exponential smoothing (SES)1. This method is suitable for forecasting data with no clear trend or seasonal pattern. For example, the data in Figure 7.1 do not display any clear trending behaviour or any seasonality. (There is a rise in the last few years, which might suggest a trend. We will consider whether a trended method would be better for this series later in this chapter.) We have already considered the naïve and the average as possible methods for forecasting such data (Section 3.1).
oildata <- window(oil, start = 1996)
autoplot(oildata) +
ylab("Oil (millions of tonnes)") +
xlab("Year")
Using the naïve method, all forecasts for the future are equal to the last observed value of the series, \hat{y}_{T+h|T} = y_{T}, for h = 1,2,\dots. Hence, the naïve method assumes that the most recent observation is the only important one, and all previous observations provide no information for the future. This can be thought of as a weighted average where all of the weight is given to the last observation.
Using the average method, all future forecasts are equal to a simple average of the observed data, \hat{y}_{T+h|T} = \frac1T \sum_{t=1}^T y_t, for h = 1,2,\dots. Hence, the average method assumes that all observations are of equal importance, and gives them equal weights when generating forecasts.
We often want something between these two extremes. For example, it may be sensible to attach larger weights to more recent observations than to observations from the distant past. This is exactly the concept behind simple exponential smoothing. Forecasts are calculated using weighted averages, where the weights decrease exponentially as observations come from further in the past — the smallest weights are associated with the oldest observations: \hat{y}_{T+1|T} = \alpha y_T + \alpha(1 - \alpha) y_{T-1} + \alpha(1 - \alpha)^2 y_{T-2} + \cdots, \tag{7.1} where 0 \le \alpha \le 1 is the smoothing parameter. The one-step-ahead forecast for time T + 1 is a weighted average of all of the observations in the series y_1,\dots,y_T. The rate at which the weights decrease is controlled by the parameter \alpha.
Table 7.1 shows the weights attached to observations for four different values of \alpha when forecasting using simple exponential smoothing. Note that the sum of the weights even for a small value of \alpha will be approximately one for any reasonable sample size.
| \alpha=0.2 | \alpha=0.4 | \alpha=0.6 | \alpha=0.8 | |
|---|---|---|---|---|
| y_{T} | 0.2000 | 0.4000 | 0.6000 | 0.8000 |
| y_{T-1} | 0.1600 | 0.2400 | 0.2400 | 0.1600 |
| y_{T-2} | 0.1280 | 0.1440 | 0.0960 | 0.0320 |
| y_{T-3} | 0.1024 | 0.0864 | 0.0384 | 0.0064 |
| y_{T-4} | 0.0819 | 0.0518 | 0.0154 | 0.0013 |
| y_{T-5} | 0.0655 | 0.0311 | 0.0061 | 0.0003 |
For any \alpha between 0 and 1, the weights attached to the observations decrease exponentially as we go back in time, hence the name “exponential smoothing”. If \alpha is small (i.e., close to 0), more weight is given to observations from the more distant past. If \alpha is large (i.e., close to 1), more weight is given to the more recent observations. For the extreme case where \alpha = 1, \hat{y}_{T+1|T} = y_T, and the forecasts are equal to the naïve forecasts.
We present two equivalent forms of simple exponential smoothing, each of which leads to the forecast Equation 7.1.
The forecast at time T + 1 is equal to a weighted average between the most recent observation y_T and the previous forecast \hat{y}_{T|T-1}: \hat{y}_{T+1|T} = \alpha y_T + (1 - \alpha) \hat{y}_{T|T-1}, where 0 \le \alpha \le 1 is the smoothing parameter. Similarly, we can write the fitted values as \hat{y}_{t+1|t} = \alpha y_t + (1 - \alpha) \hat{y}_{t|t-1}, for t = 1,\dots,T. (Recall that fitted values are simply one-step forecasts of the training data.)
The process has to start somewhere, so we let the first fitted value at time 1 be denoted by \ell_0 (which we will have to estimate). Then \begin{align*} \hat{y}_{2|1} & = \alpha y_1 + (1 - \alpha) \ell_0 \\ \hat{y}_{3|2} & = \alpha y_2 + (1 - \alpha) \hat{y}_{2|1} \\ \hat{y}_{4|3} & = \alpha y_3 + (1 - \alpha) \hat{y}_{3|2} \\ \vdots \\ \hat{y}_{T|T-1} & = \alpha y_{T-1} + (1 - \alpha) \hat{y}_{T-1|T-2} \\ \hat{y}_{T+1|T} & = \alpha y_T + (1 - \alpha) \hat{y}_{T|T-1}. \end{align*} Substituting each equation into the following equation, we obtain \begin{align*} \hat{y}_{3|2} & = \alpha y_2 + (1 - \alpha) \left[ \alpha y_1 + (1 - \alpha) \ell_0 \right] \\ & = \alpha y_2 + \alpha(1 - \alpha) y_1 + (1 - \alpha)^2 \ell_0 \\ \hat{y}_{4|3} & = \alpha y_3 + (1 - \alpha) [\alpha y_2 + \alpha(1 - \alpha) y_1 + (1 - \alpha)^2 \ell_0] \\ & = \alpha y_3 + \alpha(1 - \alpha) y_2 + \alpha(1 - \alpha)^2 y_1 + (1 - \alpha)^3 \ell_0 \\ & ~~ \vdots \\ \hat{y}_{T+1|T} & = \sum_{j=0}^{T-1} \alpha(1 - \alpha)^j y_{T-j} + (1 - \alpha)^T \ell_{0}. \end{align*} The last term becomes tiny for large T. So, the weighted average form leads to the same forecast Equation 7.1.
An alternative representation is the component form. For simple exponential smoothing, the only component included is the level, \ell_t. (Other methods which are considered later in this chapter may also include a trend b_t and a seasonal component s_t.) Component form representations of exponential smoothing methods comprise a forecast equation and a smoothing equation for each of the components included in the method. The component form of simple exponential smoothing is given by: \begin{align*} \text{Forecast equation} & & \hat{y}_{t+h|t} & = \ell_{t} \\ \text{Smoothing equation} & & \ell_{t} & = \alpha y_{t} + (1 - \alpha)\ell_{t-1}, \end{align*} where \ell_{t} is the level (or the smoothed value) of the series at time t. Setting h = 1 gives the fitted values, while setting t = T gives the true forecasts beyond the training data.
The forecast equation shows that the forecast value at time t + 1 is the estimated level at time t. The smoothing equation for the level (usually referred to as the level equation) gives the estimated level of the series at each period t.
If we replace \ell_t with \hat{y}_{t+1|t} and \ell_{t-1} with \hat{y}_{t|t-1} in the smoothing equation, we will recover the weighted average form of simple exponential smoothing.
The component form of simple exponential smoothing is not particularly useful, but it will be the easiest form to use when we start adding other components.
Simple exponential smoothing has a “flat” forecast function: \hat{y}_{T+h|T} = \hat{y}_{T+1|T} = \ell_T, \qquad h = 2,3,\dots. That is, all forecasts take the same value, equal to the last level component. Remember that these forecasts will only be suitable if the time series has no trend or seasonal component.
The application of every exponential smoothing method requires the smoothing parameters and the initial values to be chosen. In particular, for simple exponential smoothing, we need to select the values of \alpha and \ell_0. All forecasts can be computed from the data once we know those values. For the methods that follow there is usually more than one smoothing parameter and more than one initial component to be chosen.
In some cases, 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 reliable and objective way to obtain values for the unknown parameters is to estimate them from the observed data.
In Section 5.2, we estimated the coefficients of a regression model by minimising the sum of the squared residuals (usually known as SSE or “sum of squared errors”). Similarly, the unknown parameters and the initial values for any exponential smoothing method can be estimated by minimising the SSE. The residuals are specified as e_t = y_t - \hat{y}_{t|t-1} for t = 1,\dots,T. Hence, we find the values of the unknown parameters and the initial values that minimise \text{SSE} = \sum_{t=1}^T(y_t - \hat{y}_{t|t-1})^2 = \sum_{t=1}^Te_t^2. \tag{7.2}
Unlike the regression case (where we have formulas which return the values of the regression coefficients that minimise the SSE), this involves a non-linear minimisation problem, and we need to use an optimisation tool to solve it.
In this example, simple exponential smoothing is applied to forecast oil production in Saudi Arabia.
oildata <- window(oil, start = 1996)
# Estimate parameters
fc <- ses(oildata, h = 5)
# Accuracy of one-step-ahead training errors
round(accuracy(fc), 2) ME RMSE MAE MPE MAPE MASE ACF1
Training set 6.4 28.12 22.26 1.1 4.61 0.93 -0.03
This gives parameter estimates \hat\alpha = 0.83 and \hat\ell_0 = 446.6, obtained by minimising SSE over periods t = 1,2,\dots,18, subject to the restriction that 0 \le \alpha \le 1.
In Table 7.2 we demonstrate the calculation using these parameters. The second last column shows the estimated level for times t = 0 to t = 18; the last few rows of the last column show the forecasts for h = 1,2,3,4,5.
| Year | Time | Observation | Level | Forecast |
|---|---|---|---|---|
| t | y_t | \ell_t | \hat{y}_{t\vert t-1} | |
| 1995 | 0 | 446.59 | ||
| 1996 | 1 | 445.36 | 445.57 | 446.59 |
| 1997 | 2 | 453.20 | 451.93 | 445.57 |
| 1998 | 3 | 454.41 | 454.00 | 451.93 |
| 1999 | 4 | 422.38 | 427.63 | 454.00 |
| 2000 | 5 | 456.04 | 451.32 | 427.63 |
| 2001 | 6 | 440.39 | 442.20 | 451.32 |
| 2002 | 7 | 425.19 | 428.02 | 442.20 |
| 2003 | 8 | 486.21 | 476.54 | 428.02 |
| 2004 | 9 | 500.43 | 496.46 | 476.54 |
| 2005 | 10 | 521.28 | 517.15 | 496.46 |
| 2006 | 11 | 508.95 | 510.31 | 517.15 |
| 2007 | 12 | 488.89 | 492.45 | 510.31 |
| 2008 | 13 | 509.87 | 506.98 | 492.45 |
| 2009 | 14 | 456.72 | 465.07 | 506.98 |
| 2010 | 15 | 473.82 | 472.36 | 465.07 |
| 2011 | 16 | 525.95 | 517.05 | 472.36 |
| 2012 | 17 | 549.83 | 544.39 | 517.05 |
| 2013 | 18 | 542.34 | 542.68 | 544.39 |
| h | \hat{y}_{T+h\vert T} | |||
| 2014 | 1 | 542.68 | ||
| 2015 | 2 | 542.68 | ||
| 2016 | 3 | 542.68 | ||
| 2017 | 4 | 542.68 | ||
| 2018 | 5 | 542.68 |
The black line in Figure 7.2 is a plot of the data, which shows a changing level over time.
autoplot(fc) +
autolayer(fitted(fc), series = "Fitted") +
ylab("Oil (millions of tonnes)") +
xlab("Year")
The forecasts for the period 2014–2018 are plotted in Figure 7.2. Also plotted are one-step-ahead fitted values alongside the data over the period 1996–2013. The large value of \alpha in this example is reflected in the large adjustment that takes place in the estimated level \ell_t at each time. A smaller value of \alpha would lead to smaller changes over time, and so the series of fitted values would be smoother.
The prediction intervals shown here are calculated using the methods described in Section 7.7. The prediction intervals show that there is considerable uncertainty in the future values of oil production over the five-year forecast period. So interpreting the point forecasts without accounting for the large uncertainty can be very misleading.
Holt (1957) extended simple exponential smoothing to allow the forecasting of data with a trend. This method involves a forecast equation and two smoothing equations (one for the level and one for the trend): \begin{align*} \text{Forecast equation} & & \hat{y}_{t+h|t} & = \ell_{t} + hb_{t} \\ \text{Level equation} & & \ell_{t} & = \alpha y_{t} + (1 - \alpha)(\ell_{t-1} + b_{t-1}) \\ \text{Trend equation} & & b_{t} & = \beta^*(\ell_{t} - \ell_{t-1}) + (1 - \beta^*)b_{t-1}, \end{align*} where \ell_t denotes an estimate of the level of the series at time t, b_t denotes an estimate of the trend (slope) of the series at time t, \alpha is the smoothing parameter for the level, 0 \le \alpha \le 1, and \beta^* is the smoothing parameter for the trend, 0 \le \beta^* \le 1. (We denote this as \beta^* instead of \beta for reasons that will be explained in Section 7.5.)
As with simple exponential smoothing, the level equation here shows that \ell_t is a weighted average of observation y_t and the one-step-ahead training forecast for time t, here given by \ell_{t-1} + b_{t-1}. The trend equation shows that b_t is a weighted average of the estimated trend at time t based on \ell_{t} - \ell_{t-1} and b_{t-1}, the previous estimate of the trend.
The forecast function is no longer flat but trending. The h-step-ahead forecast is equal to the last estimated level plus h times the last estimated trend value. Hence the forecasts are a linear function of h.
air <- window(ausair, start = 1990)
fc <- holt(air, h = 5)In Table 7.3 we demonstrate the application of Holt’s method to annual passenger numbers for Australian airlines. The smoothing parameters, \alpha and \beta^*, and the initial values \ell_0 and b_0 are estimated by minimising the SSE for the one-step training errors as in Section 7.1.
| Year | Time | Observation | Level | Slope | Forecast |
|---|---|---|---|---|---|
| t | y_t | \ell_t | b_t | \hat{y}_{t\vert t-1} | |
| 1989 | 0 | 15.57 | 2.102 | ||
| 1990 | 1 | 17.55 | 17.57 | 2.102 | 17.67 |
| 1991 | 2 | 21.86 | 21.49 | 2.102 | 19.68 |
| 1992 | 3 | 23.89 | 23.84 | 2.102 | 23.59 |
| 1993 | 4 | 26.93 | 26.76 | 2.102 | 25.94 |
| 1994 | 5 | 26.89 | 27.22 | 2.102 | 28.86 |
| 1995 | 6 | 28.83 | 28.92 | 2.102 | 29.33 |
| 1996 | 7 | 30.08 | 30.24 | 2.102 | 31.02 |
| 1997 | 8 | 30.95 | 31.19 | 2.102 | 32.34 |
| 1998 | 9 | 30.19 | 30.71 | 2.101 | 33.29 |
| 1999 | 10 | 31.58 | 31.79 | 2.101 | 32.81 |
| 2000 | 11 | 32.58 | 32.80 | 2.101 | 33.89 |
| 2001 | 12 | 33.48 | 33.72 | 2.101 | 34.90 |
| 2002 | 13 | 39.02 | 38.48 | 2.101 | 35.82 |
| 2003 | 14 | 41.39 | 41.25 | 2.101 | 40.58 |
| 2004 | 15 | 41.60 | 41.89 | 2.101 | 43.35 |
| 2005 | 16 | 44.66 | 44.54 | 2.101 | 44.00 |
| 2006 | 17 | 46.95 | 46.90 | 2.101 | 46.65 |
| 2007 | 18 | 48.73 | 48.78 | 2.101 | 49.00 |
| 2008 | 19 | 51.49 | 51.38 | 2.101 | 50.88 |
| 2009 | 20 | 50.03 | 50.61 | 2.101 | 53.49 |
| 2010 | 21 | 60.64 | 59.30 | 2.102 | 52.72 |
| 2011 | 22 | 63.36 | 63.03 | 2.102 | 61.40 |
| 2012 | 23 | 66.36 | 66.15 | 2.102 | 65.13 |
| 2013 | 24 | 68.20 | 68.21 | 2.102 | 68.25 |
| 2014 | 25 | 68.12 | 68.49 | 2.102 | 70.31 |
| 2015 | 26 | 69.78 | 69.92 | 2.102 | 70.60 |
| 2016 | 27 | 72.60 | 72.50 | 2.102 | 72.02 |
| h | \hat{y}_{t+h\vert t} | ||||
| 1 | 74.60 | ||||
| 2 | 76.70 | ||||
| 3 | 78.80 | ||||
| 4 | 80.91 | ||||
| 5 | 83.01 |
The very small value of \beta^* means that the slope hardly changes over time.
The forecasts generated by Holt’s linear method display a constant trend (increasing or decreasing) indefinitely into the future. Empirical evidence indicates that these methods tend to over-forecast, especially for longer forecast horizons. Motivated by this observation, Gardner & McKenzie (1985) introduced a parameter that “dampens” the trend to a flat line some time in the future. Methods that include a damped trend have proven to be very successful, and are arguably the most popular individual methods when forecasts are required automatically for many series.
In conjunction with the smoothing parameters \alpha and \beta^* (with values between 0 and 1 as in Holt’s method), this method also includes a damping parameter 0 < \phi < 1: \begin{align*} \hat{y}_{t+h|t} & = \ell_{t} + (\phi + \phi^2 + \dots + \phi^{h})b_{t} \\ \ell_{t} & = \alpha y_{t} + (1 - \alpha)(\ell_{t-1} + \phi b_{t-1}) \\ b_{t} & = \beta^*(\ell_{t} - \ell_{t-1}) + (1 - \beta^*)\phi b_{t-1}. \end{align*} If \phi = 1, the method is identical to Holt’s linear method. For values between 0 and 1, \phi dampens the trend so that it approaches a constant some time in the future. In fact, the forecasts converge to \ell_T + \phi b_T/(1 - \phi) as h \rightarrow \infty for any value 0 < \phi < 1. This means that short-run forecasts are trended while long-run forecasts are constant.
In practice, \phi is rarely less than 0.8 as the damping has a very strong effect for smaller values. Values of \phi close to 1 will mean that a damped model is not able to be distinguished from a non-damped model. For these reasons, we usually restrict \phi to a minimum of 0.8 and a maximum of 0.98.
Figure 7.3 shows the forecasts for years 2017–2031 generated from Holt’s linear trend method and the damped trend method.
fc <- holt(air, h = 15)
fc2 <- holt(air, damped = TRUE, phi = 0.9, h = 15)
autoplot(air) +
autolayer(fc, series = "Holt's method", PI = FALSE) +
autolayer(fc2, series = "Damped Holt's method", PI = FALSE) +
ggtitle("Forecasts from Holt's method") +
xlab("Year") +
ylab("Air passengers in Australia (millions)") +
guides(colour = guide_legend(title = "Forecast"))
We have set the damping parameter to a relatively low number (\phi = 0.90) to exaggerate the effect of damping for comparison. Usually, we would estimate \phi along with the other parameters. We have also used a rather large forecast horizon (h = 15) to highlight the difference between a damped trend and a linear trend. In practice, we would not normally want to forecast so many years ahead with only 27 years of data.
In this example, we compare the forecasting performance of the three exponential smoothing methods that we have considered so far in forecasting the sheep livestock population in Asia. The data spans the period 1961–2007 and is shown in Figure 7.4.
autoplot(livestock) +
xlab("Year") +
ylab("Livestock, sheep in Asia (millions)")
We will use time series cross-validation to compare the one-step forecast accuracy of the three methods.
e1 <- tsCV(livestock, ses, h = 1)
e2 <- tsCV(livestock, holt, h = 1)
e3 <- tsCV(livestock, holt, damped = TRUE, h = 1)
# Compare MSE:
mean(e1^2, na.rm = TRUE)[1] 178.3
mean(e2^2, na.rm = TRUE)[1] 173.4
mean(e3^2, na.rm = TRUE)[1] 162.6
# Compare MAE:
mean(abs(e1), na.rm = TRUE)[1] 8.532
mean(abs(e2), na.rm = TRUE)[1] 8.803
mean(abs(e3), na.rm = TRUE)[1] 8.024
Damped Holt’s method is best whether you compare MAE or MSE values. So we will proceed with using the damped Holt’s method and apply it to the whole data set to get forecasts for future years.
fc <- holt(livestock, damped = TRUE)
# Estimated parameters:
fc[["model"]]Damped Holt's method
Call:
holt(y = livestock, damped = TRUE)
Smoothing parameters:
alpha = 0.9999
beta = 3e-04
phi = 0.9798
Initial states:
l = 223.35
b = 6.9046
sigma: 12.84
AIC AICc BIC
427.6 429.7 438.7
The smoothing parameter for the slope is estimated to be essentially zero, indicating that the trend is not changing over time. The value of \alpha is very close to one, showing that the level reacts strongly to each new observation.
autoplot(fc) +
xlab("Year") +
ylab("Livestock, sheep in Asia (millions)")
The resulting forecasts look sensible with increasing trend, and relatively wide prediction intervals reflecting the variation in the historical data. The prediction intervals are calculated using the methods described in Section 7.7.
In this example, the process of selecting a method was relatively easy as both MSE and MAE comparisons suggested the same method (damped Holt’s). However, sometimes different accuracy measures will suggest different forecasting methods, and then a decision is required as to which forecasting method we prefer to use. As forecasting tasks can vary by many dimensions (length of forecast horizon, size of test set, forecast error measures, frequency of data, etc.), it is unlikely that one method will be better than all others for all forecasting scenarios. What we require from a forecasting method are consistently sensible forecasts, and these should be frequently evaluated against the task at hand.
Holt (1957) and Winters (1960) extended Holt’s method to capture seasonality. The Holt-Winters seasonal method comprises the forecast equation and three smoothing equations — one for the level \ell_t, one for the trend b_t, and one for the seasonal component s_t, with corresponding smoothing parameters \alpha, \beta^* and \gamma. We use m to denote the frequency of the seasonality, i.e., the number of seasons in a year. For example, for quarterly data m = 4, and for monthly data m = 12.
There are two variations to this method that differ in the nature of the seasonal component. The additive method is preferred when the seasonal variations are roughly constant through the series, while the multiplicative method is preferred when the seasonal variations are changing proportional to the level of the series. With the additive method, the seasonal component is expressed in absolute terms in the scale of the observed series, and in the level equation the series is seasonally adjusted by subtracting the seasonal component. Within each year, the seasonal component will add up to approximately zero. With the multiplicative method, the seasonal component is expressed in relative terms (percentages), and the series is seasonally adjusted by dividing through by the seasonal component. Within each year, the seasonal component will sum up to approximately m.
The component form for the additive method is: \begin{align*} \hat{y}_{t+h|t} & = \ell_{t} + hb_{t} + s_{t+h-m(k+1)} \\ \ell_{t} & = \alpha(y_{t} - s_{t-m}) + (1 - \alpha)(\ell_{t-1} + b_{t-1}) \\ b_{t} & = \beta^*(\ell_{t} - \ell_{t-1}) + (1 - \beta^*)b_{t-1} \\ s_{t} & = \gamma (y_{t} - \ell_{t-1} - b_{t-1}) + (1 - \gamma)s_{t-m}, \end{align*} where k is the integer part of (h - 1)/m, which ensures that the estimates of the seasonal indices used for forecasting come from the final year of the sample. The level equation shows a weighted average between the seasonally adjusted observation (y_{t} - s_{t-m}) and the non-seasonal forecast (\ell_{t-1} + b_{t-1}) for time t. The trend equation is identical to Holt’s linear method. The seasonal equation shows a weighted average between the current seasonal index, (y_{t} - \ell_{t-1} - b_{t-1}), and the seasonal index of the same season last year (i.e., m time periods ago).
The equation for the seasonal component is often expressed as s_{t} = \gamma^* (y_{t} - \ell_{t}) + (1 - \gamma^*)s_{t-m}. If we substitute \ell_t from the smoothing equation for the level of the component form above, we get s_{t} = \gamma^*(1 - \alpha) (y_{t} - \ell_{t-1} - b_{t-1}) + [1 - \gamma^*(1 - \alpha)]s_{t-m}, which is identical to the smoothing equation for the seasonal component we specify here, with \gamma = \gamma^*(1 - \alpha). The usual parameter restriction is 0 \le \gamma^* \le 1, which translates to 0 \le \gamma \le 1 - \alpha.
The component form for the multiplicative method is: \begin{align*} \hat{y}_{t+h|t} & = (\ell_{t} + hb_{t})s_{t+h-m(k+1)} \\ \ell_{t} & = \alpha \frac{y_{t}}{s_{t-m}} + (1 - \alpha)(\ell_{t-1} + b_{t-1}) \\ b_{t} & = \beta^*(\ell_{t} - \ell_{t-1}) + (1 - \beta^*)b_{t-1} \\ s_{t} & = \gamma \frac{y_{t}}{(\ell_{t-1} + b_{t-1})} + (1 - \gamma)s_{t-m} \end{align*}
We apply Holt-Winters’ method with both additive and multiplicative seasonality to forecast quarterly visitor nights in Australia spent by international tourists. Figure 7.6 shows the data from 2005, and the forecasts for 2016–2017. The data show an obvious seasonal pattern, with peaks observed in the March quarter of each year, corresponding to the Australian summer.
aust <- window(austourists, start = 2005)
fit1 <- hw(aust, seasonal = "additive")
fit2 <- hw(aust, seasonal = "multiplicative")
autoplot(aust) +
autolayer(fit1, series = "HW additive forecasts", PI = FALSE) +
autolayer(fit2, series = "HW multiplicative forecasts", PI = FALSE) +
xlab("Year") +
ylab("Visitor nights (millions)") +
ggtitle("International visitors nights in Australia") +
guides(colour = guide_legend(title = "Forecast"))
| t | y_t | \ell_t | b_t | s_t | \hat{y}_t | |
|---|---|---|---|---|---|---|
| 2004 Q1 | -3 | 9.70 | ||||
| 2004 Q2 | -2 | -9.31 | ||||
| 2004 Q3 | -1 | -1.69 | ||||
| 2004 Q4 | 0 | 32.26 | 0.70 | 1.31 | ||
| 2005 Q1 | 1 | 42.21 | 32.82 | 0.70 | 9.50 | 42.66 |
| 2005 Q2 | 2 | 24.65 | 33.66 | 0.70 | -9.13 | 24.21 |
| 2005 Q3 | 3 | 32.67 | 34.36 | 0.70 | -1.69 | 32.67 |
| 2005 Q4 | 4 | 37.26 | 35.33 | 0.70 | 1.69 | 36.37 |
| ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | |
| 2015 Q1 | 41 | 73.26 | 59.96 | 0.70 | 12.18 | 69.05 |
| 2015 Q2 | 42 | 47.70 | 60.69 | 0.70 | -13.02 | 47.59 |
| 2015 Q3 | 43 | 61.10 | 61.96 | 0.70 | -1.35 | 59.24 |
| 2015 Q4 | 44 | 66.06 | 63.22 | 0.70 | 2.35 | 64.22 |
| h | \hat{y}_{T+h\vert T} | |||||
| 2016 Q1 | 1 | 76.10 | ||||
| 2016 Q2 | 2 | 51.60 | ||||
| 2016 Q3 | 3 | 63.97 | ||||
| 2016 Q4 | 4 | 68.37 | ||||
| 2017 Q1 | 5 | 78.90 | ||||
| 2017 Q2 | 6 | 54.41 | ||||
| 2017 Q3 | 7 | 66.77 | ||||
| 2017 Q4 | 8 | 71.18 |
| t | y_t | \ell_t | b_t | s_t | \hat{y}_t | |
|---|---|---|---|---|---|---|
| 2004 Q1 | -3 | 1.24 | ||||
| 2004 Q2 | -2 | 0.77 | ||||
| 2004 Q3 | -1 | 0.96 | ||||
| 2004 Q4 | 0 | 32.49 | 0.70 | 1.02 | ||
| 2005 Q1 | 1 | 42.21 | 33.51 | 0.71 | 1.24 | 41.29 |
| 2005 Q2 | 2 | 24.65 | 33.24 | 0.68 | 0.77 | 26.36 |
| 2005 Q3 | 3 | 32.67 | 33.94 | 0.68 | 0.96 | 32.62 |
| 2005 Q4 | 4 | 37.26 | 35.40 | 0.70 | 1.02 | 35.44 |
| ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | |
| 2015 Q1 | 41 | 73.26 | 58.57 | 0.66 | 1.24 | 72.59 |
| 2015 Q2 | 42 | 47.70 | 60.42 | 0.69 | 0.77 | 45.62 |
| 2015 Q3 | 43 | 61.10 | 62.17 | 0.72 | 0.96 | 58.77 |
| 2015 Q4 | 44 | 66.06 | 63.62 | 0.75 | 1.02 | 64.38 |
| h | \hat{y}_{T+h\vert T} | |||||
| 2016 Q1 | 1 | 80.09 | ||||
| 2016 Q2 | 2 | 50.15 | ||||
| 2016 Q3 | 3 | 63.34 | ||||
| 2016 Q4 | 4 | 68.18 | ||||
| 2017 Q1 | 5 | 83.80 | ||||
| 2017 Q2 | 6 | 52.45 | ||||
| 2017 Q3 | 7 | 66.21 | ||||
| 2017 Q4 | 8 | 71.23 |
The applications of both methods (with additive and multiplicative seasonality) are presented in Tables 7.4 and 7.5 respectively. Because both methods have exactly the same number of parameters to estimate, we can compare the training RMSE from both models. In this case, the method with multiplicative seasonality fits the data best. This was to be expected, as the time plot shows that the seasonal variation in the data increases as the level of the series increases. This is also reflected in the two sets of forecasts; the forecasts generated by the method with the multiplicative seasonality display larger and increasing seasonal variation as the level of the forecasts increases compared to the forecasts generated by the method with additive seasonality.
The estimated states for both models are plotted in Figure 7.7. The small value of \gamma for the multiplicative model means that the seasonal component hardly changes over time. The small value of \beta^{*} for the additive model means the slope component hardly changes over time (check the vertical scale). The increasing size of the seasonal component for the additive model suggests that the model is less appropriate than the multiplicative model.
Damping is possible with both additive and multiplicative Holt-Winters’ methods. A method that often provides accurate and robust forecasts for seasonal data is the Holt-Winters method with a damped trend and multiplicative seasonality: \begin{align*} \hat{y}_{t+h|t} & = \left[ \ell_{t} + (\phi + \phi^2 + \dots + \phi^{h})b_{t} \right]s_{t+h-m(k+1)}. \\ \ell_{t} & = \alpha(y_{t} / s_{t-m}) + (1 - \alpha)(\ell_{t-1} + \phi b_{t-1}) \\ b_{t} & = \beta^*(\ell_{t} - \ell_{t-1}) + (1 - \beta^*)\phi b_{t-1} \\ s_{t} & = \gamma \frac{y_{t}}{(\ell_{t-1} + \phi b_{t-1})} + (1 - \gamma)s_{t-m}. \end{align*}
hw(y, damped = TRUE, seasonal = "multiplicative")The Holt-Winters method can also be used for daily type of data, where the seasonal period is m = 7, and the appropriate unit of time for h is in days. Here, we generate daily forecasts for the last five weeks for the hyndsight data, which contains the daily pageviews on the Hyndsight blog for one year starting April 30, 2014.
fc <- hw(
subset(hyndsight, end = length(hyndsight) - 35),
damped = TRUE,
seasonal = "multiplicative",
h = 35
)
autoplot(hyndsight) +
autolayer(fc, series = "HW multi damped", PI = FALSE) +
guides(colour = guide_legend(title = "Daily forecasts"))
Clearly the model has identified the weekly seasonal pattern and the increasing trend at the end of the data, and the forecasts are a close match to the test data.
Exponential smoothing methods are not restricted to those we have presented so far. By considering variations in the combinations of the trend and seasonal components, nine exponential smoothing methods are possible, listed in Table 7.6. Each method is labelled by a pair of letters (T,S) defining the type of ‘Trend’ and ‘Seasonal’ components. For example, (A,M) is the method with an additive trend and multiplicative seasonality; (A_d,N) is the method with damped trend and no seasonality; and so on.
| N | A | M | |
|---|---|---|---|
| (None) | (Additive) | (Multiplicative) | |
| N (None) | (N,N) | (N,A) | (N,M) |
| A (Additive) | (A,N) | (A,A) | (A,M) |
| A_d (Additive damped) | (A_d,N) | (A_d,A) | (A_d,M) |
Some of these methods we have already seen using other names:
| Short hand | Method |
|---|---|
| (N,N) | Simple exponential smoothing |
| (A,N) | Holt’s linear method |
| (A_d,N) | Additive damped trend method |
| (A,A) | Additive Holt-Winters’ method |
| (A,M) | Multiplicative Holt-Winters’ method |
| (A_d,M) | Holt-Winters’ damped method |
This type of classification was first proposed by Pegels (1969), who also included a method with a multiplicative trend. It was later extended by Gardner (1985) to include methods with an additive damped trend and by Taylor (2003) to include methods with a multiplicative damped trend. We do not consider the multiplicative trend methods in this book as they tend to produce poor forecasts. See Hyndman et al. (2008) for a more thorough discussion of all exponential smoothing methods.
Table 7.7 gives the recursive formulas for applying the nine exponential smoothing methods in Table 7.6. Each cell includes the forecast equation for generating h-step-ahead forecasts, and the smoothing equations for applying the method.
| Trend | Seasonal | ||
|---|---|---|---|
| N | A | M | |
| N | \hat{y}_{t+h|t} = \ell_t \ell_t = \alpha y_t + (1-\alpha) \ell_{t-1} | \hat{y}_{t+h|t} = \ell_t + s_{t+h-m(k+1)} \ell_t = \alpha (y_t - s_{t-m}) + (1-\alpha) \ell_{t-1} s_t = \gamma (y_t - \ell_{t-1}) + (1-\gamma) s_{t-m} | \hat{y}_{t+h|t}= \ell_ts_{t+h-m(k+1)} \ell_t = \alpha (y_t / s_{t-m}) + (1-\alpha) \ell_{t-1} s_t = \gamma (y_t / \ell_{t-1}) + (1-\gamma) s_{t-m} |
| A | \hat{y}_{t+h|t} = \ell_t+hb_t \ell_t = \alpha y_t + (1-\alpha) (\ell_{t-1}+b_{t-1}) b_t = \beta^* (\ell_t-\ell_{t-1}) + (1-\beta^*) b_{t-1} | \hat{y}_{t+h|t} = \ell_t +hb_t +s_{t+h-m(k+1)} \ell_t = \alpha (y_t - s_{t-m}) + (1-\alpha)(\ell_{t-1}+b_{t-1}) b_t = \beta^* (\ell_t-\ell_{t-1}) + (1-\beta^*) b_{t-1} s_t = \gamma (y_t - \ell_{t-1}-b_{t-1}) + (1-\gamma)s_{t-m} | \hat{y}_{t+h|t}= (\ell_t+hb_t)s_{t+h-m(k+1)} \ell_t = \alpha (y_t / s_{t-m}) + (1-\alpha)(\ell_{t-1}+b_{t-1}) b_t = \beta^* (\ell_t-\ell_{t-1}) + (1-\beta^*) b_{t-1} s_t = \gamma (y_t / (\ell_{t-1}+b_{t-1})) + (1-\gamma)s_{t-m} |
| Ad | \hat{y}_{t+h|t} = \ell_t+\phi_h b_t \ell_t = \alpha y_t + (1-\alpha) (\ell_{t-1}+\phi b_{t-1}) b_t = \beta^* (\ell_t-\ell_{t-1}) + (1-\beta^*) \phi b_{t-1} | \hat{y}_{t+h|t} = \ell_t+\phi_h b_t+s_{t+h-m(k+1)} \ell_t = \alpha (y_t - s_{t-m}) + (1-\alpha) (\ell_{t-1}+\phi b_{t-1}) b_t = \beta^* (\ell_t-\ell_{t-1}) + (1-\beta^*) \phi b_{t-1} s_t = \gamma (y_t - \ell_{t-1}-\phi b_{t-1}) + (1-\gamma)s_{t-m} | \hat{y}_{t+h|t}= (\ell_t+\phi_h b_t)s_{t+h-m(k+1)} \ell_t = \alpha (y_t / s_{t-m}) + (1-\alpha) (\ell_{t-1}+\phi b_{t-1}) b_t = \beta^* (\ell_t-\ell_{t-1}) + (1-\beta^*) \phi b_{t-1} s_t = \gamma (y_t / (\ell_{t-1}+\phi b_{t-1})) + (1-\gamma)s_{t-m} |
In the rest of this chapter, we study the statistical models that underlie the exponential smoothing methods we have considered so far. The exponential smoothing methods presented in Table 7.7 are algorithms which generate point forecasts. The statistical models in this section generate the same point forecasts, but can also generate prediction (or forecast) intervals. A statistical model is a stochastic (or random) data generating process that can produce an entire forecast distribution. We will also describe how to use the model selection criteria introduced in Chapter 5 to choose the model in an objective manner.
Each model consists of a measurement equation that describes the observed data, and some state equations that describe how the unobserved components or states (level, trend, seasonal) change over time. Hence, these are referred to as state space models.
For each method there exist two models: one with additive errors and one with multiplicative errors. The point forecasts produced by the models are identical if they use the same smoothing parameter values. They will, however, generate different prediction intervals.
To distinguish between a model with additive errors and one with multiplicative errors (and also to distinguish the models from the methods), we add a third letter to the classification of Table 7.6. We label each state space model as ETS(\cdot,\cdot,\cdot) for (Error, Trend, Seasonal). This label can also be thought of as ExponenTial Smoothing. Using the same notation as in Table 7.6, the possibilities for each component are: Error = \{A,M\}, Trend = \{N,A,A_d\} and Seasonal = \{N,A,M\}.
Recall the component form of simple exponential smoothing: \begin{align*} \text{Forecast equation} & & \hat{y}_{t+1|t} & = \ell_{t} \\ \text{Smoothing equation} & & \ell_{t} & = \alpha y_{t} + (1 - \alpha)\ell_{t-1}, \end{align*} If we re-arrange the smoothing equation for the level, we get the “error correction” form: \begin{align*} \ell_{t} %&= \alpha y_{t}+\ell_{t-1}-\alpha\ell_{t-1}\\ & = \ell_{t-1} + \alpha( y_{t} - \ell_{t-1}) \\ & = \ell_{t-1} + \alpha e_{t} \end{align*} where e_{t} = y_{t} - \ell_{t-1} = y_{t} - \hat{y}_{t|t-1} is the residual at time t.
The training data errors lead to the adjustment of the estimated level throughout the smoothing process for t = 1,\dots,T. For example, if the error at time t is negative, then y_t < \hat{y}_{t|t-1} and so the level at time t - 1 has been over-estimated. The new level \ell_t is then the previous level \ell_{t-1} adjusted downwards. The closer \alpha is to one, the “rougher” the estimate of the level (large adjustments take place). The smaller the \alpha, the “smoother” the level (small adjustments take place).
We can also write y_t = \ell_{t-1} + e_t, so that each observation can be represented by the previous level plus an error. To make this into an innovations state space model, all we need to do is specify the probability distribution for e_t. For a model with additive errors, we assume that residuals (the one-step training errors) e_t are normally distributed white noise with mean 0 and variance \sigma^2. A short-hand notation for this is e_t = \varepsilon_t \sim \text{NID}(0,\sigma^2); NID stands for “normally and independently distributed”.
Then the equations of the model can be written as \begin{align} y_t & = \ell_{t-1} + \varepsilon_t \\ \ell_t & = \ell_{t-1} + \alpha \varepsilon_t. \end{align} \tag{7.3} We refer to the first line of these equations as the measurement (or observation) equation and the second line as the state (or transition) equation. These two equations, together with the statistical distribution of the errors, form a fully specified statistical model. Specifically, these constitute an innovations state space model underlying simple exponential smoothing.
The term “innovations” comes from the fact that all equations use the same random error process, \varepsilon_t. For the same reason, this formulation is also referred to as a “single source of error” model. There are alternative multiple source of error formulations which we do not present here.
The measurement equation shows the relationship between the observations and the unobserved states. In this case, observation y_t is a linear function of the level \ell_{t-1}, the predictable part of y_t, and the error \varepsilon_t, the unpredictable part of y_t. For other innovations state space models, this relationship may be nonlinear.
The state equation shows the evolution of the state through time. The influence of the smoothing parameter \alpha is the same as for the methods discussed earlier. For example, \alpha governs the amount of change in successive levels: high values of \alpha allow rapid changes in the level; low values of \alpha lead to smooth changes. If \alpha = 0, the level of the series does not change over time; if \alpha = 1, the model reduces to a random walk model, y_t = y_{t-1} + \varepsilon_t. (See Section 8.1 for a discussion of this model.)
In a similar fashion, we can specify models with multiplicative errors by writing the one-step-ahead training errors as relative errors: \varepsilon_t = \frac{y_t - \hat{y}_{t|t-1}}{\hat{y}_{t|t-1}} where \varepsilon_t \sim \text{NID}(0,\sigma^2). Substituting \hat{y}_{t|t-1} = \ell_{t-1} gives y_t = \ell_{t-1} + \ell_{t-1}\varepsilon_t and e_t = y_t - \hat{y}_{t|t-1} = \ell_{t-1}\varepsilon_t.
Then we can write the multiplicative form of the state space model as \begin{align*} y_t & = \ell_{t-1}(1 + \varepsilon_t) \\ \ell_t & = \ell_{t-1}(1 + \alpha \varepsilon_t). \end{align*}
For this model, we assume that the one-step-ahead training errors are given by \varepsilon_t = y_t - \ell_{t-1} - b_{t-1} \sim \text{NID}(0,\sigma^2). Substituting this into the error correction equations for Holt’s linear method we obtain \begin{align*} y_t & = \ell_{t-1} + b_{t-1} + \varepsilon_t \\ \ell_t & = \ell_{t-1} + b_{t-1} + \alpha \varepsilon_t \\ b_t & = b_{t-1} + \beta \varepsilon_t, \end{align*} where, for simplicity, we have set \beta = \alpha \beta^*.
Specifying one-step-ahead training errors as relative errors such that \varepsilon_t = \frac{y_t - (\ell_{t-1} + b_{t-1})}{(\ell_{t-1} + b_{t-1})} and following an approach similar to that used above, the innovations state space model underlying Holt’s linear method with multiplicative errors is specified as \begin{align*} y_t & = (\ell_{t-1} + b_{t-1})(1 + \varepsilon_t) \\ \ell_t & = (\ell_{t-1} + b_{t-1})(1 + \alpha \varepsilon_t) \\ b_t & = b_{t-1} + \beta(\ell_{t-1} + b_{t-1}) \varepsilon_t \end{align*}
where again \beta = \alpha \beta^* and \varepsilon_t \sim \text{NID}(0,\sigma^2).
In a similar fashion, we can write an innovations state space model for each of the exponential smoothing methods of Table 7.7. Table 7.8 presents the equations for all of the models in the ETS framework.
| Additive error models | |||
| Trend | Seasonal | ||
|---|---|---|---|
| N | A | M | |
| N | y_{t} = \ell_{t-1}+\varepsilon_t \ell_t = \ell_{t-1} + \alpha \varepsilon_t | y_{t} = \ell_{t-1} + s_{t-m}+\varepsilon_t \ell_t = \ell_{t-1} + \alpha \varepsilon_t s_t = s_{t-m} + \gamma \varepsilon_t | y_{t} = \ell_{t-1} s_{t-m}+\varepsilon_t \ell_t = \ell_{t-1} + \alpha \varepsilon_t/s_{t-m} s_t = s_{t-m} + \gamma \varepsilon_t/\ell_{t-1} |
| A | y_{t} = \ell_{t-1} + b_{t-1}+\varepsilon_t \ell_t = \ell_{t-1} + b_{t-1} + \alpha \varepsilon_t b_t = b_{t-1} + \beta \varepsilon_t | y_{t} = \ell_{t-1} + b_{t-1} + s_{ t-m}+\varepsilon_t \ell_t = \ell_{t-1} + b_{t-1} + \alpha \varepsilon_t b_t = b_{t-1} + \beta \varepsilon_t s_t = s_{t-m} + \gamma \varepsilon_t | y_{t} = (\ell_{t-1}+b_{t-1})s_{t-m}+\varepsilon_t \ell_t = \ell_{t-1} + b_{t-1} + \alpha \varepsilon_t/s_{t-m} b_t = b_{t-1} + \beta \varepsilon_t/s_{t-m} s_t = s_{t-m} + \gamma \varepsilon_t/(\ell_{t-1}+b_{t-1}) |
| Ad | y_{t} = \ell_{t-1} + \phi b_{t-1}+\varepsilon_t \ell_t = \ell_{t-1} + \phi b_{t-1} + \alpha \varepsilon_t b_t = \phi b_{t-1} + \beta \varepsilon_t | y_{t} = \ell_{t-1} + \phi b_{t-1} + s_{t-m}+\varepsilon_t \ell_t = \ell_{t-1} + \phi b_{t-1} + \alpha \varepsilon_t b_t = \phi b_{t-1} + \beta \varepsilon_t s_t = s_{t-m} + \gamma \varepsilon_t | y_{t} = (\ell_{t-1} + \phi b_{t-1})s_{t-m}+\varepsilon_t \ell_t = \ell_{t-1} + \phi b_{t-1} + \alpha \varepsilon_t/s_{t-m} b_t = \phi b_{t-1} + \beta \varepsilon_t/s_{t-m} s_t = s_{t-m} + \gamma \varepsilon_t/(\ell_{t-1}+\phi b_{t-1}) |
| Multiplicative error models | |||
| Trend | Seasonal | ||
| N | A | M | |
| N | y_{t} = \ell_{t-1}(1 + \varepsilon_t) \ell_t = \ell_{t-1}(1 + \alpha \varepsilon_t) | y_{t} = (\ell_{t-1} + s_{t-m})(1 + \varepsilon_t) \ell_t = \ell_{t-1} + \alpha(\ell_{t-1} + s_{t-m}) \varepsilon_t s_t = s_{t-m} + \gamma (\ell_{t-1} + s_{t-m})\varepsilon_t | y_{t} = \ell_{t-1} s_{t-m}(1 + \varepsilon_t) \ell_t = \ell_{t-1}(1 + \alpha \varepsilon_t) s_t = s_{t-m}(1 + \gamma \varepsilon_t) |
| A | y_{t} = (\ell_{t-1} + b_{t-1})(1 + \varepsilon_t) \ell_t = (\ell_{t-1} + b_{t-1})(1 + \alpha \varepsilon_t) b_t = b_{t-1} + \beta (\ell_{t-1} + b_{t-1}) \varepsilon_t | y_{t} = (\ell_{t-1} + b_{t-1} + s_{ t-m})(1 + \varepsilon_t) \ell_t = \ell_{t-1} + b_{t-1} + \alpha (\ell_{t-1} + b_{t-1}+ s_{ t-m}) \varepsilon_t b_t = b_{t-1} + \beta (\ell_{t-1} + b_{t-1} + s_{ t-m})\varepsilon_t s_t = s_{t-m} + \gamma (\ell_{t-1} + b_{t-1} + s_{ t-m})\varepsilon_t | y_{t} = (\ell_{t-1}+b_{t-1})s_{t-m}(1 + \varepsilon_t) \ell_t = (\ell_{t-1} + b_{t-1})(1 + \alpha\varepsilon_t) b_t = b_{t-1} + \beta (\ell_{t-1}+b_{t-1})\varepsilon_t s_t = s_{t-m}(1 + \gamma \varepsilon_t) |
| Ad | y_{t} = (\ell_{t-1} + \phi b_{t-1})(1 + \varepsilon_t) \ell_t = (\ell_{t-1} + \phi b_{t-1})(1 + \alpha \varepsilon_t) b_t = \phi b_{t-1} + \beta(\ell_{t-1} + \phi b_{t-1})\varepsilon_t | y_{t} = (\ell_{t-1} + \phi b_{t-1} + s_{t-m})(1 + \varepsilon_t) \ell_t = \ell_{t-1} + \phi b_{t-1} + \alpha (\ell_{t-1}+ \phi b_{t-1} + s_{t-m}) \varepsilon_t b_t = \phi b_{t-1} + \beta (\ell_{t-1} + \phi b_{t-1} +s_{t-m})\varepsilon_t s_t = s_{t-m} + \gamma (\ell_{t-1} + \phi b_{t-1} + s_{t-m})\varepsilon_t | y_{t} = (\ell_{t-1} + \phi b_{t-1})s_{t-m}(1 + \varepsilon_t) \ell_t = (\ell_{t-1} + \phi b_{t-1})(1 + \alpha \varepsilon_t) b_t = \phi b_{t-1} + \beta (\ell_{t-1} + \phi b_{t-1})\varepsilon_t s_t = s_{t-m}(1+ \gamma \varepsilon_t) |
An alternative to estimating the parameters by minimising the sum of squared errors is to maximise the “likelihood”. The likelihood is the probability of the data arising from the specified model. Thus, a large likelihood is associated with a good model. For an additive error model, maximising the likelihood (assuming normally distributed errors) gives the same results as minimising the sum of squared errors. However, different results will be obtained for multiplicative error models. In this section, we will estimate the smoothing parameters \alpha, \beta, \gamma and \phi, and the initial states \ell_0, b_0, s_0,s_{-1},\dots,s_{-m+1}, by maximising the likelihood.
The possible values that the smoothing parameters can take are restricted. Traditionally, the parameters have been constrained to lie between 0 and 1 so that the equations can be interpreted as weighted averages. That is, 0 < \alpha,\beta^*,\gamma^*,\phi < 1. For the state space models, we have set \beta = \alpha\beta^* and \gamma = (1 - \alpha)\gamma^*. Therefore, the traditional restrictions translate to 0 < \alpha < 1, 0 < \beta < \alpha and 0 < \gamma < 1 - \alpha. In practice, the damping parameter \phi is usually constrained further to prevent numerical difficulties in estimating the model. In R, it is restricted so that 0.8 < \phi < 0.98.
Another way to view the parameters is through a consideration of the mathematical properties of the state space models. The parameters are constrained in order to prevent observations in the distant past having a continuing effect on current forecasts. This leads to some admissibility constraints on the parameters, which are usually (but not always) less restrictive than the traditional constraints region (Hyndman et al., 2008, pCh10). For example, for the ETS(A,N,N) model, the traditional parameter region is 0 < \alpha < 1 but the admissible region is 0 < \alpha < 2. For the ETS(A,A,N) model, the traditional parameter region is 0 < \alpha < 1 and 0 < \beta < \alpha but the admissible region is 0 < \alpha < 2 and 0 < \beta < 4 - 2\alpha.
A great advantage of the ETS statistical framework is that information criteria can be used for model selection. The AIC, AIC_{\text{c}} and BIC, introduced in Section 5.5, can be used here to determine which of the ETS models is most appropriate for a given time series.
For ETS models, Akaike’s Information Criterion (AIC) is defined as \text{AIC} = -2\log(L) + 2k, where L is the likelihood of the model and k is the total number of parameters and initial states that have been estimated (including the residual variance).
The AIC corrected for small sample bias (AIC_\text{c}) is defined as \text{AIC}_{\text{c}} = \text{AIC} + \frac{2k(k + 1)}{T - k - 1}, and the Bayesian Information Criterion (BIC) is \text{BIC} = \text{AIC} + k[\log(T) - 2].
Three of the combinations of (Error, Trend, Seasonal) can lead to numerical difficulties. Specifically, the models that can cause such instabilities are ETS(A,N,M), ETS(A,A,M), and ETS(A,A_d,M), due to division by values potentially close to zero in the state equations. We normally do not consider these particular combinations when selecting a model.
Models with multiplicative errors are useful when the data are strictly positive, but are not numerically stable when the data contain zeros or negative values. Therefore, multiplicative error models will not be considered if the time series is not strictly positive. In that case, only the six fully additive models will be applied.
ets() function in RThe models can be estimated in R using the ets() function in the forecast package. Unlike the ses(), holt() and hw() functions, the ets() function does not produce forecasts. Rather, it estimates the model parameters and returns information about the fitted model. By default it uses the AICc to select an appropriate model, although other information criteria can be selected.
The R code below shows the most important arguments that this function can take, and their default values. If only the time series is specified, and all other arguments are left at their default values, then an appropriate model will be selected automatically. We explain the arguments below. See the help file for a complete description.
ets(
y,
model = "ZZZ",
damped = NULL,
alpha = NULL,
beta = NULL,
gamma = NULL,
phi = NULL,
lambda = NULL,
biasadj = FALSE,
additive.only = FALSE,
restrict = TRUE,
allow.multiplicative.trend = FALSE
)ymodelZZZ ensures that all components are selected using the information criterion.
dampeddamped=TRUE, then a damped trend will be used (either A or M). If damped=FALSE, then a non-damped trend will used. If damped=NULL (the default), then either a damped or a non-damped trend will be selected, depending on which model has the smallest value for the information criterion.
alpha, beta, gamma, phiNULL (the default setting for each of them), the parameters are estimated.
lambdalambda=NULL (the default value). Otherwise, the time series will be transformed before the model is estimated. When lambda is not NULL, additive.only is set to TRUE.
biasadjTRUE and lambda is not NULL, then the back-transformed fitted values and forecasts will be bias-adjusted.
additive.onlyadditive.only=TRUE. Otherwise, all models will be considered.
restrictrestrict=TRUE (the default), the models that cause numerical difficulties are not considered in model selection.
allow.multiplicative.trendTRUE to allow these models to be considered.
ets objectsThe ets() function will return an object of class ets. There are many R functions designed to make working with ets objects easy. A few of them are described below.
coef()accuracy()summary()autoplot() and plot()residuals()fitted()simulate()forecast()We now employ the ETS statistical framework to forecast tourist visitor nights in Australia by international arrivals over the period 2016–2019. We let the ets() function select the model by minimising the AICc.
aust <- window(austourists, start = 2005)
fit <- ets(aust)
summary(fit)ETS(M,A,M)
Call:
ets(y = aust)
Smoothing parameters:
alpha = 0.1908
beta = 0.0392
gamma = 2e-04
Initial states:
l = 32.3679
b = 0.9281
s = 1.022 0.9628 0.7683 1.247
sigma: 0.0383
AIC AICc BIC
224.9 230.2 240.9
Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set 0.04837 1.671 1.25 -0.1846 2.693 0.4095 0.2006
The model selected is ETS(M,A,M):
\begin{align*}
y_{t} & = (\ell_{t-1} + b_{t-1})s_{t-m}(1 + \varepsilon_t) \\
\ell_t & = (\ell_{t-1} + b_{t-1})(1 + \alpha \varepsilon_t) \\
b_t & = b_{t-1} + \beta(\ell_{t-1} + b_{t-1})\varepsilon_t \\
s_t & = s_{t-m}(1 + \gamma \varepsilon_t).
\end{align*}
The parameter estimates are \hat\alpha = 0.1908, \hat\beta = 0.0392, and \hat\gamma = 0.0002. The output also returns the estimates for the initial states \ell_0, b_0, s_{0}, s_{-1}, s_{-2} and s_{-3}. Compare these with the values obtained for the equivalent Holt-Winters method with multiplicative seasonality presented in Table 7.5. The ETS(M,A,M) model will give different point forecasts to the multiplicative Holt-Winters’ method, because the parameters have been estimated differently. With the ets() function, the default estimation method is maximum likelihood rather than minimum sum of squares.
Figure 7.9 shows the states over time, while Figure 7.11 shows point forecasts and prediction intervals generated from the model. The small values of \beta and \gamma mean that the slope and seasonal components change very little over time. The narrow prediction intervals indicate that the series is relatively easy to forecast due to the strong trend and seasonality.
autoplot(fit)
Because this model has multiplicative errors, the residuals are not equivalent to the one-step training errors. The residuals are given by \hat{\varepsilon}_t, while the one-step training errors are defined as y_t - \hat{y}_{t|t-1}. We can obtain both using the residuals() function.
cbind(
'Residuals' = residuals(fit),
'Forecast errors' = residuals(fit, type = 'response')
) |>
autoplot(facet = TRUE) +
xlab("Year") +
ylab("")
The type argument is used in the residuals() function to distinguish between residuals and forecast errors. The default is type='innovation' which gives regular residuals.
Point forecasts are obtained from the models by iterating the equations for t = T + 1,\dots,T + h and setting all \varepsilon_t = 0 for t > T.
For example, for model ETS(M,A,N), y_{T+1} = (\ell_T + b_T )(1 + \varepsilon_{T+1}). Therefore \hat{y}_{T+1|T} = \ell_{T} + b_{T}. Similarly, \begin{align*} y_{T+2} & = (\ell_{T+1} + b_{T+1})(1 + \varepsilon_{T+2}) \\ & = \left[ (\ell_T + b_T) (1 + \alpha\varepsilon_{T+1}) + b_T + \beta (\ell_T + b_T)\varepsilon_{T+1} \right] ( 1 + \varepsilon_{T+2}). \end{align*} Therefore, \hat{y}_{T+2|T} = \ell_{T} + 2b_{T}, and so on. These forecasts are identical to the forecasts from Holt’s linear method, and also to those from model ETS(A,A,N). Thus, the point forecasts obtained from the method and from the two models that underlie the method are identical (assuming that the same parameter values are used).
ETS point forecasts are equal to the medians of the forecast distributions. For models with only additive components, the forecast distributions are normal, so the medians and means are equal. For ETS models with multiplicative errors, or with multiplicative seasonality, the point forecasts will not be equal to the means of the forecast distributions.
To obtain forecasts from an ETS model, we use the forecast() function.
fit |>
forecast(h = 8) |>
autoplot() +
ylab("International visitor night in Australia (millions)")
A big advantage of the models is that prediction intervals can also be generated — something that cannot be done using the methods. The prediction intervals will differ between models with additive and multiplicative methods.
For most ETS models, a prediction interval can be written as \hat{y}_{T+h|T} \pm c \sigma_h where c depends on the coverage probability, and \sigma_h^2 is the forecast variance. Values for c were given in Table 3.1. For ETS models, formulas for \sigma_h^2 can be complicated; the details are given in Chapter 6 of Hyndman et al. (2008). In Table 7.9 we give the formulas for the additive ETS models, which are the simplest.
| Model | Forecast variance: \sigma_h^2 |
|---|---|
| (A,N,N) | \sigma_h^2 = \sigma^2\big[1 + \alpha^2(h-1)\big] |
| (A,A,N) | \sigma_h^2 = \sigma^2\Big[1 + (h-1)\big\{\alpha^2 + \alpha\beta h + \frac16\beta^2h(2h-1)\big\}\Big] |
| (A,A_d,N) | \sigma_h^2 = \sigma^2\biggl[1 + \alpha^2(h-1) + \frac{\beta\phi h}{(1-\phi)^2} \left\{2\alpha(1-\phi) +\beta\phi\right\} |
| {} - \frac{\beta\phi(1-\phi^h)}{(1-\phi)^2(1-\phi^2)} \left\{ 2\alpha(1-\phi^2)+ \beta\phi(1+2\phi-\phi^h)\right\}\biggr] | |
| (A,N,A) | \sigma_h^2 = \sigma^2\Big[1 + \alpha^2(h-1) + \gamma k(2\alpha+\gamma)\Big] |
| (A,A,A) | \sigma_h^2 = \sigma^2\Big[1 + (h-1)\big\{\alpha^2 + \alpha\beta h + \frac16\beta^2h(2h-1)\big\} |
| {} + \gamma k \big\{2\alpha+ \gamma + \beta m (k+1)\big\} \Big] | |
| (A,A_d,A) | \sigma_h^2 = \sigma^2\biggl[1 + \alpha^2(h-1) + \gamma k(2\alpha+\gamma) |
| {} +\frac{\beta\phi h}{(1-\phi)^2} \left\{2\alpha(1-\phi) + \beta\phi \right\} | |
| {} - \frac{\beta\phi(1-\phi^h)}{(1-\phi)^2(1-\phi^2)} \left\{ 2\alpha(1-\phi^2)+ \beta\phi(1+2\phi-\phi^h)\right\} | |
| {} + \frac{2\beta\gamma\phi}{(1-\phi)(1-\phi^m)}\left\{k(1-\phi^m) - \phi^m(1-\phi^{mk})\right\}\biggr] |
For a few ETS models, there are no known formulas for prediction intervals. In these cases, the forecast() function uses simulated future sample paths and computes prediction intervals from the percentiles of these simulated future paths.
forecast()The R code below shows the possible arguments that this function takes when applied to an ETS model. We explain each of the arguments in what follows.
forecast(
object,
h = ifelse(object$m > 1, 2 * object$m, 10),
level = c(80, 95),
fan = FALSE,
simulate = FALSE,
bootstrap = FALSE,
npaths = 5000,
PI = TRUE,
lambda = object$lambda,
biasadj = NULL,
...
)objectets() function.
hlevelfanfan=TRUE, level=seq(50,99,by=1). This is suitable for fan plots.
simulatesimulate=TRUE, prediction intervals are produced by simulation rather than using algebraic formulas. Simulation will also be used (even if simulate=FALSE) where there are no algebraic formulas available for the particular model.
bootstrapbootstrap=TRUE and simulate=TRUE, then the simulated prediction intervals use re-sampled errors rather than normally distributed errors.
npathsPIPI=TRUE, then prediction intervals are produced; otherwise only point forecasts are calculated.
lambdalambda=NULL. Otherwise, the forecasts are back-transformed via an inverse Box-Cox transformation.
biasadjlambda is not NULL, the back-transformed forecasts (and prediction intervals) are bias-adjusted.
Consider the pigs series — the number of pigs slaughtered in Victoria each month.
ses() function in R to find the optimal values of \alpha and \ell_0, and generate forecasts for the next four months.Write your own function to implement simple exponential smoothing. The function should take arguments y (the time series), alpha (the smoothing parameter \alpha) and level (the initial level \ell_0). It should return the forecast of the next observation in the series. Does it give the same forecast as ses()?
Modify your function from the previous exercise to return the sum of squared errors rather than the forecast of the next observation. Then use the optim() function to find the optimal values of \alpha and \ell_0. Do you get the same values as the ses() function?
Combine your previous two functions to produce a function which both finds the optimal values of \alpha and \ell_0, and produces a forecast of the next observation in the series.
Data set books contains the daily sales of paperback and hardcover books at the same store. The task is to forecast the next four days’ sales for paperback and hardcover books.
ses() function to forecast each series, and plot the forecasts.We will continue with the daily sales of paperback and hardcover books in data set books.
paperback and hardback series and compute four-day forecasts in each case.ses and holt.For this exercise use data set eggs, the price of a dozen eggs in the United States from 1900–1993. Experiment with the various options in the holt() function to see how much the forecasts change with damped trend, or with a Box-Cox transformation. Try to develop an intuition of what each argument is doing to the forecasts.
[Hint: use h=100 when calling holt() so you can clearly see the differences between the various options when plotting the forecasts.]
Which model gives the best RMSE?
Recall your retail time series data (from Exercise 3 in Section 2.10).
For the same retail data, try an STL decomposition applied to the Box-Cox transformed series, followed by ETS on the seasonally adjusted data. How does that compare with your best previous forecasts on the test set?
For this exercise use data set ukcars, the quarterly UK passenger vehicle production data from 1977Q1–2005Q1.
stlf() with arguments etsmodel="AAN", damped=TRUE.)damped=FALSE).ets() to choose a seasonal model for the data.For this exercise use data set visitors, the monthly Australian short-term overseas visitors data, May 1985–April 2005.
tsCV() function instead of using a training and test set. Do you come to the same conclusions?The fets() function below returns ETS forecasts.
fets <- function(y, h) {
forecast(ets(y), h = h)
}tsCV() for a forecast horizon of h = 4, for both ETS and seasonal naïve methods to the qcement data, (Hint: use the newly created fets() and the existing snaive() functions as your forecast function arguments.)Compare ets(), snaive() and stlf() on the following six time series. For stlf(), you might need to use a Box-Cox transformation. Use a test set of three years to decide what gives the best forecasts. ausbeer, bricksq, dole, a10, h02, usmelec.
ets() on the following series: bicoal, chicken, dole, usdeaths, lynx, ibmclose, eggs. Does it always give good forecasts?Show that the point forecasts from an ETS(M,A,M) model are the same as those obtained using Holt-Winters’ multiplicative method.
Show that the forecast variance for an ETS(A,N,N) model is given by \sigma^2\left[ 1 + \alpha^2(h - 1) \right].
Write down 95% prediction intervals for an ETS(A,N,N) model as a function of \ell_T, \alpha, h and \sigma, assuming normally distributed errors.
In some books it is called “single exponential smoothing”.↩︎