- Overview
- Simple methods
- Trend methods
- Seasonal methods
- Taxonomy of Exponential Smoothing Methods
- Innovations State Space Models
- Estimation and Model Selection
- Forecasting with ETS models
September 17, 2019
Time series \(y_1,y_2,\dots,y_T\).
Random walk forecast
\[ \begin{aligned} \hat{y}_{T+h|T} = y_T \end{aligned} \]
Average forecast
\[ \begin{aligned} \hat{y}_{T+h|T} = \frac1T\sum_{t=1}^T y_t \end{aligned} \]
Consider a happy median that privileges recent information…
Forecast equation \[ \begin{aligned} \hat{y}_{T+1|T} = \alpha y_T + \alpha(1-\alpha) y_{T-1} + \alpha(1-\alpha)^2 y_{T-2}+ \cdots \end{aligned} \] where \(0 \le \alpha \le1\)
Weighted moving average with weights that decrease exponentially
Component form: forecast equation \[ \begin{align*} \hat{y}_{t+h|t} = \ell_{t} \end{align*} \]
Component form: smoothing equation \[ \begin{align*} \ell_{t} = \alpha y_{t} + (1 - \alpha)\ell_{t-1} \end{align*} \]
\(\ell_t\) is level / smoothed value of series at time \(t\)
\(\hat{y}_{t+1|t} = \alpha y_t + (1-\alpha) \hat{y}_{t|t-1}\)
Iterate for exponentially weighted moving average form
Weighted average form \[ \begin{align*} \hat{y}_{T+1|T}=\sum_{j=0}^{T-1} \alpha(1-\alpha)^j y_{T-j}+(1-\alpha)^T \ell_{0} \end{align*} \]
To choose value for \(\alpha\) and \(\ell_0\), minimize SSE: \[ \begin{aligned} \text{SSE}=\sum_{t=1}^T(y_t - \hat{y}_{t|t-1})^2. \end{aligned} \]
Unlike regression, no closed-form solution so use numerical optimization
oildata <- window(oil, start=1996)
fc <- ses(oildata, h=5)
autoplot(fc) +
autolayer(fitted(fc), series="Fitted") +
ylab("Oil (millions of tonnes)") + xlab("Year")
Component form: forecast \[ \begin{align*} \hat{y}_{t+h|t} &= \ell_{t+h}b_{t} \end{align*} \]
Component form: level \[ \begin{align*} \ell_{t} &= \alpha y_{t} + (1 - \alpha)(\ell_{t-1} + b_{t-1}) \end{align*} \]
Component form: trend \[ \begin{align*} b_{t} &= \beta^*(\ell_{t} - \ell_{t-1}) + (1 -\beta^*)b_{t-1} \end{align*} \]
window(ausair, start=1990, end=2004) %>% holt(h=5, PI=FALSE) %>% autoplot()
Component form \[ \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*} \]
Holt’s method extended to capture seasonality
Component form \[ \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*} \]
When seasonal variations change in proportion to level of series
Component form
\[ \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*} \]
aust <- window(austourists,start=2005) fit1 <- hw(aust,seasonal="additive") fit2 <- hw(aust,seasonal="multiplicative")
tmp <- cbind(Data=aust,
"HW additive forecasts" = fit1[["mean"]],
"HW multiplicative forecasts" = fit2[["mean"]])
autoplot(tmp) + xlab("Year") +
ylab("International visitor night in Australia (millions)") +
scale_color_manual(name="",
values=c('#000000','#1b9e77','#d95f02'),
breaks=c("Data","HW additive forecasts","HW multiplicative forecasts"))
addstates <- fit1$model$states[,1:3]
multstates <- fit2$model$states[,1:3]
colnames(addstates) <- colnames(multstates) <-
c("level","slope","season")
p1 <- autoplot(addstates, facets=TRUE) + xlab("Year") +
ylab("") + ggtitle("Additive states")
p2 <- autoplot(multstates, facets=TRUE) + xlab("Year") +
ylab("") + ggtitle("Multiplicative states")
gridExtra::grid.arrange(p1,p2,ncol=2)
\[ \begin{align*} \hat{y}_{t+h|t} &= [\ell_{t} + (\phi+\phi^2 + \dots + \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 \frac{y_{t}}{(\ell_{t-1} + \phi b_{t-1})} + (1 - \gamma)s_{t-m} \end{align*} \]
Often single most accurate forecasting method for seasonal data
air <- window(ausair, start = 1990, end = 2004)
fit3 <- holt(air, h = 15)
fit4 <- holt(air, damped = TRUE, phi = .9, h = 15)
autoplot(air) +
autolayer(fit3, series = 'Holt\'s method', PI = FALSE) +
autolayer(fit4, series = 'Dampled Holt\'s method', PI = FALSE) +
ggtitle('Forecasts from Holt\'s method') +
xlab('Year') +
ylab('Air passengers in Australia (millions)') +
guides(color = guide_legend(title = 'Forecast'))
|
TREND COMPONENT
|
None (N) |
Additive (A) |
Multiplicative (M) |
|---|---|---|---|
|
None (N) |
(N, N) | (N, A) | (N, M) |
|
Additive (A) | (A, N) | (A, A) | (A, M) |
|
Additive Damped (A\(_d\)) | (A\(_d\), N) | (A\(_d\), A) | (A\(_d\), M) |
Short hand representation of methods:
Simple Exponential Smoothing: No Trend
> ses(y)
Holt’s Method: Linear Trend
> holt(y)
Damped trend Method.
> holt(y, damped=TRUE)
Holt-Winters methods
> hw(y, damped=TRUE, seasonal="additive")
> hw(y, damped=FALSE, seasonal="additive")
> hw(y, damped=TRUE, seasonal="multiplicative")
> hw(y, damped=FALSE, seasonal="multiplicative")
Each method contains two models distinguished by either additive or multiplicative errors.
Error, Trend, Seasonal (ETS) labeling is used to differentiate models, methods, and type.
18 variations of ETS models exist and are classified as follows:
Trend: \(\{\)\(N\) | \(A\) | \(A_d\)\(\}\)
Seasonal: \(\{\)\(N\) | \(A\) | \(M\)\(\}\)
ets() function in the forecast package.Akaike’s Information Criterion (AIC):
\[ \text{AIC} = -2\log(\text{L}) + 2k \]
Corrected Akaike’s Information Criterion (AIC\(_c\)):
\[ \text{AIC}_{\text{c}} = \text{AIC} + \frac{2(k+1)(k+2)}{T-k} \]
Schwarz’s Bayesian Information Criterion (BIC):
\[ \text{BIC} = \text{AIC} + k(\log(T)-2) \]
Automatic forecasting using the ets() function:
Automatically selects models when arguments are set to default.
Produces forecasts using best method.
Obtain forecast intervals using underlying state spacemodel.
Tourist example from text:
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.0218 0.9628 0.7683 1.2471 ## ## sigma: 0.0383 ## ## AIC AICc BIC ## 224.8628 230.1569 240.9205 ## ## Training set error measures: ## ME RMSE MAE MPE MAPE MASE ## Training set 0.04836907 1.670893 1.24954 -0.1845609 2.692849 0.409454 ## ACF1 ## Training set 0.2005962
Model evaluation:
## AIC AICc BIC ## [1,] 224.8628 230.1569 240.9205
Train set error measures:
## ME RMSE MAE MPE MAPE MASE ## Training set 0.04836907 1.670893 1.24954 -0.1845609 2.692849 0.409454 ## ACF1 ## Training set 0.2005962
autoplot(fit)cbind('Residuals' = residuals(fit),
'Forecast errors' = residuals(fit, type='response')) %>%
autoplot(facet=TRUE) + xlab("Year") + ylab("")
Models only! Cannot be generated using the methods.
forecast function in the forecast package.fit %>% forecast(h=8) %>%
autoplot() +
ylab("International visitor night in Australia (millions)")