Você está na página 1de 59

Analyzing and Forecasting Time-Series Data

Chapter Goals
After completing this chapter, you should be able to:
     Develop and implement basic forecasting models Identify the components present in a time series Compute and interpret basic index numbers Use smoothing-based forecasting models, including single and double exponential smoothing Apply trend-based forecasting models, including linear trend, nonlinear trend, and seasonally adjusted trend
2

The Importance of Forecasting


 Governments forecast unemployment, interest rates, and expected revenues from income taxes for policy purposes  Marketing executives forecast demand, sales, and consumer preferences for strategic planning  College administrators forecast enrollments to plan for facilities and for faculty recruitment  Retail stores forecast demand to control inventory levels, hire employees and provide training

Time-Series Data
 Numerical data obtained at regular time intervals  The time intervals can be annually, quarterly, daily, hourly, etc.  Example: Year: 1999 2000 2001 2002 2003 Sales: 75.3 74.2 78.5 79.7 80.2
4

Time Series Plot


  the vertical axis measures the variable of interest A time-series plot is a two-dimensional the horizontal axis corresponds to the time periods
U.S. Inflation Rate
16.00 14.00 12.00 10.00 8.00 6.00 4.00 2.00 0.00 1975 1977 1979 1981 1983 1985 1987 1989 1991 1993 1995 1997 1999 2001

plot of time series data

Inflation Rate (%)

Year

Time-Series Components
Time-Series
Trend Component Seasonal Component Cyclical Component Random Component

Trend Component
 Long-run increase or decrease over time
(overall upward or downward movement)

 Data taken over a long period of time


Sales

Time

Trend Component
 Trend can be upward or downward  Trend can be linear or non-linear
Sales Sales

(continued)

Time Downward linear trend Upward nonlinear trend

Time
8

Seasonal Component
 Short-term regular wave-like patterns  Observed within 1 year  Often monthly or quarterly
Sales
Summer Winter Spring Fall
9

Time (Quarterly)

Cyclical Component
 Long-term wave-like patterns  Regularly occur but may vary in length  Often measured peak to peak or trough to trough 1 Cycle
Sales

Year

10

Random Component
 Unpredictable, random, residual fluctuations  Due to random variations of
 Nature  Accidents or unusual events

 Noise in the time series

11

Index Numbers
 Index numbers allow relative comparisons over time  Index numbers are reported relative to a Base Period Index  Base period index = 100 by definition  Used for an individual item or measurement
12

Index Numbers
 Simple Index number formula:

(continued)

yt It ! 100 y0
where It = index number at time period t yt = value of the time series at time t y0 = value of the time series in the base period
13

Index Numbers: Example


 Company orders from 1995 to 2003:
Year 1995 1996 1997 1998 1999 2000 2001 2002 2003 Number of Orders 272 288 295 311 322 320 348 366 384 Index
(base year = 2000)

85.0 90.0 92.2 97.2 100.6 100.0 108.8 114.4 120.0

I1996

y1996 288 100 ! (100) ! 90 ! y 2000 320

Base Year: y 2000 320 I2000 ! 100 ! (100) ! 100 y 2000 320
I2003 y 2003 384 100 ! (100) ! 120 ! y 2000 320
14

Index Numbers: Interpretation


 Orders in 1996 were 90% of base year orders
y1996 288 I1996 ! 100 ! (100 ) ! 90 y 2000 320  Orders in 2000 were 100% of base year orders (by definition, since 2000 is the base year) y 2000 320 I2000 !  Orders100 ! 320 (100 ) ! 100 base year orders y 2000 in 2003 were 120% of I2003 ! y 2003 384 100 ! (100 ) ! 120 y 2000 320

15

Aggregate Price Indexes


 An aggregate index is used to measure the rate of change from a base period for a group of items Aggregate Price Indexes Unweighted aggregate price index Weighted aggregate price indexes Paasche Index Laspeyres Index
16

Unweighted Aggregate Price Index


Unweighted aggregate price index formula:

It
where

p ! p

(100 )

It = unweighted aggregate price index at time t 7pt = sum of the prices for the group of items at time t 7p0 = sum of the prices for the group of items in the base period
17

Unweighted Aggregate Price Index Example


 Combined expenses in 2004 were 18.8% higher in 2004 than in 2001 Automobile Expenses: Monthly Amounts ($):

Index
Year 2001 2002 2003 2004 Lease payment 260 280 305 310 Fuel 45 60 55 50 Repair 40 40 45 50
2004

Total
345 380 405 410

(2001=100) 100.0 110.1 117.4 118.8

