Simple exponential smoothing

Report 24 Downloads 128 Views
FORECASTING USING R

Exponentially weighted forecasts

Rob Hyndman Author, forecast

Forecasting Using R

Simple exponential smoothing Forecasting Notation: yˆt+h|t = point forecast of yt+h given data y1 , ..., yt Forecast Equation: yˆt+h|t = αyt + α(1 − α)yt−1 + α(1 − α) yt−2 + ... where 0 ≤ α ≤ 1 2

Observation

α = 0.2

α = 0.4

α = 0.6

α = 0.8

yt yt−1

0.2

0.4

0.6

0.8

0.16

0.24

0.24

0.16

yt−2

0.128

0.144

0.096

0.032

yt−3 yt−4 yt−5

0.1024

0.0864

0.0384

0.0064

(0.2)(0.8)4

(0.4)(0.6)4

(0.6)(0.4)4

(0.8)(0.2)4

(0.2)(0.8)5

(0.4)(0.6)5

(0.6)(0.4)5

(0.8)(0.2)5

Forecasting Using R

Simple exponential smoothing Component form Forecast equation

yˆ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



We choose α and ℓ0 by minimizing SSE: SSE =

T ! t=1

(yt − yˆt|t−1 )

2

Forecasting Using R

Example: oil production > oildata fc summary(fc) Forecast method: Simple exponential smoothing Model Information: Simple exponential smoothing Call: ses(y = oildata, h = 5) Smoothing parameters: alpha = 0.8339 Initial states: l = 446.5759 sigma:

28.12

*** Truncated due to space

Forecasting Using R

Example: oil production > autoplot(fc) + ylab("Oil (millions of tonnes)") + xlab("Year")

FORECASTING USING R

Let’s practice!

FORECASTING USING R

Exponential smoothing methods with trend

Forecasting Using R

Holt's linear trend Simple exponential smoothing Forecast

yˆt+h|t = ℓt

Level

ℓt = αyt + (1 − α)ℓt−1 Holt's linear trend

Forecast

yˆ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



Choose α, β , ℓ0 , b0 to minimize SSE ∗

β ∗ (0≤ α, β ∗ ≤ 1)

Forecasting Using R

Holt's method in R > airpassengers %>% holt(h = 5) %>% autoplot

Forecasting Using R

Damped trend method Component form h

2

yˆt+h|t = ℓt + (φ + φ + · · · + φ )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



Short-run forecasts trended, long-run forecasts constant

Forecasting Using R

Example: Air passengers > fc1 fc2 autoplot(airpassengers) + xlab("Year") + ylab("millions") + autolayer(fc1, series="Linear trend") + autolayer(fc2, series="Damped trend")

FORECASTING USING R

Let’s practice!

FORECASTING USING R

Exponential smoothing methods with trend and seasonality

Forecasting Using R

Holt-Winters' additive method Holt-Winters additive method



= seasonal component from final year of data



Smoothing parameters:



m = period of seasonality (e.g. m = 4 for quarterly data)



seasonal component averages zero

Forecasting Using R

Holt-Winters' multiplicative method Holt-Winters multiplicative method



= seasonal component from final year of data



Smoothing parameters:



m = period of seasonality (e.g. m = 4 for quarterly data)



seasonal component averages one

Forecasting Using R

Example: Visitor Nights > aust fc1 fc2