1 babs 502 moving averages, decomposition and exponential smoothing revised march 6, 2009

33
1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

Post on 19-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

1

BABS 502 Moving Averages, Decomposition and

Exponential SmoothingRevised March 6, 2009

0

50

100

150

200

250

300

350

400

450

500

1970

1972

1974

1976

1978

1980

1982

1984

1986

1988

1990

1992

Page 2: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 2

Moving Averages

Ft(1) is average of last m observations Issue is to choose m Most appropriate if series is random variation

around a mean This is the case if all autocorrelations are near zero

Not intended as a forecasting method - best for smoothing a series and determining patterns

Lags behind an increasing series Calculated in a spreadsheet using Average

function or using the MAV transformation in NCSS

Page 3: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 3

Moving Average Example

A B C1 Period Value Forecast for next period... 1 - 79 ...81 80 23082 81 8383 82 1184 83 76 average(b81:84)=10085 84 220 average(b82:85) =97.586 85 49 average(b83:b86) = 89

Page 4: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 4

Decomposition Method Represent series Additively as Yt = Tt + St + Ct + It Multiplicatively as Yt = Tt St Ct It whereTt is the trend component at t

St is the seasonal component at t

Ct is the cyclical component at t

It is the irregular or noise component at t

Page 5: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 5

Decomposition Methods Some comments

Cyclical components not usually included since they cannot be forecasted and are hard to determine

A plausible approach for understanding time series behavior

Suggest the following general forecasting approach;- Deseasonalize data – use a forecasting method for

stationary or trending series on the deseasonalized data and then reseasonalize.

- This may be sub-optimal since the two effects can be estimated simultaneously

Multiplicative version available in NCSS approach is ad hoc See help file

Page 6: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 6

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) ]

To apply this we need to choose the smoothing weight The closer is to 1, the more reactive the forecast

is to changes

Page 7: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 7

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.

Page 8: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 8

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

Page 9: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 9

Single Exponential Smoothing

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

Page 10: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 10

Simple Exponential SmoothingSpreadsheet Example

Page 11: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 11

Single Exponential SmoothingNCSS Output

Batting Averages

0.32

00.

350

0.38

00.

410

0.44

0

1 27 52 78 104Time

avg

Batting Average =.24

Page 12: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 12

Some Comments on Exponential Smoothing (Gardner, 1985)

Starting Values - need F0(1) to start process. Possible Choices Data Mean Backcasting

It is identical to an ARIMA(0,1,1) model. In inventory applications can choose to

minimize replenishment costs. Can let vary with t and control it adaptively. Parameter is chosen to minimize one step

ahead forecast error.

Page 13: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 13

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 programs – exponential smoothing is applied one step ahead out of sample so that it uses more data than other methods.

Page 14: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 14

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

Page 15: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 15

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

Page 16: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 16

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

Page 17: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 17

Double Exponential Smoothing

Linear Trend Model Yt=0+1t is too inflexible.

Requires a constant trend. Basic idea - introduce a trend estimate that

changes over time Similar to single exponential smoothing Issue is to choose two smoothing rates, and Referred to as Holt’s Linear Trend Model in NCSS Trend dominates after a few periods in forecasts

so forecasts are only good for a short term.

Page 18: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 18

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(1) = 5.916 + 0.013*2 = 5.942

Page 19: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 19

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

Available in SAS ETS and at Rob Hyndman’s website where he has R and Excel implementations of all exponential smoothing methods.

t

k

i

itt TLkF

1

)(

Page 20: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 20

Seasonality

A persistent pattern that occurs at regularly spaced time intervals quarterly, monthly, weekly, daily

Data may exhibit several levels of seasonality

May be modeled as multiplicative or additive

Should be included in systematic part of forecasting model

Detected visually or through ACF

Page 21: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 21

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

Page 22: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 22

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

Page 23: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 23

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

Page 24: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 24

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

Page 25: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 25

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

Page 26: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 26

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

Page 27: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 27

Holt-Winters’ Exponential Smoothing Equations

Seasonal Equation: It = (Current Value/Current Level)

+ (1-)(Seasonal Adjustment)t-p

It = (Xt/Lt) + (1-)It-p where p is the length of the seasonality (i.e. p months)

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

Page 28: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 28

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

Page 29: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 29

Holt-Winters’ Exponential Smoothing Example

Smoothing parameter estimates. = 0.239, = .012 and = 0.287. The seasonal factorswere:

Season 1 Factor 0.822 Season 2 Factor 0.742 Season 3 Factor 0.764Season 4 Factor 0.708 Season 5 Factor 0.748 Season 6 Factor 0.814Season 7 Factor 0.887 Season 8 Factor 0.888 Season 9 Factor 0.772Season 10 Factor 0.736 Season 11 Factor 0.724 Season 12 Factor 0.809.

Note some programs normalize these factors so that their average is one (NCSS does not).

Forecasts for 1991 are:

Jan 246.86 Feb 223.23 Mar 230.17 Apr 213.48May 225.94 June 246.41 July 268.88 Aug 269.45Sept 234.69 Oct 224.17 Nov 220.62 Dec 246.93

Page 30: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 30

Holt-Winters’ Exponential Smoothing Example

175

280

245

210

140

Year1 4 8 11 15

Hol t -W in te rs ’ app l i ed to powergenera t i on da ta

Power F or e c a s t

Page 31: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 31

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. Excellent reference: Chatfield and Yar “Holt-Winters

forecasting: some practical issues”, The Statistician, 1988, 129-140.

Page 32: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 32

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

Page 33: 1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 6, 2009

© Martin L. Puterman – Sauder School of Business 33

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.