DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

32
DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting

Transcript of DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Page 1: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

DSc 3120

Generalized Modeling Techniques with Applications

Part II. Forecasting

Page 2: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 2

Forecasting

Why Forecasting?

Characteristics of Forecasts Forecasts are usually wrong or seldom correct Aggregate forecasts are usually more accurate Less accurate further into the future

Assumptions of Forecasting Models Information (data) about the past is available The pattern of the past will continue into the

future.

Page 3: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 3

Qualitative Forecasting

Sales force composites (field sales force)

Consumer market survey (users’ expectations)

Jury of executive

The Delphi method

--Forecasting based on experience, judgement, and knowledge

Page 4: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 4

Quantitative Forecasting

Casual Models:

Causal Model

Year 2000 Sales

Price PopulationAdvertising

……

Time Series Models:

Time Series Model

Year 2000 Sales

Sales1999 Sales1998

Sales1997……

--Forecasting based on data and models

Page 5: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 5

Forecasting Models

Qualitative Quantitative

Causal Time series

Regression EconometricsMoving average Decomposition

Exponential smoothing

Sales force composite

Consumer survey

Jury of executive

Delphi method

ARIMA Neural networks

Overview of Forecasting Models

Page 6: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 6

Causal Forecasting Models Curve Fitting: Simple Linear Regression

One Independent Variable (X) is used to predict one Dependent Variable (Y): Y = a + b X

Given n observations (Xi, Yi), we can fit a line to the overall pattern of these data points. The Least Squares Method in statistics can give us the best a and b in the sense of minimizing (Yi - a - bXi)2:

n

Xb

n

Ya

n

XX

n

YXYXb

ii

ii

iiii

