Forecasting (1).ppt
Transcript of Forecasting (1).ppt
Forecasting
Rohit Kapoor
Motivating Example: A Reality• When Big Bazaar launched this scheme, “Sabse Sasta Teen Din”,
in 2006, they sold goods worth of Rs. 260 million. Encouraged by the response, they ran the scheme for 3 days in 2007. During this 3-day period, approximately 6 million people visited their stores. The 43 outlets of Big Bazaar sold goods worth Rs. 1.25 billion. A total of 108 thousands bed-sheets, 30,000 cell-phones and 11,000 pieces of apparel were sold. There were reports that the company had to shutdown many of the outlets as they had not anticipated the customer response and the stocks of several popular items had been exhausted.
• Learning: predicting the demand for such schemes is always tricky
Characteristics of Forecasts• During the economic downturn in 2001, CISCO found that its sales plunged by
30 percent and it was stuck with huge inventory. CISCO decided to write - off an inventory of $2.2 billion, and CISCO’s stock price dropped to a record low at $13.36 (stock price was quoted at $83 in 2000). Though all networking companies are affected by the downturn, the losses suffered by CISCO surprised everyone. CSICO relied very heavily on its state of the art “virtual close” software and expected that demand will rise when other companies in the industry expected the demand to decline. CISCO’s software had built-in growth bias and was not designed to capture the impact of change in economy. Experts believe that this over reliance on the forecasting technology led people to undervalue human judgment and intuition, and inhibited frank conversations among supply chain partners. The CEO John Chambers admitted in the interview that “We never built models to anticipate something of this magnitude”
www.cio.com/article/viewArticle/30413/What_Went_Wrong_at_Cisco_in.
Characteristics of Forecasts … Contd.
• Longer the forecast horizon, the worse the forecast– 7-Eleven Japan has exploited this key property to improve
its performance. The company has instituted a replenishment process that enables it to respond to an order within hours. For example, if a store manager places an order by 10:00 AM, the order is delivered by 7:00 PM the same day. Therefore, the manager only has to forecast what will sell that night less than 12 hours before the actual sale.
• Aggregate forecasts are more accurate • Farther up the supply chain, more will be the error
in forecasting
An Interesting Forecasting by Asian Paints
Asian Paints found that in certain districts of Maharashtra there is a spike in demand for a 50-100 ml packs of deep orange shade during a specific period of the year. Further investigations revealed that a few districts of Maharashtra observe a local festival called Pola, and during that festival, farmers paint the horns of bullocks with deep orange shade. Asian Paints is aware of the fact that the paint-buying decision is linked to festivals, and India being a diverse country with different regions celebrating various festivals at different times of the year, it is important for Asian Paints to capture the same in their forecasting models.
www.cio.in/article/view/viewArticle?ARTICLEID=1237
Analytical Methods for Forecasting
• Static Methods• Adaptive Methods• Casual Methods
Static Methods
• Case 1: Forecasting the trend form• Case 2: Forecasting seasonality• Case 3: Forecasting combination of
seasonality and trend
Case 1: Forecasting the Trend Form
• A constant increase or decrease in demand denotes– Linear trend– Model
• Forecast (t) = a + b * t
Case 1: Forecasting the Trend Form
t D(t)1 3282 3103 3554 3625 3756 3807 4088 4159 41710 41211 42912 43413 44914 47115 47516 489
D(t)
0
100
200
300
400
500
600
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Period
Dem
and
D(t)
Case 1: Forecasting the Trend Form … Calculations
t D(t) t-Tavg D(t) - Davg (t-Tavg) * (D(t)-Davg) (t-tavg)^2 Forecast Abs error1 328 -7.5 -78.81 591.09 56.25 326.40 1.602 310 -6.5 -96.81 629.28 42.25 337.12 27.123 355 -5.5 -51.81 284.97 30.25 347.84 7.164 362 -4.5 -44.81 201.66 20.25 358.56 3.445 375 -3.5 -31.81 111.34 12.25 369.29 5.716 380 -2.5 -26.81 67.03 6.25 380.01 0.017 408 -1.5 1.19 -1.78 2.25 390.73 17.278 415 -0.5 8.19 -4.09 0.25 401.45 13.559 417 0.5 10.19 5.09 0.25 412.17 4.8310 412 1.5 5.19 7.78 2.25 422.90 10.9011 429 2.5 22.19 55.47 6.25 433.62 4.6212 434 3.5 27.19 95.16 12.25 444.34 10.3413 449 4.5 42.19 189.84 20.25 455.06 6.0614 471 5.5 64.19 353.03 30.25 465.78 5.2215 475 6.5 68.19 443.22 42.25 476.51 1.5116 489 7.5 82.19 616.41 56.25 487.23 1.77
Mean 8.5 406.8125 7.57Sum 3645.5 340
b 10.72206a 315.675
Forecast vs. Actual Demand
Actual Demand vs. Forecasted Demand
0
100
200
300
400
500
600
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Period
Dem
and
D(t)
Forecast
Estimating Forecasting Error
• Four ways:– Mean error (ME)
• Value close to 0– Magnitude of the error?
– Mean absolute deviation (MAD)– Mean square error (MSE)
• Higher value of error should attract higher penalties!– Mean absolute percentage error (MAPE)
Different Estimates of Forecast Error
Month Sales Forecast ErrorAbsolute Deviation
Square Error
Absolute % Error
1 328 326 2 2 4 0.61%2 310 337 -27 27 729 8.71%3 355 348 7 7 49 1.97%4 362 359 3 3 9 0.83%5 375 369 6 6 36 1.60%6 380 380 0 0 0 0.00%7 408 391 17 17 289 4.17%8 415 401 14 14 196 3.37%9 417 412 5 5 25 1.20%10 412 423 -11 11 121 2.67%11 429 434 -5 5 25 1.17%12 434 444 -10 10 100 2.30%13 449 455 -6 6 36 1.34%14 471 466 5 5 25 1.06%15 475 476 -1 1 1 0.21%16 489 487 2 2 4 0.41%
Mean 0.0625 7.5625 103.0625 1.98% ME MAD MSE MAPE
Case 2: Forecasting Seasonality
Time Block
Period within block Demand
1 1 62 2 553 3 2494 4 6465 1 246 2 737 3 1408 4 5699 1 1210 2 2811 3 13612 4 631
1
2
3
Case 2: Forecasting Seasonality
• Periodicity – p = 4
• Peak demand at 4, 8, 12• Lowest demand at 1, 5, 9• Data is divided into blocks
– m blocks having p demand periods– Seasonality index
» Block j and period i» Seasonality index for ith period» Average seasonality index for period i across the blocks
Case 2: Forecasting Seasonality …Some Equations
• Seasonality index of period i for block j– S(i, j) = (di)/[(d1 + d2 + … + dp)/p]
• For each period i within block j
• Average seasonality index for period i within a block – S(i)
Case 2: Forecasting Seasonality … Analysis
Time Block
Period within block Demand Average
Seasonal Index of Period
1 1 6 0.032 2 55 0.233 3 249 1.044 4 646 2.705 1 24 0.126 2 73 0.367 3 140 0.698 4 569 2.829 1 12 0.0610 2 28 0.1411 3 136 0.6712 4 631 3.13
1
2
3
239
201.5
201.75
Case 2: Forecasting Seasonality …Seasonality Index Calculation
Period/Block S(i, 1) S(i, 2) S(i, 3)
Average Seasonality
Index1 0.03 0.12 0.06 0.072 0.23 0.36 0.14 0.243 1.04 0.69 0.67 0.804 2.70 2.82 3.13 2.88
Case 2: Forecasting Seasonality … De-seasonalizing Demand
• De-seasonalized demand data (t)– Demand(t)/S(t)
• Forecast (t)– [Level (t)] * Seasonal index (t)
Case 2: Forecasting Seasonality … Calculations
Time Block
Period within block Demand Average
Seasonal Index of Period
De-Seasonlized
Demand Forecast Abs Error1 1 6 0.03 88 14 82 2 55 0.23 226 52 33 3 249 1.04 310 171 784 4 646 2.70 224 613 335 1 24 0.12 353 14 106 2 73 0.36 300 52 217 3 140 0.69 174 171 318 4 569 2.82 197 613 449 1 12 0.06 177 14 210 2 28 0.14 115 52 2411 3 136 0.67 169 171 3512 4 631 3.13 219 613 18
Mean 213 26
1
2
3
239
201.5
201.75
Case 2: Forecasting Seasonality … Fit
Case 3: Forecasting Combination of Seasonality and Trend
Quarter Sales1 452 3353 5204 1005 706 3707 5908 1709 10010 58511 83012 28513 10014 72515 116016 310
Sales
0
200
400
600
800
1000
1200
1400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Quarter
Dem
and
Sales
Case 3: Forecasting Combination of Seasonality and Trend
• Observation– Seasonality with periodicity, p = 4– Demand seems to be increasing every year
• Hence, trend component is also present
Case 3: Forecasting Combination of Seasonality and Trend
• Methodology– Forecasting model
• Demand (t) = (Level (t) + Trend parameter * t) * Seasonality parameter (t) + random error
– Step 1: Determine the seasonality index for each time period within a block (similar to Case 2)
– Step 2: De-seasonalize the demand data (similar to Case 2)
– Step 3: Determine the trend and level components for the de-seasonalized data series (similar to Case 1)
– Step 4: Finalize the forecasting model
Case 3: Forecasting Combination of Seasonality and Trend …
AnalysisTime Block
Period within Block Demand
Average Demand
Seasonality Index
1 1 45 0.182 2 335 1.343 3 520 2.084 4 100 0.405 1 70 0.236 2 370 1.237 3 590 1.978 4 170 0.579 1 100 0.2210 2 585 1.3011 3 830 1.8412 4 285 0.6313 1 100 0.1714 2 725 1.2615 3 1160 2.0216 4 310 0.54
1
2
3
4
250
300
450
573.75
Case 3: Forecasting Combination of Seasonality and Trend …
Analysis
Period/Block 1 2 3 4
Average Seasonality
Index1 0.18 0.23 0.22 0.17 0.202 1.34 1.23 1.30 1.26 1.283 2.08 1.97 1.84 2.02 1.984 0.40 0.57 0.63 0.54 0.54
Case 3: Forecasting Combination of Seasonality and Trend …
AnalysisTime
De-seasonlized
Demand t-Tavg D(t) - Davg (t-Tavg) * (D(t) - Davg) (t-tavg)^21 222 -7.5 -172 1290.14 56.252 261 -6.5 -133 867.28 42.253 263 -5.5 -131 722.82 30.254 187 -4.5 -207 933.27 20.255 346 -3.5 -49 169.89 12.256 288 -2.5 -106 265.44 6.257 298 -1.5 -96 144.05 2.258 318 -0.5 -77 38.29 0.259 494 0.5 100 49.82 0.2510 456 1.5 61 91.86 2.2511 420 2.5 25 63.21 6.2512 533 3.5 138 484.23 12.2513 494 4.5 100 448.37 20.2514 565 5.5 170 936.40 30.2515 586 6.5 192 1248.66 42.2516 579 7.5 185 1388.05 56.25
Mean 8.5 394.28Sum b 27 9141.77 340
a 165.74
Case 3: Forecasting Combination of Seasonality and Trend …
Analysis• Step 1, 2 and 3 are complete• Step 4:
– Forecast(t) = (165.74 + 27 * t) * Seasonality Index(t)
Case 3: Forecasting Combination of Seasonality and Trend …
AnalysisTime Block
Period within Block Demand Average Demand
Seasonality Index
De-seasonlized
Demand Forecast Abs Error1 1 45 0.18 222 39 62 2 335 1.34 261 282 533 3 520 2.08 263 487 334 4 100 0.40 187 146 465 1 70 0.23 346 61 96 2 370 1.23 288 420 507 3 590 1.97 298 700 1108 4 170 0.57 318 204 349 1 100 0.22 494 83 1710 2 585 1.30 456 558 2711 3 830 1.84 420 913 8312 4 285 0.63 533 261 2413 1 100 0.17 494 104 414 2 725 1.26 565 696 2915 3 1160 2.02 586 1126 3416 4 310 0.54 579 319 9
1
2
3
4
250
300
450
573.75
Case 3: Forecasting Combination of Seasonality and Trend … Fit
Forecasted Demand Vs. Actual Demand
0
200
400
600
800
1000
1200
1400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Period
Dem
and Demand
Forecast
Adaptive Methods
• Moving Average• Simple Exponential Smoothening• Holt’s Method• Winter’s Method
Basic DataMonth TV Sales CD Sales AC Sales
1 30 40 132 32 47 73 30 50 234 39 49 325 33 56 586 34 53 607 34 55 908 38 63 939 36 68 6310 39 65 3911 30 72 3712 36 69 2913 38 79 3614 30 82 2115 35 80 4716 30 85 8117 34 94 11218 40 89 13919 36 96 23020 32 100 20121 40 100 12222 36 105 8423 40 108 7424 34 110 62
TV SalesTV Sales
05
1015202530354045
1 3 5 7 9 11 13 15 17 19 21 23
Month
T V
Sale
s
TV Sales
CD SalesCD Sales
0
20
40
60
80
100
120
1 4 7 10 13 16 19 22Month
CD
Sal
es
CD Sales
AC Sales
Moving Average Method
• Time series that fluctuates about a constant base level
• Ft,1 – Forecast for period t + 1made after observing xt
– Ft,1= Average of last N observations = average of xt, xt-1, xt-2, …, xt-N+1
Moving Average Method Calculations
Month TV Sales MAF (N = 2) Error MAF (N = 3) Error MAF (N = 4) Error MAF (N = 5) Error MAF (N = 6) Error1 302 323 30 31 14 39 31 8 30.67 8.335 33 34.5 1.5 33.67 0.67 32.75 0.256 34 36 2 34.00 0.00 33.50 0.50 32.80 1.207 34 33.5 0.5 35.33 1.33 34.00 0.00 33.60 0.40 33.00 1.008 38 34 4 33.67 4.33 35.00 3.00 34.00 4.00 33.67 4.339 36 36 0 35.33 0.67 34.75 1.25 35.60 0.40 34.67 1.3310 39 37 2 36.00 3.00 35.50 3.50 35.00 4.00 35.67 3.3311 30 37.5 7.5 37.67 7.67 36.75 6.75 36.20 6.20 35.67 5.6712 36 34.5 1.5 35.00 1.00 35.75 0.25 35.40 0.60 35.17 0.8313 38 33 5 35.00 3.00 35.25 2.75 35.80 2.20 35.50 2.5014 30 37 7 34.67 4.67 35.75 5.75 35.80 5.80 36.17 6.1715 35 34 1 34.67 0.33 33.50 1.50 34.60 0.40 34.83 0.1716 30 32.5 2.5 34.33 4.33 34.75 4.75 33.80 3.80 34.67 4.6717 34 32.5 1.5 31.67 2.33 33.25 0.75 33.80 0.20 33.17 0.8318 40 32 8 33.00 7.00 32.25 7.75 33.40 6.60 33.83 6.1719 36 37 1 34.67 1.33 34.75 1.25 33.80 2.20 34.50 1.5020 32 38 6 36.67 4.67 35.00 3.00 35.00 3.00 34.17 2.1721 40 34 6 36.00 4.00 35.50 4.50 34.40 5.60 34.50 5.5022 36 36 0 36.00 0.00 37.00 1.00 36.40 0.40 35.33 0.6723 40 38 2 36.00 4.00 36.00 4.00 36.80 3.20 36.33 3.6724 34 38 4 38.67 4.67 37.00 3.00 36.80 2.80 37.33 3.33
Moving Average Method
N MAD2 3.273 3.214 2.785 2.796 3.08
Simple Exponential Smoothing
• A time series that fluctuates about a base level
• At = αxt + (1 – α) At-1
• A0 = 32• α = 0.1
Simple Exponential SmoothingCalculations
Month TV Sales Forecast At et1 30 32 31.8 2.002 32 31.8 31.82 0.203 30 31.82 31.64 1.824 39 31.64 32.37 7.365 33 32.37 32.44 0.636 34 32.44 32.59 1.567 34 32.59 32.73 1.418 38 32.73 33.26 5.279 36 33.26 33.53 2.7410 39 33.53 34.08 5.4711 30 34.08 33.67 4.0812 36 33.67 33.91 2.3313 38 33.91 34.32 4.0914 30 34.32 33.88 4.3215 35 33.88 34.00 1.1216 30 34.00 33.60 4.0017 34 33.60 33.64 0.4018 40 33.64 34.27 6.3619 36 34.27 34.45 1.7320 32 34.45 34.20 2.4521 40 34.20 34.78 5.8022 36 34.78 34.90 1.2223 40 34.90 35.41 5.1024 34 35.41 35.27 1.41
Simple Exponential Smoothing
Alpha MAD0.05 3.200.1 3.04
0.15 2.940.2 2.89
0.25 2.880.3 2.90
0.35 2.940.4 2.98
0.45 3.050.5 3.14
Simple Exponential Smoothing … some concepts
• If α = 2/(N + 1)– Equivalent to N-period moving average
• Larger the value of α– More weight is given to the most recent
observations• α = 0.2?• α = 0.5?
Holt’s Method: Exponential Smoothing with Trend
• Base Level at the end of tth period = Lt
• The per-period trend at the end of tth period = Tt
– For e.g., if L20 = 20 and T20 = 2. Implication?
• Lt = αxt + (1 – α) (Lt-1 + Tt-1)
• Tt = β(Lt - Lt-1 ) + (1 – β) Tt-1
• Ft,k = Lt + k * Tt
• T0 = average monthly increase in the time series during the previous year
• L0 = Last month’s observation
Holt’s Method Calculations
• Let, the CD sales during each of the last 12 months are given by 4, 6, 8, 10, 14, 18, 20, 22, 24, 28, 31, 34.
• T0 = [(6 - 4) + (8 – 6) + (10 – 8) + … + (34 – 31)]/11 = 2.73
• L0 = 34• α = 0.3• β = 0.1
Holt’s Method CalculationsMonth CD Sales Lt Tt ft-1,1 et
1 40 37.71 2.83 36.73 3.272 47 42.47 3.02 40.53 6.473 50 46.85 3.15 45.49 4.514 49 49.70 3.12 50.00 1.005 56 53.78 3.22 52.82 3.186 53 55.80 3.10 57.00 4.007 55 57.73 2.98 58.90 3.908 63 61.40 3.05 60.71 2.299 68 65.51 3.16 64.45 3.5510 65 67.57 3.05 68.67 3.6711 72 71.03 3.09 70.62 1.3812 69 72.59 2.94 74.12 5.1213 79 76.57 3.04 75.52 3.4814 82 80.32 3.11 79.61 2.3915 80 82.40 3.01 83.44 3.4416 85 85.29 3.00 85.41 0.4117 94 90.00 3.17 88.29 5.7118 89 91.92 3.04 93.17 4.1719 96 95.27 3.07 94.96 1.0420 100 98.84 3.12 98.35 1.6521 100 101.38 3.06 101.97 1.9722 105 104.61 3.08 104.44 0.5623 108 107.78 3.09 107.69 0.3124 110 110.61 3.06 110.87 0.87
Choice of α & βBeta
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.90.1 2.86 2.80 2.74 2.70 2.75 2.80 2.83 2.86 2.920.2 2.77 2.73 2.76 2.79 2.84 2.92 2.97 2.98 2.990.3 2.85 2.87 2.91 2.95 2.99 3.04 3.13 3.22 3.29
Alpha 0.4 2.96 3.00 3.05 3.11 3.17 3.23 3.30 3.35 3.390.5 3.07 3.13 3.19 3.25 3.31 3.36 3.43 3.50 3.580.6 3.19 3.26 3.33 3.40 3.48 3.59 3.69 3.78 3.880.7 3.32 3.39 3.47 3.60 3.72 3.84 3.95 4.07 4.210.8 3.43 3.53 3.67 3.81 3.94 4.07 4.27 4.47 4.680.9 3.54 3.69 3.85 4.02 4.23 4.46 4.69 4.95 5.25
Winter’s Method• c = number of periods in the length of the seasonal
pattern – c = 4 for quarterly data; c = 12 for monthly data.
• st = seasonal multiplicative factor for month t, obtained after observing xt. – Month 7 is July and s7 = 2 (lets say!)– After observing month’s 7 air conditioner sales, we believe that
July’s air conditioner sales will (all other things being equal)• Equal twice the sales expected during an average month.
– If month 24 is December and s24 = 0.4, what will be the implication?
Winter’s Method
• Lt = α(xt/st-c) + (1 – α) (Lt-1 + Tt-1)
• Tt = β(Lt - Lt-1 ) + (1 – β) Tt-1
• st = γ (xt/Lt) + (1 – γ) st-c
• ft,k = (Lt + k * Tt) * St+k-c
Initialization of Winter’s Method
• L0 = estimate of base at beginning of month 1• T0 = estimate of trend at beginning of month 1• S-11 = estimate of January seasonal factor at the
beginning of month 1• S-10 = estimate of February seasonal factor at the
beginning of month 1• .• S0 = estimate of December seasonal factor at the
beginning of month 1.
Initialization of Winter’s Method
• Variety of methods are available to estimate above parameters
• A simple approach:– Suppose we have two years of data
• Year –2: 4, 3, 10, 14, 25, 26, 38, 40, 28, 17, 16, 13• Year –1: 9, 6, 18, 27, 48, 50, 75, 77, 52, 33, 31, 24• Total sales during year –2 = 234• Total sales during year –1 = 450
Initialization of Winter’s Method
• T0 = [(Avg. monthly sales during year –1) – (Avg. monthly sales during year –2)]/12– T0 = 1.5
• L0 = Avg. monthly demand during year –1.– Further correction
• This estimates the base at the middle of the year –1– Month 6.5 of year –1
» Hence, to bring this estimate to the end of the year» Add, (12 – 6.5)T0 = 5.5T0
» L0 = 37.5 + 5.5(1.5) = 45.75
Initialization of Winter’s Method
• To estimate the seasonality factor for a given month (say, January = s-11)– we take an estimate of January seasonality of
year –2 and year –1 and average them.– In year –2, average monthly demand = 19.5– In January of year –2, number of ACs sold = 4
• Therefore, s-11 = [(4/19.5) + (9/37.5)]/2 = 0.22
Initialization of Winter’s Method
• s-10 = 0.16, ….., s0 = 0.65• Observation
– Sum of initial seasonal factor estimates should average to 1
• At the beginning of month 1, our forecast for month 1 AC sales is– f0,1 = (L0 + T0)s0+1-12 = (45.75 + 1.5)0.22 = 10.40
Initialization of Winter’s Method
• At the beginning of month 1, our forecast for month 7 AC sales is– f0,7 = (L0 + 7T0)s0+7-12 = (45.75 + 7 *1.5) 1.97 = 110.81
• For– α = 0.5– β = 0.4– γ = 0.6
Winter’s Method for Air-Conditioners
Month Sales Lt Tt st ft-1,1 Error1 13 52.83 3.73 0.24 10.52 2.482 7 50.58 1.34 0.15 8.88 1.883 23 49.13 0.22 0.48 25.78 2.784 32 46.93 -0.75 0.70 35.48 3.485 58 45.73 -0.93 1.27 59.16 1.166 60 44.90 -0.89 1.34 59.74 0.267 90 44.80 -0.57 2.00 86.90 3.108 93 44.77 -0.36 2.07 90.76 2.249 63 44.53 -0.31 1.41 62.68 0.3210 39 44.37 -0.25 0.88 38.73 0.2711 37 44.52 -0.09 0.83 36.34 0.6612 29 44.41 -0.10 0.65 29.03 0.03
Some Final Thoughts
• Indian Contexts– Businesses uses Gregorian calendar
• Most of the festivals uses lunar calendar– festivals (Diwali, Eid, Chinese festival …) occur in
different weeks or months
• Inauspicious periods