ETW3420: Principles of Forecasting and Applications
Principles of
Copyright By PowCoder代写 加微信 powcoder
Forecasting and
Applications
Topic 5: Exponential Smoothing
1 Introduction
2 Components in Exponential Smoothing Method
3 Simple exponential smoothing
4 Trend methods
5 Seasonal methods
6 Taxonomy of exponential smoothing methods
7 Innovations state space models
8 ETS in R
Introduction
Exponential smoothing was proposed in the late 1950s
(Brown, 1959; Holt, 1957 and Winters, 1960 are key
pioneering works) and has motivated some of the most
successful forecasting methods.
Was invented during WW2 by . Brown (1923-2013),
who was involved in the design of a tracking system for
fire-control information on the location of enemy
submarines.
Introduction
Later on, the principles of exponential smoothing were
applied to business data, especially in the analysis of the
demand for service parts in inventory systems by Brown in a
book Advanced Service Parts Inventory Control (1982).
Widely used in the areas of sales, inventory, logistics and
production planning as well as in quality control, process
control, financial planning and marketing planning.
Introduction
Introduction
Introduction
Forecasts are based on the extrapolation of past patterns
with forecasting equations that are simple to update and
maintain in a database.
Capture level (a starting point for the forecasts), trend (a
factor for growth or decline) and seasonal factors (for
adjustment of seasonal variation) in data patterns.
Forecasts produced using exponential smoothing methods
are weighted average of past observations, with the weights
decaying exponentially as the observations get older.
The more recent the observation, the higher the associated
1 Introduction
2 Components in Exponential Smoothing Method
3 Simple exponential smoothing
4 Trend methods
5 Seasonal methods
6 Taxonomy of exponential smoothing methods
7 Innovations state space models
8 ETS in R
Components in Exponential Smoothing Method
An exponential smoothing method comprises one or more of the
following components: the current level, the current trend, and
the current seasonal index.
The current level serves as the starting point of the forecast.
Calculated to represent an exponentially weighted average of
the time series at the end of the fit period.
Can be regarded as the value the time series would now have
if there were nothing at all unusual going on at present.
Components in Exponential Smoothing Method
The current trend represents the amount by which we expect
the time series to grow or decline per time period into the
Calculated as an exponentially weighted average of past
period-to-period changes in the level of the series.
As such, recent growth or decline in the time series is (usually)
given more weight than changes farther back in time.
The current seasonal index is the degree by which the
season’s values tends to exceed or fall short of the norm.
1 Introduction
2 Components in Exponential Smoothing Method
3 Simple exponential smoothing
4 Trend methods
5 Seasonal methods
6 Taxonomy of exponential smoothing methods
7 Innovations state space models
8 ETS in R
Simple methods
Time series y1, y2, . . . , yT.
Random walk forecasts
ŷT+h|T = yT
Average forecasts
Want something in between that weights most
recent data more highly.
Simple exponential smoothing uses a weighted
moving average with weights that decrease
exponentially.
Simple methods
Time series y1, y2, . . . , yT.
Random walk forecasts
ŷT+h|T = yT
Average forecasts
Want something in between that weights most
recent data more highly.
Simple exponential smoothing uses a weighted
moving average with weights that decrease
exponentially.
Simple methods
Time series y1, y2, . . . , yT.
Random walk forecasts
ŷT+h|T = yT
Average forecasts
Want something in between that weights most
recent data more highly.
Simple exponential smoothing uses a weighted
moving average with weights that decrease
exponentially. 12
Simple Exponential Smoothing
Forecast equation
ŷT+1|T = αyT + α(1− α)yT−1 + α(1− α)2yT−2 + · · · + α(1− α)T−1y1
α(1− α)iyT−i
where 0 ≤ α ≤ 1.
The one-step-ahead forecast at time T + 1 is then a weighted
average of all the observations in the series, y1, · · · , yT.
The rate at which the weights decrease is controlled by the
parameter α. The rate that (1−α)i decays to zero determines
how much influence past values have on forecasts.
There will be very little smoothing (or averaging) if (1− α)i
decays to zero very fast, i.e. when α is large (or close to 1).
Simple Exponential Smoothing
Forecast equation
ŷT+1|T = αyT + α(1− α)yT−1 + α(1− α)2yT−2 + · · · + α(1− α)T−1y1
α(1− α)iyT−i
where 0 ≤ α ≤ 1.
The one-step-ahead forecast at time T + 1 is then a weighted
average of all the observations in the series, y1, · · · , yT.
The rate at which the weights decrease is controlled by the
parameter α. The rate that (1−α)i decays to zero determines
how much influence past values have on forecasts.
There will be very little smoothing (or averaging) if (1− α)i
decays to zero very fast, i.e. when α is large (or close to 1). 13
Simple Exponential Smoothing
The table below shows the weights attached to observations
for 4 different values of α when forecasting using SES.
Weights assigned to observations for:
Observation α = 0.2 α = 0.4 α = 0.6 α = 0.8
yT 0.2 0.4 0.6 0.8
yT−1 0.16 0.24 0.24 0.16
yT−2 0.128 0.144 0.096 0.032
yT−3 0.1024 0.0864 0.0384 0.0064
yT−4 (0.2)(0.8)4 (0.4)(0.6)4 (0.6)(0.4)4 (0.8)(0.2)4
yT−5 (0.2)(0.8)5 (0.4)(0.6)5 (0.6)(0.4)5 (0.8)(0.2)5
Simple Exponential Smoothing
Component form
Forecast equation ŷt+h|t = `t
Smoothing equation `t = αyt + (1− α)`t−1
`t is the level (or the smoothed value) of the series
at time t.
ŷt+1|t = αyt + (1− α)ŷt|t−1
Iterate to get exponentially weighted moving
average form.
Weighted average form
α(1− α)jyT−j + (1− α)T`0
Optimisation
Need to choose value for α and `0
Similarly to regression — we choose α and `0 by minimising
(yt − ŷt|t−1)2.
Unlike regression there is no closed form solution — use
numerical optimization.
Example: Oil production
oildata <- window(oil, start=1996)
# Estimate parameters
fc <- ses(oildata, h=5)
summary(fc$model) #or summary(fc) for full print out of results
## Simple exponential smoothing
## ses(y = oildata, h = 5)
## Smoothing parameters:
## alpha = 0.8339
## Initial states:
## l = 446.5868
## sigma: 29.83
## AIC AICc BIC
## 178.1 179.9 180.8
## Training set error measures:
## ME RMSE MAE MPE MAPE MASE ACF1
## Training set 6.402 28.12 22.26 1.098 4.611 0.9257 -0.03378
Example: Oil production
Year Time Observation Level Forecast
t yt `t ŷt+1|t
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
2014 1 542.68
2015 2 542.68
2016 3 542.68
## Year Time Observation Level Forecast
## 1 "" "$t$" "$y_t$" "$\\ell_t$" "$\\hat{y}_{t+1|t}$"
## 2 "1995" " 0" "" "446.59" ""
## 3 "1996" " 1" "445.36" "445.57" "446.59"
## 4 "1997" " 2" "453.20" "451.93" "445.57"
## 5 "1998" " 3" "454.41" "454.00" "451.93"
## 6 "1999" " 4" "422.38" "427.63" "454.00"
## 7 "2000" " 5" "456.04" "451.32" "427.63"
## 8 "2001" " 6" "440.39" "442.20" "451.32"
## 9 "2002" " 7" "425.19" "428.02" "442.20"
## 10 "2003" " 8" "486.21" "476.54" "428.02"
## 11 "2004" " 9" "500.43" "496.46" "476.54"
## 12 "2005" "10" "521.28" "517.15" "496.46"
## 13 "2006" "11" "508.95" "510.31" "517.15"
## 14 "2007" "12" "488.89" "492.45" "510.31"
## 15 "2008" "13" "509.87" "506.98" "492.45"
## 16 "2009" "14" "456.72" "465.07" "506.98"
## 17 "2010" "15" "473.82" "472.36" "465.07"
## 18 "2011" "16" "525.95" "517.05" "472.36"
## 19 "2012" "17" "549.83" "544.39" "517.05"
## 20 "2013" "18" "542.34" "542.68" "544.39"
## 21 "" "$h$" "" "" "$\\hat{y}_{T+h|T}$"
## 22 "2014" " 1" "" "" "542.68"
## 23 "2015" " 2" "" "" "542.68"
## 24 "2016" " 3" "" "" "542.68"
Example: Oil production
autoplot(fc) +
autolayer(fitted(fc), series="Fitted") +
ylab("Oil (millions of tonnes)") + xlab("Year")
1995 2000 2005 2010 2015
Forecasts from Simple exponential smoothing
1 Introduction
2 Components in Exponential Smoothing Method
3 Simple exponential smoothing
4 Trend methods
5 Seasonal methods
6 Taxonomy of exponential smoothing methods
7 Innovations state space models
8 ETS in R
Holt’s linear trend
Simple exponential smoothing is only applicable for the
forecasting of data that displays no trend and seasonality.
Holt(1957) extended SES to allow forecasting of data with a
This method involves a forecast equation and 2 smoothing
equations - one for the level and one for the trend.
Holt’s linear trend
Component form
Forecast ŷt+h|t = `t + hbt
Level `t = αyt + (1− α)(`t−1 + bt−1)
Trend bt = β∗(`t − `t−1) + (1− β∗)bt−1,
Two smoothing parameters α and β∗ (0 ≤ α, β∗ ≤ 1).
`t level: weighted average between yt and one-step ahead
forecast for time t, (`t−1 + bt−1 = ŷt|t−1)
bt slope: weighted average of (`t − `t−1) and bt−1, current
and previous estimate of slope.
Choose α, β∗, `0, b0 to minimise SSE.
Holt’s linear trend
Component form
Forecast ŷt+h|t = `t + hbt
Level `t = αyt + (1− α)(`t−1 + bt−1)
Trend bt = β∗(`t − `t−1) + (1− β∗)bt−1,
Two smoothing parameters α and β∗ (0 ≤ α, β∗ ≤ 1).
`t level: weighted average between yt and one-step ahead
forecast for time t, (`t−1 + bt−1 = ŷt|t−1)
bt slope: weighted average of (`t − `t−1) and bt−1, current
and previous estimate of slope.
Choose α, β∗, `0, b0 to minimise SSE.
Holt’s linear trend
Note that 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.
Holt’s method in R
window(ausair, start=1990, end=2004) %>%
holt(h=5, PI=FALSE) %>%
autoplot()
1990 1995 2000 2005
Forecasts from Holt’s method
Damped trend method
Forecasts generated by Holt’s method display a constant
trend (increasing or decreasing) indefinitely into the future.
More extreme are the forecasts generated by the exponential
trend method which include exponential growth or decline.
Empirical evidence indicates that these methods tend to
over-forecast, especially for longer forecast horizons.
Garnder and 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
successful; arguably the most popular individual methods
when forecasts are required automatically for many series.
Damped trend method
Component form
ŷt+h|t = `t + (φ + φ2 + · · · + φh)bt
`t = αyt + (1− α)(`t−1 + φbt−1)
bt = β∗(`t − `t−1) + (1− β∗)φbt−1.
Damping parameter 0 < φ < 1.
If φ = 1, identical to Holt’s linear trend.
As h→∞, ŷT+h|T → `T + φbT/(1− φ).(Recall geometric
progression rule)
Short-run forecasts trended, long-run forecasts constant.
Damped trend method
Component form
ŷt+h|t = `t + (φ + φ2 + · · · + φh)bt
`t = αyt + (1− α)(`t−1 + φbt−1)
bt = β∗(`t − `t−1) + (1− β∗)φbt−1.
Damping parameter 0 < φ < 1.
If φ = 1, identical to Holt’s linear trend.
As h→∞, ŷT+h|T → `T + φbT/(1− φ).(Recall geometric
progression rule)
Short-run forecasts trended, long-run forecasts constant.
Example: Air passengers
window(ausair, start=1990, end=2004) %>%
holt(damped=TRUE, h=5, PI=FALSE) %>%
autoplot()
1990 1995 2000 2005
Forecasts from Damped Holt’s method
Example: Sheep in Asia
livestock2 <- window(livestock, start=1970, fit1 <- ses(livestock2) fit2 <- holt(livestock2) fit3 <- holt(livestock2, damped = TRUE) accuracy(fit1, livestock) accuracy(fit2, livestock) accuracy(fit3, livestock) Example: Sheep in Asia SES Linear trend Damped trend α 1.00 0.98 0.97 β∗ 0.00 0.00 `0 263.90 251.46 251.89 b0 4.99 6.29 Training RMSE 14.77 13.98 14.00 Test RMSE 25.46 11.88 14.73 Test MAE 20.38 10.71 13.30 Test MAPE 4.60 2.54 3.07 Test MASE 2.26 1.19 1.48 Example: Sheep in Asia 1970 1980 1990 2000 2010 Damped trend Self-Practice eggs contains the price of a dozen eggs in the United States from 1 Use SES and Holt’s linear method (with and without damping) to forecast future data. [Hint: use h=100 so you can clearly see the differences between the options when plotting the forecasts.] 2 Which method gives the best training RMSE? 3 Are these RMSE values comparable? 4 Do the residuals from the best fitting method look like white 1 Introduction 2 Components in Exponential Smoothing Method 3 Simple exponential smoothing 4 Trend methods 5 Seasonal methods 6 Taxonomy of exponential smoothing methods 7 Innovations state space models 8 ETS in R Holt-Winters seasonal method Holt (1957) and Winters (1960) extended Holt’s method to capture seasonality. The seasonal method comprises of the forecast equation and 3 smoothing equations - one for the level, trend and seasonal component. There are 2 variations to this method that differ in the nature of the seasonal method. Additivemethod: seasonal variations are roughly constant through the series. Multiplicativemethod: seasonal variations are changing proportional to the level of the series. Holt-Winters additive method Component form ŷt+h|t = `t + hbt + st+h−m(k+1) `t = α(yt − st−m) + (1− α)(`t−1 + bt−1) bt = β∗(`t − `t−1) + (1− β∗)bt−1 st = γ(yt − `t−1 − bt−1) + (1− γ)st−m, k = integer part of (h− 1)/m. Ensures estimates from the final year are used for forecasting. Parameters: 0 ≤ α ≤ 1, 0 ≤ β∗ ≤ 1, 0 ≤ γ ≤ 1− α and m = period of seasonality (e.g. m = 4 for quarterly data). Holt-Winters additive method Level equation weighted average between the seasonally adjusted observation (yt − st−m) and the non-seasonal forecast (lt−1 + bt−1) for time t. Trend equation weighted average of current trend estimate (lt − lt−1) and previous trend estimate bt−1. Seasonal equation weighted average between current seasonal index (yt − lt−1 − bt−1) and the seasonal index of the same season last year (i.e. m time periods ago). Holt-Winters additive method Seasonal component is usually expressed as st = γ∗(yt − `t) + (1− γ∗)st−m. Substitute in for `t: st = γ∗(1− α)(yt − `t−1 − bt−1) + [1− γ∗(1− α)]st−m We set γ = γ∗(1− α). The usual parameter restriction is 0 ≤ γ∗ ≤ 1, which translates to 0 ≤ γ ≤ (1− α). Holt-Winters multiplicative method For when seasonal variations are changing proportional to the level of the series. Component form ŷt+h|t = (`t + hbt)st+h−m(k+1). + (1− α)(`t−1 + bt−1) bt = β∗(`t − `t−1) + (1− β∗)bt−1 (`t−1 + bt−1) + (1− γ)st−m k is integer part of (h− 1)/m. With additive method st is in absolute terms: within each year With multiplicative method st is in relative terms: within each year i si ≈ m. 37 Example: Visitor Nights aust <- window(austourists,start=2005) fit1 <- hw(aust,seasonal="additive") fit2 <- hw(aust,seasonal="multiplicative") 2008 2012 2016 HW additive forecasts HW multiplicative forecasts Estimated components 2007 2010 2013 2016 Additive states 2007 2010 2013 2016 Multiplicative states Holt-Winters damped method Often the single most accurate forecasting method for seasonal ŷt+h|t = [`t + (φ + φ2 + · · · + φh)bt]st+h−m(k+1) `t = α(yt/st−m) + (1− α)(`t−1 + φbt−1) bt = β∗(`t − `t−1) + (1− β∗)φbt−1 (`t−1 + φbt−1) + (1− γ)st−m Self-Practice Apply Holt-Winters multiplicative method to the gas data. 1 Why is multiplicative seasonality necessary here? 2 Experiment with making the trend damped. 3 Check that the residuals from the best method look like white 1 Introduction 2 Components in Exponential Smoothing Method 3 Simple exponential smoothing 4 Trend methods 5 Seasonal methods 6 Taxonomy of exponential smoothing methods 7 Innovations state space models 8 ETS in R Exponential smoothing methods Exponential smoothing methods are not restricted to those we have presented so far. By considering variations in the combination of the trend and seasonal components, 15 exponential smoothing methods are possible (see Table on next slide). Each method is labelled by a pair of letters (T,S) defining the type of ‘Trend’ and ‘Seasonal’ components. E.g. (A,M): Additive trend andMultiplicative seasonality E.g. (M,N):Multiplicative (or exponential) trend and No seasonality Exponential smoothing methods Seasonal Component Trend N A M Component (None) (Additive) (Multiplicative) N (None) (N,N) (N,A) (N,M) A (Additive) (A,N) (A,A) (A,M) Ad (Additive damped) (Ad,N) (Ad,A) (Ad,M) (N,N): Simple exponential smoothing (A,N): Holt’s linear method (Ad,N): Additive damped trend method (A,A): Additive Holt-Winters’ method (A,M): Multiplicative Holt-Winters’ method (Ad,M): Damped multiplicative Holt-Winters’ method 44 Exponential smoothing methods There are also multiplicative trend methods (not recommended). Recursive formulae Trend Seasonal ŷt+h|t = `t ŷt+h|t = `t + st+h−m(k+1) ŷt+h|t = `tst+h−m(k+1) N `t = αyt + (1−α)`t−1 `t = α(yt − st−m) + (1−α)`t−1 `t = α(yt /st−m) + (1−α)`t−1 st = γ(yt − `t−1) + (1−γ)st−m st = γ(yt /`t−1) + (1−γ)st−m ŷt+h|t = `t + hbt ŷt+h|t = `t + hbt + st+h−m(k+1) ŷt+h|t = (`t + hbt)st+h−m(k+1) A `t = αyt + (1−α)(`t−1 + bt−1) `t = α(yt − st−m) + (1−α)(`t−1 + bt−1) `t = α(yt /st−m) + (1−α)(`t−1 + bt−1) ∗(`t − `t−1) + (1− β∗)bt−1 bt = β∗(`t − `t−1) + (1− β∗)bt−1 bt = β∗(`t − `t−1) + (1− β∗)bt−1 st = γ(yt − `t−1 − bt−1) + (1−γ)st−m st = γ(yt /(`t−1 + bt−1)) + (1−γ)st−m ŷt+h|t = `t +φhbt ŷt+h|t = `t +φhbt + st+h−m(k+1) ŷt+h|t = (`t +φhbt)st+h−m(k+1) Ad `t = αyt + (1−α)(`t−1 +φbt−1) `t = α(yt − st−m) + (1−α)(`t−1 +φbt−1) `t = α(yt /st−m) + (1−α)(`t−1 +φbt−1) ∗(`t − `t−1) + (1− β∗)φbt−1 bt = β∗(`t − `t−1) + (1− β∗)φbt−1 bt = β∗(`t − `t−1) + (1− β∗)φbt−1 st = γ(yt − `t−1 −φbt−1) + (1−γ)st−m st = γ(yt /(`t−1 +φbt−1)) + (1−γ)st−m R functions Simple exponential smoothing: no trend. Holt’s method: linear trend. 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") Combination of no trend with seasonality not possible using these functions. 1 Introduction 2 Components in Exponential Smoothing Method 3 Simple exponential smoothing 4 Trend methods 5 Seasonal methods 6 Taxonomy of exponential smoothing methods 7 Innovations state space models 8 ETS in R Methods v Models Exponential smoothing methods Algorithms that return point forecasts. Do not cat 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com