22 )(

/

Page 7: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 7

Curve Fitting: Simple Linear Regression Find the regression line with Excel

Use Function:

a = INTERCEPT(Y range; X range)

b = SLOPE(Y range; X range) Use Solver Use Excel’s Tools | Data Analysis | Regression

Curve Fitting: Multiple Regression Two or more independent variables are used to

predict the dependent variable:

Y = b0 + b1X1 + b2X2 + … + bpXp

Use Excel’s Tools | Data Analysis | Regression

Page 8: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 8

BIAS - The arithmetic mean of the errors

n is the number of forecast errors Excel: =AVERAGE(error range)

Mean Absolute Deviation - MAD

No direct Excel function to calculate MAD

Evaluation of Forecasting Model

n

Error

n

Forecast) - (Actual BIAS

n

|Error|

n

Forecast - Actual| MAD

|

Page 9: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 9

Mean Square Error - MSE

Excel: =SUMSQ(error range)/COUNT(error range)

Mean Absolute Percentage Error - MAPE

R2 - only for curve fitting model such as regression In general, the lower the error measure (BIAS,

MAD, MSE) or the higher the R2, the better the forecasting model

n

(Error)

n

Forecast) - (Actual MSE

22

nActual

|Forecast - Actual|

MAPE

%100*

Evaluation of Forecasting Model

Page 10: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 10

Time Series Model Building

Historical data collection

Data plotting (time series plot)

Forecasting model building

Evaluation and selection of model

Forecasting with the final selected model

Page 11: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 11

Components of A Time Series

Trend: long term overall up or down

movement

Seasonality: periodic pattern repeating every

year

Cycles: up & down movement repeating over long time

frame

Random Variations: random movements follow no pattern

Page 12: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 12

Components of A Time Series

Time

Trend

Randommovement

Time

Cycle

Time

Seasonalpattern

Dem

and

Time

Trend with seasonal pattern

Page 13: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 13

Types of Time Series Models

Nonseasonal Model Trend Naïve Moving average Exponential

Seasonal Model Time Series Decomposition

Page 14: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 14

Trend Model Curve fitting method used for time series

data (also called time series regression model) Useful when the time series has a clear trend Can not capture seasonal patterns

Linear Trend Model: Yt = a + bt t is time index for each period, t = 1, 2, 3,…

0

1

2

3

4

5

6

7

1 2 3 4 5 6 7 8 9 10

Page 15: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 15

Trend Model (Cont.)Nonlinear Trend Models

Power: Yt = atb

Quadratic: Yt = a + bt + ct2

0

500

1000

1500

2000

2500

3000

1 2 3 4 5 6 7 8 9 10

Power

Quadratic

Page 16: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 16

Naïve Model The simplest time series forecasting model

Idea: “what happened last time (last year, last

month, yesterday) will happen again this time”

Naïve Model: Algebraic: Ft = Yt-1

Yt-1 : actual value in period t-1

Ft : forecast for period t

Spreadsheet: B3: = A2; Copy down

Page 17: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 17

Moving Average Model Simple n-Period Moving Average

Issues of MA Model Naïve model is a special case of MA with n = 1 Idea is to reduce random variation or smooth data All previous n observation are treated equally (equal

weights) Suitable for relatively stable time series with no trend or

seasonal pattern

nnt

Y2t

Y1t

Y=

n

periodsn previousin valuesactual of Sumt

F

Page 18: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 18

Smoothing Effect of MA Model

Longer-period moving averages (larger n) react to actual changes more slowly

Page 19: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 19

Moving Average Model Weighted n-Period Moving Average

Typically weights are decreasing:

w1>w2>…>wn

Sum of the weights = wi = 1

Flexible weights reflect relative importance of each previous observation in forecasting

Optimal weights can be found via Solver

ntY

nw

2tY

2w

1tY

1 w=

tF

Page 20: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 20

Weighted MA: An Illustration

Month Weight Data

August 17% 130

September 33% 110

October 50% 90

November forecast:

FNov = (0.50)(90)+(0.33)(110)+(0.17)(130)

= 103.4

Page 21: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 21

Simple Exponential SmoothingA special type of weighted moving average

Include all past observations Use a unique set of weights that weight recent observations

much more heavily than very old observations:

( )

( )

( )

1

1

1

2

3

weight

Decreasing weights given to older observations

0 1

Today

Page 22: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 22

Simple ES: The Model

New forecast = weighted sum of last period actual value and last period

forecast : Smoothing constant Ft : Forecast for period t

Ft-1: Last period forecast

Yt-1: Last period actual value

321

32

21

)1()1(

)1()1(

tttt

tttt

YaYYF

YYYF

11 )1( ttt FYF

Page 23: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 23

Simple Exponential Smoothing Properties of Simple Exponential

Smoothing

Widely used and successful model

Requires very little data

Larger , more responsive forecast; Smaller

, smoother forecast (See Table 13.2)

“best” can be found by Solver

Suitable for relatively stable time series

Page 24: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 24

Holt’s Model– Exponential Smoothing with Trend

Ft Forecast for period t

Lt Level term (intercept)

Tt Trend term (slope)

Yt-1 Last period actual value Smoothing constant for Level L Smoothing constant for Trend T

1-t1-ttt

1-t1-t1-tt

ttt

)T -1 ( ) L - L ( T

)T )(L - 1 ( Y L

T L F

Page 25: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 25

Basic Idea: a time series is composed of several basic components: Trend, Seasonality, Cycle, and Random Error

The multiplicative decomposition model:

These components contribute to time series value in a multiplicative way

Time Series Decomposition Model

ttt tt Error ySeasonalit Cycle Trend Y

Page 26: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 26

Time Series Decomposition The basic model is:

Y = Trend Cyclical Seasonal Error

Since we cannot easily extract or predict cycles, we will assume that the trend component will capture cycles during the forecast period

Since we have to live with error (cannot predict it), our model is simplified to: Y = Trend Seasonal

Page 27: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 27

I. Estimate Seasonal Component - Seasonal Index

Step 1: Calculate 1-Year Moving Averages For quarterly data, use 4-period MA For monthly data, use 12-period MA

Step 2: Calculate Centered Moving Averages Simple average of two adjacent MAs

Step 3: Calculate Seasonal Ratio (SR) SR = Y / CMA

Step 4: Calculate Seasonal Index (SI)

Page 28: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 28

Period Quarter Y Moving Average Centered Moving Avg Seasonal Ratio1 1 Y1

2 2 Y2

MA1=(Y1 +Y2 +Y3+ Y4)/43 3 Y3 CMA1=(MA1+MA2)/2 SR3,1=Y3/CMA1

MA2=(Y2 +Y3 +Y4+ Y5)/44 4 Y4 CMA2=(MA2+MA3)/2 SR4,1=Y4/CMA2

MA3=(Y3+ Y4+Y5+Y6)/45 1 Y5 CMA3=(MA3+MA4)/2 SR1,2=Y5/CMA3

MA4=(Y4 +Y5 +Y6+ Y7)/46 2 Y6 CMA4=(MA4+MA5)/2 SR2,2=Y6/CMA4

MA5=(Y5+Y6 +Y7+ Y8)/47 3 Y7 CMA5=(MA5+MA6)/2 SR3,2=Y7/CMA5

MA6=(Y6 +Y7 +Y8+ Y9)/48 4 Y8 CMA6=(MA6+MA7)/2 SR4,2=Y8/CMA6

MA7=(Y7 +Y8 +Y9+ Y10)/4

Calculate Seasonal Index (Steps 1-3)

Page 29: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 29

Illustration of Moving Average(MA) and Centered Moving Average (CMA)

Quarter 1 Quarter 2 Quarter 3 Quarter 4

Y1 Y2 Y3 Y4

1/1 6/303/312/15 5/15 8/15 11/159/30 12/31

MA1

3/32/15

Y5

Quarter 1

MA2

CMA

Page 30: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 30

Calculate Seasonal Index (Step 4)

Year Quarter 1 Quarter 2 Quarter 3 Quarter 412345

-SR1,2

SR1,3

SR1,4

SR1,5

-SR2,2

SR2,3

SR2,4

SR2,5

SR3,1

SR3,2

SR3,3

SR3,4

-

SR4,1

SR4,2

SR4,3

SR4,4

-Average ASR1 ASR2 ASR3 ASR4

S.I. SI1 = ASR1/GA SI2 = ASR2/GA SI3 = ASR3/GA SI4 = ASR4/GA

ASR = Average Seasonal Ratio GA = Grand Average = average of all ASR’s The average of Seasonal Indices (SI) must be 1

Page 31: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 31

II. Estimate Trend Component Step 1: Remove seasonal effect

Deseasonalized datat = Yt / SIt

Step 2: Fit a trend line to deseasonalized data using least squares method Step 3: Calculate the trend value for each

period Note: If the deseasonalized data look stable (no

apparent trend), simple exponential smoothing may be used in Steps 2 and 3 to calculate the forecast (rather than trend) for each period.

Page 32: DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.

Forecasting Models 32

III. Forecast

Combine seasonal and trend components

Ft = Trend Valuet Seasonal Indext

This final step is also called reseasonalizing

Trend Valuet is the trend estimate for the period t,

based on the trend model fitted to the deseasonalized data