I2004

p ! p

410 (100) ! (100) ! 118.8 345 2001

18

Weighted Aggregate Price Indexes


Paasche index Laspeyres index

It

q p ! q p
t t

(100 ) It

q p ! q p
0 0

(100 )

qt = weighting percentage at time t

q0 = weighting percentage at base period

pt = price in time period t p0 = price in the base period


19

Commonly Used Index Numbers


 Consumer Price Index  Producer Price Index  Stock Market Indexes
 Dow Jones Industrial Average  S&P 500 Index  NASDAQ Index

20

Deflating a Time Series


 Observed values can be adjusted to base year equivalent  Allows uniform comparison over time  Deflation formula: yt y adj t ! (100 ) It
where

y adjt

= adjusted time series value at time t yt = value of the time series at time t It = index (such as CPI) at time t
21

Deflating a Time Series: Example


 Which movie made more money (in real terms)?
Year Movie Title Total Gross $

1939 1977 1997

Gone With the Wind Star Wars Titanic

199 461 601

(Total Gross $ = Total domestic gross ticket receipts in $millions)


22

Deflating a Time Series: Example (continued)


 GWTW made about twice as much as Star Wars, and about 4 times as much as Titanic when measured in equivalent dollars Movie Total Gross CPI Gross adjusted to (base year = 1984) 1984 dollars Year Title

1939 1977 1997

Gone With the Wind Star Wars Titanic

199 461 601

13.9 60.6 160.5

1431.7 760.7 374.5

GWTW adj1984 !

199 (100) ! 1431.7 13.9

23

Trend-Based Forecasting
 Estimate a trend line using regression analysis
Year 1999 2000 2001 2002 2003 2004 Time Period (t) 1 2 3 4 5 6 Sales (y) 20 40 30 50 70 65

Use time (t) as the independent variable:

y ! b0  b1t

24

Trend-Based Forecasting
 Year 1999 2000 2001 2002 2003 2004 The linear trend model is: Time Period (t) 1 2 3 4 5 6 Sales (y) 20 40 30 50 70 65

(continued)

y ! 12.333  9.5714 t
Sales trend
80 70 60 50 40 30 20 10 0 0 1 2 3 4 5 6 7

sales

Year
25

Trend-Based Forecasting

Year 1999 2000 2001 2002 2003 2004 2005

(continued)

Forecast for time period 7:


Time Period (t) 1 2 3 4 5 6 7 Sales (y) 20 40 30 50 70 65 ??
80 70 60 50 40 30 20 10 0 0 1 2 3 4 5 6 7

y ! 12.333  9.5714 (7) ! 79.33 Sales

sales

Year
26

Comparing Forecast Values to Actual Data


 The forecast error or residual is the difference between the actual value in time t and the forecast value in time t:  Error in time t:

e t ! y t  Ft
27

Two common Measures of Fit


 Measures of fit are used to gauge how well the forecasts match the actual values MSE (mean squared error)
 Average squared difference between yt and Ft

MAD (mean absolute deviation)


 Average absolute value of difference between yt and Ft  Less sensitive to extreme values
28

MSE vs. MAD


Mean Square Error Mean Absolute Deviation
t

(y MSE !

 Ft )

| y MAD !

 Ft |

where: yt = Actual value at time t Ft = Predicted value at time t n = Number of time periods
29

Autocorrelation
Time (t) Residual Plot

(continued)

 Autocorrelation is correlation of the error terms (residuals) over time


15 10
Residuals

Here, residuals show a cyclic pattern, not random

5 0 -5 0 -10 -15
Time (t)

Violates the regression assumption that residuals are random and independent

30

Testing for Autocorrelation


 The Durbin-Watson Statistic is used to test for autocorrelation
H 0: HA : =0 0 (residuals are not correlated) (autocorrelation is present)

Durbin-Watson test statistic:


n

(e t  e t 1 )2 d!
t !1 n

e
t !1

2 t
31

Testing for Positive Autocorrelation


H 0: HA : =0 >0 (positive autocorrelation does not exist) (positive autocorrelation is present)

 Calculate the Durbin-Watson test statistic = d


(The Durbin-Watson Statistic can be found using PHStat or Minitab)

 Find the values dL and dU from the Durbin-Watson table


(for sample size n and number of independent variables p)

Decision rule: reject H0 if d < dL


Reject H0 Inconclusive Do not reject H0

dL

dU

2
32

Testing for Positive Autocorrelation


 Example with n = 25:
1 60 1 40 1 20 1 00

(continued)

