Upcoming SlideShare
×

# Forcasting Techniques

2,274 views
2,089 views

Published on

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
2,274
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
157
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Forcasting Techniques

1. 1. Time SeriesAnalysisand Forecasting 1
2. 2. 2
3. 3. Introduction Any variable that is measured over time in sequential order is called a time series. We analyze time series to detect patterns. The patterns help in forecasting future values of the time series. Predicted valueThe time series exhibit adownward trend pattern. 3
4. 4. 20.1 Components of a TimeSeries A time series can consist of four components. Long - term trend (T). Cyclical effect (C). Seasonal effect (S). Random variation (R). A trend is a long term relatively smooth pattern or direction, that persists usually for more than one year. 4
5. 5. Components of a Time Series A time series can consists of four components. Long - term trend (T) Cyclical variation (C) Seasonal variation (S) Random variation (R) 6/90 6/93 6/96 6/99 6/02 A cycle is a wavelike pattern describing Cycles are seldom regular, and a long term behavior (for more than one often appear in combination with year). other components. 5
6. 6. Components of a Time Series A time series can consists of four components. Long - term trend (T). Cyclical effect (C). Seasonal effect (S). Random variation (R).The seasonal component of the time series 6/97 12/97 6/98 12/98 6/99exhibits a short term (less than one year)calendar repetitive behavior. 6
7. 7. Components of a Time Series A time series can consists of four components. Long - term trend (T). Cyclical effect (C). Seasonal effect (S). Random variation (R). We try to remove random variationRandom variation comprises the irregular thereby, identify the other components.unpredictable changes in the time series.It tends to hide the other (more predictable)components. 7
8. 8. 20.2 SmoothingTechniques To produce a better forecast we need to determine which components are present in a time series. To identify the components present in the time series, we need first to remove the random variation. This can be done by smoothing techniques. 8
9. 9. Moving Averages A k-period moving average for time period t is the arithmetic average of the time series values around period t. – For example: A 3-period moving average at period t is calculated by (yt-1 + yt + yt+1)/3 9
10. 10. Moving Average: ExampleExample 20.1 To forecast future gasoline sales, the last four years quarterly sales were recorded. Calculate the three-quarter and five-quarter moving average. Show the relevant graphs. Xm20-01 Period Year/Quarter Gas Sales 1 1 1 39 2 2 37 3 3 61 4 4 58 5 2 1 18 6 2 56 10
11. 11. Moving Average: Example Solution Period Gas 3-period 5-period Sales moving Avg. moving Avg. Solving by hand 1 39 * * (39+37+61)/3= 2 37 45.6667 * 42.6000 (37+61+58)/3= 3 (39+37+61+58+18)/5= 61 52.0000 4 58 45.6667 46.0000 5 18 44.0000 55.0000 6 56 52.0000 48.2000 7 82 55.0000 44.8000 8 27 50.0000 55.0000 9 41 45.6667 53.6000 10 69 53.0000 50.4000 11 49 61.3333 55.8000 12 66 56.3333 56.0000 13 54 54.0000 60.2000 14 42 62.0000 63.6000 15 90 66.0000 * 16 66 * * 11
12. 12. Moving Average: Smoothingeffect Moving Average 3-period moving average 100 Value 50 0 Comment: We can identify 1 2 3 4 5 6 7 8 9 10 11 12a 13 14component . trend 15 16 Data Point Notice how the averaging process removes some of the random variation. 12
13. 13. Moving Average: Smoothing effect 3-period moving average 100 80 60 40The 5-period 20 0moving average 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16removes morevariation than the 5-period moving average3-period moving 100 80average. 60 40 20 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 13
14. 14. Centered Moving AverageWith an even number of observationsincluded in the moving average, the averageis placed between the two periods in themiddle.To place the moving average in an actualtime period, we need to center it.Two consecutive moving averages arecentered by taking their average, and placingit in the middle between them. (This is used tograph the points.) 14
15. 15. Centered Moving Average:ExampleCalculate the 4-period moving average andcenter it, for the data given below: Period Time series Moving Avg. Centerd Mov.Avg.(2.5)1 15 19.0(3.5) 2 27 20.25 21.5(4.5)3 20 17.5 19.50 4 14 5 25 15 6 11
16. 16. Exponential Smoothing The exponential smoothing – When smoothing the method provides smoothed time series at time t, values for all the time > the exponential periods observed. smoothing method considers all the data available at t – The moving average method does not the(yt, yt-1,…) moving average method considers only the provide smoothed observations included in the values (moving calculation of the average average values) for value, and “forgets” the the first and last set of rest. periods. 16
17. 17. Exponentially Smoothed TimeSeries S = wy + (1-w)St-1 Stt = wytt + (1-w)St-1 St = exponentially smoothed time series at time t. yt = time series at time t. St-1 = exponentially smoothed time series at time t-1. w = smoothing constant, where 0 ≤ w ≤ 1. 17
18. 18. The Exponentially Smoothed Process Example 20.2 (Xm20-01) Calculate the gasoline sale smoothed time series using exponential smoothing with w = .2, and w = .7. Period Gas SalesSet S1 = y1 1 39 S1 = 39 S2 = wy2 + (1-w)S1 2 37 S2 = (.2)(37) + (1-.2)(39) = 38.6 S3 = wy3 + (1-w)S2 3 61 S3 = (.2)(61) + (1-.2)(38.6) = 43.1 4 58 5 18 6 56 . . . . 18
19. 19. The Exponentially SmoothedProcess Example 20.2-continued Exponential Smoothing, w=.2 Small ‘w’ provides 100 a lot of smoothing Value 50 Neither value of ‘w’ 0 reveals the seasonality. 1 3 5 7 9 11 13 15 Exponential Smoothing , w=.7 100 Value 50 0 1 3 5 7 9 11 13 15 19
20. 20. The Exponentially SmoothedProcess We will let Minitab do our exponential smoothing Stat>Time Series > Single Exp Smoothing This will give us the smoothed graph 20
21. 21. 20.3 Trend and Seasonal EffectsTrend Analysis The trend component of a time series can be linear or non-linear. It is easy to isolate the trend component using linear regression. For linear trend use the model y = β0 + β1t + ε. For non-linear trend with one (major) change in slope use the quadratic model y = β0 + β1t + β2t2 + ε 21
22. 22. Seasonal Analysis Seasonal variation may occur within a year or within a shorter period (month, week) To measure the seasonal effects we construct seasonal indexes. Seasonal indexes express the degree to which the seasons differ from the average time series value across all seasons. 22
23. 23. Computing Seasonal Indexes Remove the effects of the seasonal and random variations by regression analysis yt = b 0 + b 1 t ˆ• For each time period compute the ratio yt/yt > This is based on the Multiplicative Model. which removes most of the trend variation >• For each season calculate the average of yt/yt which provides the measure of seasonality.• Adjust the average above so that the sum of averages of all seasons is 1 (if necessary) 23
24. 24. The additive and multiplicative modelsThere are two mostly used general models todescribe the composition of a time series (Assuming no cyclical effects).The multiplicative model y t = Tt × S t × R tThe additive model yt = Tt + St + RtIn the seasonal index analysis performed here we usethe multiplicative model because it is mathematicallyeasier to handle. 24
25. 25. Seasonal indexes analysis The multiplicative model y t Tt × S t × R t = = St × R t ˆ yt Tt The regression line represents trend. yt • We see that the ratio represents the seasonality and ˆ yt the random effects. • Averaging these ratios for each season type removes the random effects and leaves the seasonality. 25
26. 26. Seasonal indexes analysis The multiplicative model y t Tt × S t × R t = = St × R t ˆ yt Tt Rate/Predicted rate 1.5 Note how no trend is observed, but 1 seasonality and randomness 0.5 still exist. 0 1 3 5 7 9 11 13 15 17 19 yt • Averaging the ratios for each season type removes ˆ yt the random effects and leaves the seasonality. 26
27. 27. Computing Seasonal Indexes Example 20.3 (Xm20-03) Calculate the quarterly seasonal indexes for hotel occupancy rate in order to measure seasonal variation. Data: Year Quarter Rate Year Quarter Rate Year Quarter Rate 1996 1 0.561 1998 1 0.594 2000 1 0.665 2 0.702 2 0.738 2 0.835 3 0.8 3 0.729 3 0.873 4 0.568 4 0.6 4 0.67 1997 1 0.575 1999 1 0.622 2 0.738 2 0.708 3 0.868 3 0.806 4 0.605 4 0.632 27
28. 28. Rationale for seasonal indexes Computing Seasonal Indexes Perform regression analysis for the model y = β0 + β1t + ε where t represents the time, and y represents the occupancy rate. Time (t) Rate ˆ y = .639368 + .005246t 1 0.561 2 0.702 3 0.800 4 0.568 Rate 5 0.575 6 0.738 7 0.868 8 0.605 0 5 10 15 20 25 . . The regression line represents trend. t . . 28
29. 29. yt / yt > The Ratiost yt ˆ yt Ratio1 .561 .645 .561/.645=.8702 .702 .650 .702/.650=1.083 …………………………………………………. =.639368+.005245(1) No trend is observed, but yt seasonality and randomness Rate/Predicted rate ˆt y still exist. 1.5 1 0.5 0 13 17 1 3 5 7 9 11 15 19 29
30. 30. The Average Ratios by SeasonsRate/Predicted rate 0.870 1.080 • To remove most of the random variation 1.221 but leave the seasonal effects,average 0.860 ˆ the terms yt / yt for each season. 0.864 1.100 1.284 Rate/Predicted rate 0.888 0.865 1.5 1.067 1.046 1 0.854 0.5 0.879 0.993 0 1.122 1 3 5 7 9 11 13 15 17 19 0.874 Average ratio for quarter 1: (.870 + .864 + .865 + .879 + .913)/5 = .878 0.913 1.138 Average ratio for quarter 2: (1.080+1.100+1.067+.993+1.138)/5 = 1.076 1.181 Average ratio for quarter 3: (1.221+1.284+1.046+1.122+1.181)/5 = 1.171 0.900 30 Average ratio for quarter 4: (.860 +.888 + .854 + .874 + .900)/ 5 = .875
31. 31. Adjusting the AverageRatios In this example the sum of all the averaged ratios must be 4, such that the average ratio per season is equal to 1. If the sum of all the ratios is not 4, we need to adjust them proportionately. Suppose the(Seasonal averaged ratio) (number of seasons) sum of ratios is equal to 4.1. Then eachSeasonal index be multipliedSum of averaged ratios ratio will = by 4/4.1. In our problem the sum of all the averaged ratios is equal to 4: .878 + 1.076 + 1.171 + .875 = 4.0. No normalization is needed. These ratios become the seasonal indexes. 31
32. 32. Interpreting the Seasonal Indexes The seasonal indexes tell us what is the ratio between the time series value at a certain season, and the overall seasonal average. 17.1% above the In our problem: annual average 117.1% 7.6% above the 12.5% below the annual average annual averageAnnual averageoccupancy (100%) 107.6% 87.8% 87.5% 12.2% below the annual average Quarter 1 Quarter 2 Quarter 3 Quarter 4 Quarter 1 Quarter 2 Quarter 3 Quarter 4 32
33. 33. The Smoothed Time Series The trend component and the seasonality component are recomposed using the y = ˆ ˆ t ˆ multiplicative model. T × S = (.639 + .0052t ) S ˆ t t t In period #1 ( quarter 1): ˆ ˆ ˆ y1 = T1 × S1 = (.639 + .0052(1))(.878) = .566 ˆ ˆ ˆ y 2 = T2 × S 2 = (.639 + .0052(2))(1.076) = .699 In period #2 ( quarter 2): 0.9 Actual series Smoothed series 0.8 0.7 0.6 0.5 The linear trend (regression) line 1 3 5 7 9 11 13 15 17 19 33
34. 34. Deseasonalized Time SeriesSeasonally adjusted time series = Actual time series Seasonal indexBy removing the seasonality, we canidentify changes in the other components ofthe time series, that might have occurredover time. 34
35. 35. Deseasonalized Time Series In period #1 ( quarter 1): y 1 / SI1 = .561/ .870 = .639 In period #2 ( quarter 2): y 2 / SI2 = .708 1.076 = .652 In period #5 ( quarter 1): y 5 / SI1 = .575 .870 = .661 There was a gradual increase in occupancy rate 1 0.8 0.6 0.4 0.2 0 0 5 10 15 20 25 35
36. 36. 20.4 Introduction toForecasting There are many forecasting models available o o o * * ? * o o * o * o o * * Model 1 * Model 2 Which model performs better? 36
37. 37. 20.4 Introduction toForecasting A forecasting method can be selected by evaluating its forecast accuracy using the actual time series.The two most commonly used measures of forecast accuracyare: n Mean Absolute Deviation ∑ y t − Ft MAD = t =1 Sum of Squares for Forecast Error n n SSE = ∑ ( y t − Ft )2 t =1 37
38. 38. Measures of ForecastAccuracy Choose SSE if it is important to avoid (even a few) large errors. Otherwise, use MAD.A useful procedure for model selection. Use some of the observations to develop several competing forecasting models. Run the models on the rest of the observations. Calculate the accuracy of each model (by comparing to actual data at a later time period). Select the model with the best (lowest) accuracy measure. 38
39. 39. Selecting a ForecastingModel Annual data from 1970 to 1996 were used to develop three forecasting models. Use MAD and SSE to determine which model performed best for 1997, 1998, 1999, and 2000. Forecast value Year Actual y Model 1 Model 2 Model 3 1997 129 136 118 130 1998 142 148 141 146 1999 156 150 158 170 2000 183 175 163 180 39
40. 40. Solution For model Actual y Forecast for y 1 in 1991 in 1991 129 −136 + 142 −148 + 156 −150 + 183 −175MAD = = 6.75 4SSE = (129 − 136) + (142 − 148) + (156 − 160) + (183 − 175) 2 = 185 2 2 2Summary of results Model 1 Model 2 Model 3 MAD 6.75 8.5 5.5 SSE 185 526 222 40
41. 41. Selecting a ForecastingModel In this case, Model 2 is inferior to both Models 1 and 3 Using MAD Model 3 is best Using SSE Model 1 is most accurate Choice – prefer model that consistently produces moderately accurate forecasts (Model 3) or one whose forecasts come quite close usually but misses badly in a small number of time periods (Model 1) 41
42. 42. 20.5 Forecasting Models The choice of a forecasting technique depends on the components identified in the time series. The techniques discussed next are: Exponential smoothing Seasonal indexes Autoregressive models (a brief discussion) 42
43. 43. Forecasting with ExponentialSmoothing The exponential smoothing model can be used to produce forecasts when the time series… exhibits gradual(not a sharp) trend no cyclical effects no seasonal effects Forecast for period t+k is computed by Ft+k = St t is the current period; St = ωyt + (1-ω)St-1 43
44. 44. Forecasting with ExponentialSmoothing - Example The quarterly sales (in \$ millions) of a department store chain were recorded for the years 1997 – 2000 44
45. 45. Forecasting with ExponentialSmoothing - ExampleQuarter 1997 1998 1999 20001 18 33 25 412 22 20 36 333 27 38 44 524 31 26 29 45 45
46. 46. Forecasting with ExponentialSmoothing - Example Si ngl e Ex ponent i al Smoot hi ng Pl ot f or Sal es 55 Y16 = 45 Variable Actual 50 Fits Smoothing Constant 45 Alpha 0.4 40 Accuracy Measures MAPE 22.4486 S16 = MAD 7.2311 41.8 Sales MSD 69.2590 35 30 25 20 2 4 6 8 10 12 14 16 I ndex 46
47. 47. Forecasting with ExponentialSmoothing - Example Forecast for period t+k is computed by (t = 16) Ft+k = St t is the current period; St = ωyt + (1-ω)St-1 F17= S16 = 41.8 F18= S16 = 41.8 F19= S16 = 41.8 F20= S16 = 41.8 47
48. 48. Computing Seasonal Indexes Example 20.3 (Xm20-03) Calculate the quarterly seasonal indexes for hotel occupancy rate in order to measure seasonal variation. Data: ˆ ˆ ˆ yt = Tt × S t = (.639 + .0052t ) S t ˆ Year Quarter Rate Year Quarter Rate Year Quarter Rate 1996 1 0.561 1998 1 0.594 2000 1 0.665 2 0.702 2 0.738 2 0.835 3 0.8 3 0.729 3 0.873 4 0.568 4 0.6 4 0.67 1997 1 0.575 1999 1 0.622 2 0.738 2 0.708 3 0.868 3 0.806 4 0.605 4 0.632 48
49. 49. Forecasting with SeasonalIndexes; Example Example 20.5 Use the seasonal indexes calculated in Example 21.3 along with the trend line, to forecast each quarter occupancy rate in 2001.The solution procedure Use simple linear regression to find the trend line. Use the trend line to calculate the trend values. To calculate Ft multiply the trend value for period t by the seasonal index of period t. 49
50. 50. Forecasting with SeasonalIndexes; Example The solution procedure 1. Use simple linear regression to find the trend line. From Minitab (Using decomposition ) Yt = .639 + .00525t 50
51. 51. Forecasting with SeasonalIndexes; Example The solution procedure: 2. Use the trend line to calculate the trend values Yt = .639 + .00525t We previously used 20 time periods Quarter 1: 0.639 + 0.00525(21) = 0.749 Quarter 2: 0.639 + 0.00525(22) = 0.755 Quarter 3: 0.639 + 0.00525(23) = 0.760 Quarter 4: 0.639 + 0.00525(24) = 0.765 51
52. 52. Forecasting with SeasonalIndexes; Example The solution procedure 3. To calculate Ft multiply the trend value for period t by the seasonal index of period t.Quarter 1: 0.749 X 0.878 = 0.658Quarter 2: 0.755 X 1.076 = 0.812Quarter 3: 0.760 X 1.171 = 0.890Quarter 4: 0.765 X 0.875 = 0.670We forecast that the quarterly occupancy rates for the next year will be 65.8%, 81.2%, 89% and 67%. 52
53. 53. Forecasting with Seasonal Indexes: Example (Summary) Solution The trend line was obtained from the regression analysis. y t = .639 + .00525t ˆ – For the year 2001 we have:y21 = .639 + .00525 (21) = .749ˆ F21 = .749(.878) t Trend value Quarter SI Forecast 21 .749 1 .878 .658 22 .755 2 1.076 .812 23 .760 3 1.171 .890 24 .765 4 .875 .670 53
54. 54. Problem 20-47 The revenues (in \$millions) of a chain of ice-cream stores are listed for each quarter during the previous 5 years. Use the handout with the plots etc. to answer the questions. 54
55. 55. Quarter 1996 1997 1998 1999 2000 1 16 14 17 18 21 2 25 27 31 29 30 3 31 32 40 45 52 4 24 23 27 24 32 55
56. 56. 20-47 1. Plot the time series. Is there a pattern? Does there appear to be A long term trend A cyclic effect A seasonal effect 2. Plot the 3-year moving balance. Does this change any of your answers from # 1? 56
57. 57. 20-47 - Answers Seems to be a long term trend – going upward. Does not seem to be a cyclic effect. Because we know the data is in quarter years, this seems to be a strong seasonal effect. The three year moving average plot strengthens these observations. 57
58. 58. 20-47 Why is exponential smoothing not recommended as a forecasting tool in this problem? Look at the exponential smoothing plot (w = 0.3) Does this confirm your answer above? 58
59. 59. 20-47 - Answers Exponential smoothing is not recommended as a forecasting tool for this problem because of the strong seasonal effect. The 0.3 gives a large smoothing effect, and the seasonality is no larger as evident. 59
60. 60. 20-47 Look at the trend analysis plots. Does the Linear or the Quadratic trend model seem to be better? Why? What is the equation of the trend line? 60
61. 61. 20-47 - Answers The linear model seems to fit well. The quadratic model doesn’t show much of a curve. Checking the MAD for both models shows 6.8716 for the linear model and 6.8784 for the quadratic model. Since the linear model has a slightly smaller MAD we will use it. The equation of the trend line, then, is Y = 20.2105 + 0.732331t 61
62. 62. 20.47 Predict the sales for the next 4 quarters using the trend analysis line. 62
63. 63. 20-47 - Answer The next 4 quarters are numbers 21, 22, 23, 24 Y = 20.21 + 0.732 t Y21 = [20.21 + 0.732 (21)] = 35.58 Y22 = [20.21 + 0.732 (22)] = 36.31 Y23 = [20.21 + 0.732 (23)] = 37.05 Y24 = [20.21 + 0.732 (24)] = 37.78 63
64. 64. 20-47 Using the seasonal indexes and the trend line, forecast revenues for the next four quarters. 64
65. 65. 20-47 - Answer The Fitted trend equation for the decomposition plot is Y = 21.7511 + 0.567732 t The next time period is number 21. Y21 = [21.75 + 0.568 (21)] * 0.63581 = 21.41 Y22 = [21.75 + 0.568 (22)] * 1.05732 = 36.21 Y23 = [21.75 + 0.568 (23)] * 1.36851 = 65
66. 66. 20-47 (continued) If the actual sales numbers for the next four quarters were 24, 40, 48, 36. Calculate the MAD for the predictions from the trend line and seasonal indexes. 66
67. 67. 20-47 - Answer MAD = |21.41 - 24| + |36.21 – 40| + |47.46 – 48| + |33.2 – 36| / 4 = (2.59 + 3.79 + .54 + .2.8 ) / 4 = 9.72/4 = 2.43 67
68. 68. 20-47 Go back to the linear trend equation forecasts. If the actual sales numbers for the next four quarters were 24, 40, 48, 36. Calculate the MAD. Which method of forecasting did a better job in this case? 68
69. 69. 20-47 Answers MAD = |35.58 - 24| + |36.31 – 40| + |37.05 – 48| + |37.78 – 36| / 4 = (11.58 + 3.69 + 10.95 + 1.78 ) / 4 = 28/4 = 7 This is the MAD for the trend analysis. The MAD for the seasonal trend analysis was 2.43. The seasonal trend analysis did the better job of forecasting. 69