babs 502 moving averages, decomposition and exponential smoothing revised march 11, 2014
DESCRIPTION
BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 11, 2014. Single Exponential Smoothing. One-step ahead forecast is the weighted average of current value and past forecast F t (1) = a( Current Value)+ (1- a ) Past Forecast = a X t + (1- a ) F t-1 (1) - PowerPoint PPT PresentationTRANSCRIPT
1
BABS 502 Moving Averages, Decomposition and
Exponential SmoothingRevised March 11, 2014
0
50
100
150
200
250
300
350
400
450
500
1970
1972
1974
1976
1978
1980
1982
1984
1986
1988
1990
1992
© Martin L. Puterman – Sauder School of Business 2
Single Exponential Smoothing
One-step ahead forecast is the weighted average of current value and past forecast
Ft(1) = Current Value)+ (1-) Past Forecast = Xt+ (1-) Ft-1(1)
Alternative representation Ft(1) = Ft-1(1) + Xt - Ft-1(1) ]
• This is previous forecast plus a constant times previous forecast error
Text also gives a component form representation To apply this we need to choose the smoothing weight
The closer is to 1, the more reactive the forecast is
to changes
© Martin L. Puterman – Sauder School of Business 3
Single Exponential SmoothingRecursive function:
Ft(1) = Xt+ (1-) Ft-1(1),
Ft-1(1) = Xt-1+ (1-) Ft-2(1), etc
Backward substitute: Ft(1) = Xt + (1-)Xt-1 + (1-)2 Xt-2 + (1-)3 Xt-3 +…
When 0.3 this becomes Ft(1) = .3Xt+ .7*.3 Xt-1 + (.7)2 *Xt-2 + (.7)3 Xt-3 + …
= .3Xt+ .21 Xt-1 + .147 Xt-2 + .1029 Xt-3 + …
This is the justification for the name “exponential” smoothing. “Age” of data is about 1/which is the mean of the geometric distribution.
© Martin L. Puterman – Sauder School of Business 4
Single Exponential Smoothing Example
Diagram 3.2: SES results with different smoothing parameters
140
160
180
200
220
240
260
280
1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76
Time
Sal
es
Sales
Alpha = 0.1
Alpha = 0.7
© Martin L. Puterman – Sauder School of Business 5
Single Exponential SmoothingComponent Form
Today’s level = Today’s value + (1-)Yesterday’s Level
Tomorrow’s forecast = Today’s levelLt = Xt + (1- ) Lt-1
Ft(k) = Lt for all kThe level represents the systematic part
of the series
© Martin L. Puterman – Sauder School of Business 6
Simple Exponential SmoothingSpreadsheet Example
Easy to use excel optimizer to choose alpha to minimize mean absolute percentage out of sample forecast error.
© Martin L. Puterman – Sauder School of Business 7
Single Exponential SmoothingNCSS Output
200.0
400.0
600.0
800.0
1000.0
0.9 23.9 46.9 69.9 92.9
Pulp_Price Forecast Plot
Time
Pulp
_P
ric
e
Variable Pulp_PriceNumber of Rows 84Mean 579.2857Pseudo R-Squared 0.798127Mean Square Error 4232.143Mean |Error| 44.28571Mean |Percent Error| 7.838659
Alpha Search Mean |Percent Error|Alpha 1Forecast 540
© Martin L. Puterman – Sauder School of Business 8
Some Comments on Exponential Smoothing (Gardner, 1985)
Starting Values - need F0(1) to start process. Possible Choices Data Mean Backcasting
Simple exponential smoothing is identical to ARIMA(0,1,1) model.
Parameter is chosen to minimize either the root mean square, mean absolute or mean absolute percentage one step ahead forecast error.
R chooses to maximize liklehood.
© Martin L. Puterman – Sauder School of Business 9
Some Comments on Out of Sample Testing
When comparing methods out of sample be sure to check how the out of sample forecast is computed and what information is assumed known.
In some automatic programs – exponential smoothing is applied one step ahead out of sample so that it uses more data than other methods.
© Martin L. Puterman – Sauder School of Business 10
Double Exponential Smoothing
In a trending series, single exponential smoothing lags behind the series
340000.0
360000.0
380000.0
400000.0
420000.0
0.9 11.6 22.4 33.1 43.9
BIRTHS Forecast Plot
Time
BIR
TH
S
© Martin L. Puterman – Sauder School of Business 11
Double Exponential Smoothing
Double Exponential Smoothing tracks trending data better; but forecasts may not be good after a few periods
300000.0
330000.0
360000.0
390000.0
420000.0
0.9 9.6 18.4 27.1 35.9
BIRTHS Forecast Plot
Time
BIR
TH
S
© Martin L. Puterman – Sauder School of Business 12
Double Exponential Smoothing
Linear Trend Model Yt=0+1t is inflexible. Assumes
a constant trend 1 per period throughout the data.
Basic idea - introduce a trend estimate that changes over time.
Similar to single exponential smoothing but two equations.
Issue is to choose two smoothing rates, and Referred to as Holt’s Linear Trend Trend dominates after a few periods in forecasts so
forecasts are only good for a short term.
© Martin L. Puterman – Sauder School of Business 13
Double Exponential Smoothing
The model: Separate smoothing equations for level and trend Level Equation
Lt = (Current Value)
+ (1 - ) (Level + Trend Adjustment)t-
1
Lt = Xt + (1 - ) (Lt-1 + T t-1)
Trend Equation
Tt = (Lt - Lt-1) + (1 - ) Tt-1
Forecasting Equation
Ft(k) = Lt + k Tt
© Martin L. Puterman – Sauder School of Business 14
Double Exponential Smoothing Example
5.6
5.2
4.8
6.0
6.4
1 25 49 73 97
Double Exponential Smoothing
Time
Wages
= 0.637 =0.020 L72 = 5.916 T72 = 0.013
F72(1) = 5.916 + 0.013 = 5.929 F72(2) = 5.916 + 0.013*2 = 5.942
© Martin L. Puterman – Sauder School of Business 15
Damped Trend Models Problem with a trend model is that trend dominates
forecast in a couple of periods. Approach - introduce trend damping parameter
Level Equation
Lt = Xt + (1 - ) (Lt-1 + T t-1)
Trend Equation
Tt = (Lt - Lt-1) + (1 - ) Tt-1
Forecasting Equation
Implemented in R.
t
k
i
itt TLkF
1
)(
© Martin L. Puterman – Sauder School of Business 16
Seasonality
A persistent pattern that occurs at regularly spaced time intervals quarterly, monthly, weekly, daily
Data may exhibit several levels of seasonality simultaneously
May be modeled as multiplicative or additive
Should be included in systematic part of forecasting model
Detected visually or through ACF
© Martin L. Puterman – Sauder School of Business 17
Seasonal Data Example1
40
.01
75
.02
10
.02
45
.02
80
.0
1 40 79 118 157
Plot of Power
Time
Pow
er
-1.0
00
-0.5
00
0.0
00
0.5
00
1.0
00
0 10 21 31 41
Autocorrelations of Power (0,0,12,1,0)
Time
Auto
corr
ela
tions
Monthly US Electric Power Consumption
© Martin L. Puterman – Sauder School of Business 18
Exponential Smoothing with Trend and Seasonality
Exponential Smoothing with trend does not track or forecast seasonal data well
200.0
375.0
550.0
725.0
900.0
0.9 7.9 14.9 21.9 28.9
sales Forecast Plot
Time
sale
s
© Martin L. Puterman – Sauder School of Business 19
The Holt-Winters Model tracks the seasonal pattern
200.0
400.0
600.0
800.0
1000.0
1994.9 1996.6 1998.4 2000.1 2001.9
sales Forecast Plot
Time
sale
s
Exponential Smoothing with Trend and Seasonality
© Martin L. Puterman – Sauder School of Business 20
Holt-Winters’ Exponential Smoothing Equations
Level Equation:
Lt = (Current Value/Seasonal Adjustmentt-
p)
+ (1-)(Levelt-1 + Trendt-1)
Lt = (Deseasonalized Current Value)
+ (1-)(Levelt-1 + Trendt-1)
Lt = (Xt/It-p) + (1-)(Lt-1 + Tt-1)
where It-p = Seasonal component
© Martin L. Puterman – Sauder School of Business 21
Holt-Winters’ Exponential Smoothing
Generalizes Double Exponential Smoothing by including (multiplicative) seasonal indicators.
Separate smoothing equations for level, trend and seasonal indicators.
Allows trend and seasonal pattern to change over time
Must estimate three smoothing parameters Equations more complicated but implemented with
software One of the best methods for short term seasonal
forecasts
© Martin L. Puterman – Sauder School of Business 22
Holt-Winters’ Exponential Smoothing Equations
Trend Equation: Same as double exponential smoothing
method
Tt = (Change in level in the last period)
+ (1 - ) (Trend Adjustment)t-1
Tt = (Lt - Lt-1) + (1 - ) Tt-1
© Martin L. Puterman – Sauder School of Business 23
Holt-Winters’ Exponential Smoothing EquationsSeasonal Equation: It = (Current Value/Current Level)
+ (1-)(Seasonal Adjustment)t-p
It = (Xt/Lt) + (1-)It-pwhere p is the length of the seasonality (i.e. p months) so that t-p is the same season in the previous year.
Note this model assumes the same for every season.
Forecasting equations: Ft(k) = (Lt + kTt)It-p+k for k=1,2, …, p Ft(k) = (Lt + kTt)It-2p+k for k=p+1,p+2, …, 2p
© Martin L. Puterman – Sauder School of Business 24
Holt-Winters’ Exponential Smoothing Equations Summary Lt = (Xt/It-p) + (1-)(Lt-1 + Tt-1) Level Equation
Tt = (Lt - Lt-1) + (1-)Tt-1 Trend Equation
It = (Xt/Lt) + (1- )It-p Seasonal Factor Equation
Forecasting equations: Ft(k) = (Lt + kTt)It-p+k for k=1,2, …, p
Ft(k) = (Lt + kTt)It-2p+k for k=p+1,p+2, …, 2p
© Martin L. Puterman – Sauder School of Business 25
Holt-Winters’ Exponential Smoothing Example
200.0
450.0
700.0
950.0
1200.0
2000.9 2007.1 2013.4 2019.6 2025.9
Pulp_Price Forecast Plot
TimeP
ulp
_P
rice
Forecast Summary SectionVariable Pulp_PriceNumber of Rows 84Mean 579.2857Pseudo R-Squared 0.766036Mean Square Error 4904.916Mean |Error| 44.74108Mean |Percent Error| 7.992905
Forecast Method Winter's with multiplicative seasonal adjustment.Search Iterations 120Search Criterion Mean |Percent Error|Alpha 0.999787Beta 0.1984507Gamma 0.4674903
Intercept (A) -113.6628Slope (B) 7.878917Season 1 Factor 1.008922Season 2 Factor 0.9970459Season 3 Factor 0.9850978Season 4 Factor 1.008935
Initial values for forecasts
© Martin L. Puterman – Sauder School of Business 26
Holt-Winters Further Comments Can add damped trend to this model too. Additive version also available but multiplicative model is
preferable. Note the HW model combines additive trend with multiplicative seasonality.
Missing values cannot be skipped, they must be estimated. Outliers have a big impact and could be handled like
missing values This is a special case of a “state space model”. Different computer packages give different estimates and
forecasts. Early reference: Chatfield and Yar “Holt-Winters
forecasting: some practical issues”, The Statistician, 1988, 129-140.
© Martin L. Puterman – Sauder School of Business 27
Applying Exponential Smoothing Models
Plot data determine patterns
- seasonality, trend, outliers
Fit model Check residuals
Any information present?- Plots or ACF functions
Adjust Produce forecasts Calibrate on hold out sample
Multiple one step ahead k-step ahead (where is k is the practical forecast
horizon)
© Martin L. Puterman – Sauder School of Business 28
Using Exponential Smoothing in Practice
Important issue is how frequently to recalibrate the model Possible choices
- Every period- Quarterly- Annually
The point here is that the model can be determined by analysts, programmed into a forecasting system with fixed parameters and recalibrated as needed.