Excel/PHStat output:
Durbin-Watson Calculations Sum of Squared Difference of Residuals Sum of Squared Residuals Durbin-Watson Statistic
n
Sales

80 60

y = 30.65 + 4.7038x 2 R = 0.8976

3296.18 3279.98 1.00494

40 20 0 0 5 1 0 1 5 20 25 30

Tim e

(e
d!
t !1

 e t 1 )2 !
2

et
t !1

3296 .18 ! 1.00494 3279 .98


33

Testing for Positive Autocorrelation


    Here, n = 25 and there is one independent variable

(continued)

Using the Durbin-Watson table, dL = 1.29 and dU = 1.45 d = 1.00494 < dL = 1.29, so reject H0 and conclude that significant positive autocorrelation exists Therefore the linear model is not the appropriate model to forecast sales
Decision: reject H0 since d = 1.00494 < dL
Reject H0 Inconclusive Do not reject H0

dL=1.29

dU=1.45

2
34

Nonlinear Trend Forecasting


 A nonlinear regression model can be used when the time series exhibits a nonlinear trend  One form of a nonlinear model:

yt !

t 

 Compare R2 and s to that of linear model to see if this is an improvement  Can try other functional forms to get best fit
35

Multiplicative Time-Series Model


 Used primarily for forecasting  Allows consideration of seasonal variation  Observed value in time series is the product of components

y t ! Tt v S t v C t v It
Tt = Trend value at time t Ct = Cyclical value at time t

where

St = Seasonal value at time t It = Irregular (random) value at time t


36

Finding Seasonal Indexes


Ratio-to-moving average method:  Begin by removing the seasonal and irregular components (St and It), leaving the trend and cyclical components (Tt and Ct)  To do this, we need moving averages Moving Average: averages of consecutive time series values
37

Moving Averages
 Used for smoothing  Series of arithmetic means over time  Result dependent upon choice of L (length of period for computing means)  To smooth out seasonal variation, L should be equal to the number of seasons
 For quarterly data, L = 4  For monthly data, L = 12
38

Moving Averages
 Example: Four-quarter moving average

(continued)

 First average:
Moving average 1 ! Q1  Q2  Q3  Q4 4

 Second average:
Q2  Q3  Q4  Q5 Moving average 2 ! 4
etc
39

Seasonal Data
Quarter
1 2 3 4 5 6 7 8 9 10 11 etc Sales 23 40 25 27 32 48 33 37 37 50 40 etc
60 50 Sales 40 30 20 10 0 1 2 3 4 5 6 Quarter 7 8 9 10

Quarterly Sales

11

40

Calculating Moving Averages


 Each moving average is for a consecutive block of 4 quarters 4-Quarter
Sales 23 40 25 27 32 48 33 37 37 50 40
41

Quarter 1 2 3 4 5 6 7 8 9 10 11

Average Period 2.5 3.5 4.5 5.5 6.5 7.5 etc 8.5 9.5

Moving Average 28.75 31.00 33.00 35.00 37.50 38.75 39.25 41.00

2.5 !

1 2  3  4 4 23  40  25  27 4

28.75 !

Centered Moving Averages


 Average periods of 2.5 or 3.5 dont match the original quarters, so we average two consecutive moving averages to get centered moving averages
Average Period 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 4-Quarter Moving Average 28.75 31.00 33.00 35.00 etc 37.50 38.75 39.25 41.00
42

Centered Period 3 4 5 6 7 8 9

Centered Moving Average 29.88 32.00 34.00 36.25 38.13 39.00 40.13

Calculating the Ratio-to-Moving Average


 Now estimate the St x It value  Divide the actual sales value by the centered moving average for that quarter  Ratio-to-Moving Average formula:

yt S t v It ! Tt v C t

43

Calculating Seasonal Indexes


Quarter 1 2 3 4 5 6 7 8 9 10 11 Sales 23 40 25 27 32 48 33 37 37 50 40 Centered Moving Average Ratio-toMoving Average

29.88 32.00 34.00 36.25 38.13 39.00 40.13 etc

0.837 0.844 0.941 1.324 0.865 0.949 0.922 etc

25 0.837 ! 29.88

44

Calculating Seasonal Indexes (continued)


Quarter 1 2 3 4 5 6 7 8 9 10 11 Sales 23 40 25 27 32 48 33 37 37 50 40 Centered Moving Average Ratio-toMoving Average

Fall

Fall

Fall

29.88 32.00 34.00 36.25 38.13 39.00 40.13 etc

0.837 0.844 0.941 1.324 0.865 0.949 0.922 etc

Average all of the Fall values to get Falls seasonal index Do the same for the other three seasons to get the other seasonal indexes
45

Interpreting Seasonal Indexes


 Suppose we get these seasonal indexes: Season Spring Summer Fall Winter Seasonal Index 0.825 1.310 0.920 0.945
7 = 4.000 -- four seasons, so must sum to 4
46

Interpretation:
Spring sales average 82.5% of the annual average sales Summer sales are 31.0% higher than the annual average sales etc

Deseasonalizing
 The data is deseasonalized by dividing the observed value by its seasonal index

yt Tt v C t v It ! St
This smooths the data by removing seasonal variation
47

Deseasonalizing
Quarter 1 2 3 4 5 6 7 8 9 10 11 Sales 23 40 25 27 32 48 33 37 37 50 40 Seasonal Index 0.825 1.310 0.920 0.945 0.825 1.310 0.920 0.945 0.825 1.310 0.920 Deseasonalized Sales 27.88 30.53 27.17 28.57 38.79 36.64 35.87 39.15 44.85 38.17 43.48

(continued)

27.88 ! etc

23 0.825

48

Unseasonalized vs. Seasonalized


Sales: Unseasonalized vs. Seasonalized
60 50 40 30 20 10 0 1 2 3 4 5 6 7 8 9 10 11

Sales

Quarter
Sales Deseasonalized Sales
49

Forecasting Using Smoothing Methods


Exponential Smoothing Methods

Single Exponential Smoothing

Double Exponential Smoothing

50

Single Exponential Smoothing


 A weighted moving average
 Weights decline exponentially  Most recent observation weighted most

 Used for smoothing and short term forecasting

51

Single Exponential Smoothing (continued)


 The weighting factor is E
 Subjectively chosen  Range from 0 to 1  Smaller E gives more smoothing, larger E gives less smoothing

 The weight is:


 Close to 0 for smoothing out unwanted cyclical and irregular components  Close to 1 for forecasting
52

Exponential Smoothing Model




Single exponential smoothing model

Ft 1 ! Ft  E( y t  Ft )
or:

Ft 1 ! Ey t  (1  E )Ft
where: Ft+1= forecast value for period t + 1 yt = actual value for period t Ft = forecast value for period t E = alpha (smoothing constant)
53

Exponential Smoothing Example


 Suppose we use weight E = .2
Quarter (t) 1 2 3 4 5 6 7 8 9 10 etc Sales (yt) 23 40 25 27 32 48 33 37 37 50 etc Forecast from prior period NA 23 26.4 26.12 26.296 27.437 31.549 31.840 32.872 33.697 etc Forecast for next period (Ft+1) 23 (.2)(40)+(.8)(23)=26.4 (.2)(25)+(.8)(26.4)=26.12 (.2)(27)+(.8)(26.12)=26.296 (.2)(32)+(.8)(26.296)=27.437 (.2)(48)+(.8)(27.437)=31.549 (.2)(48)+(.8)(31.549)=31.840 (.2)(33)+(.8)(31.840)=32.872 (.2)(37)+(.8)(32.872)=33.697 (.2)(50)+(.8)(33.697)=36.958 etc F1 = y1 since no prior information exists
Ft 1 ! Ey t  (1  E )Ft

54

Sales vs. Smoothed Sales


  Seasonal fluctuations have been smoothed NOTE: the smoothed value in this case is generally a little 60 low, since the trend is upward sloping and the weighting 50 factor is only .2
40

Sales

30 20 10 0 1 2 3 4 5

Quarter

10

Sales

Smoothed

55

Double Exponential Smoothing


 Double exponential smoothing is sometimes called exponential smoothing with trend  If trend exists, single exponential smoothing may need adjustment  Add a second smoothing constant to account for trend

56

Double Exponential Smoothing Model


C t ! Ey t  (1  E )(C t 1  Tt 1 )

Tt ! F(C t  C t 1 )  (1  F)Tt 1
Ft 1 ! C t  Tt
where: yt = actual value in time t E = constant-process smoothing constant F = trend-smoothing constant Ct = smoothed constant-process value for period t Tt = smoothed trend value for period t Ft+1= forecast value for period t + 1 t = current time period
57

Double Exponential Smoothing


 Double exponential smoothing is generally done by computer  Use larger smoothing constants E and less smoothing is desired  Use smaller smoothing constants E and when more smoothing is desired when

58

Exponential Smoothing in Excel


 Use tools / data analysis / exponential smoothing
 The damping factor is (1 - E)

59

Você também pode gostar