You are on page 1of 44

Forecasting

Rohit Kapoor
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
t
Form D(t)
1 328
2 310
3 355
4 362
5 375
6 380
7 408
8 415
9 417
10 412
11 429
12 434
13 449
14 471
15 475
16 489
Case 1: Forecasting the Trend
t
Form … Calculations
D(t) t-Tavg D(t) - Davg (t-Tavg) * (D(t)-Davg) (t-tavg)^2 Forecast Abs error
1 328 -7.5 -78.81 591.09 56.25 326.40 1.60
2 310 -6.5 -96.81 629.28 42.25 337.12 27.12
3 355 -5.5 -51.81 284.97 30.25 347.84 7.16
4 362 -4.5 -44.81 201.66 20.25 358.56 3.44
5 375 -3.5 -31.81 111.34 12.25 369.29 5.71
6 380 -2.5 -26.81 67.03 6.25 380.01 0.01
7 408 -1.5 1.19 -1.78 2.25 390.73 17.27
8 415 -0.5 8.19 -4.09 0.25 401.45 13.55
9 417 0.5 10.19 5.09 0.25 412.17 4.83
10 412 1.5 5.19 7.78 2.25 422.90 10.90
11 429 2.5 22.19 55.47 6.25 433.62 4.62
12 434 3.5 27.19 95.16 12.25 444.34 10.34
13 449 4.5 42.19 189.84 20.25 455.06 6.06
14 471 5.5 64.19 353.03 30.25 465.78 5.22
15 475 6.5 68.19 443.22 42.25 476.51 1.51
16 489 7.5 82.19 616.41 56.25 487.23 1.77
Mean 8.5 406.8125 7.57
Sum 3645.50 340.00
b 10.72206
a 315.675
Estimating Forecasting Error
• Four ways:
– Mean error (ME)
– Mean absolute deviation (MAD)
– Mean square error (MSE)
– Mean absolute percentage error (MAPE)
Different Estimates of Forecast
Error
Absolute Square Absolute
Month Sales Forecast Error Deviation Error % 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
Period
within
Time Block block Demand
1 1 6
2 2 55
1
3 3 249
4 4 646
5 1 24
6 2 73
2
7 3 140
8 4 569
9 1 12
10 2 28
3
11 3 136
12 4 631
Case 2: Forecasting Seasonality
• Periodicity
– p=4
Case 2: Forecasting Seasonality
…Some Equations
• Seasonality index of period i for block j
• Average seasonality index for period i
within a block
Case 2: Forecasting Seasonality
… Analysis
Period Seasonal
within Index of
Time Block block Demand Average Period
1 1 6 0.03
2 2 55 0.23
1 239
3 3 249 1.04
4 4 646 2.70
5 1 24 0.12
6 2 73 0.36
2 201.5
7 3 140 0.69
8 4 569 2.82
9 1 12 0.06
10 2 28 0.14
3 201.75
11 3 136 0.67
12 4 631 3.13
Case 2: Forecasting Seasonality
…Seasonality Index Calculation
Average
Seasonality
Period/Block S(i, 1) S(i, 2) S(i, 3) Index
1 0.03 0.12 0.06 0.07
2 0.23 0.36 0.14 0.24
3 1.04 0.69 0.67 0.80
4 2.70 2.82 3.13 2.88
Case 2: Forecasting Seasonality
… De-seasonalizing Demand
• De-seasonalized demand data (t)
• Forecast (t)
– [Level (t)] * Seasonal index (t)
Case 2: Forecasting Seasonality
… Calculations
Period Seasonal De-
within Index of Seasonlized
Time Block block Demand Average Period Demand Forecast Abs Error
1 1 6 0.03 88 14 8
2 2 55 0.23 226 52 3
1 239
3 3 249 1.04 310 171 78
4 4 646 2.70 224 613 33
5 1 24 0.12 353 14 10
6 2 73 0.36 300 52 21
2 201.5
7 3 140 0.69 174 171 31
8 4 569 2.82 197 613 44
9 1 12 0.06 177 14 2
10 2 28 0.14 115 52 24
3 201.75
11 3 136 0.67 169 171 35
12 4 631 3.13 219 613 18
Mean 213 26
Case 3: Forecasting Combination
of Seasonality and Trend
Quarter Sales
1 45
2 335
3 520
4 100
5 70
6 370
7 590
8 170
9 100
10 585
11 830
12 285
13 100
14 725
15 1160
16 310
Case 3: Forecasting Combination
of Seasonality and Trend
• Observation
– Seasonality with periodicity, p = 4
– Demand seems to be increasing every year
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 …
Analysis
Period
within Average Seasonality
Time Block Block Demand Demand Index
1 1 45 0.18
2 2 335 1.34
1 250
3 3 520 2.08
4 4 100 0.40
5 1 70 0.23
6 2 370 1.23
2 300
7 3 590 1.97
8 4 170 0.57
9 1 100 0.22
10 2 585 1.30
3 450
11 3 830 1.84
12 4 285 0.63
13 1 100 0.17
14 2 725 1.26
4 573.75
15 3 1160 2.02
16 4 310 0.54
Case 3: Forecasting Combination
of Seasonality and Trend …
Analysis
Average
Seasonality
Period/Block 1 2 3 4 Index
1 0.18 0.23 0.22 0.17 0.20
2 1.34 1.23 1.30 1.26 1.28
3 2.08 1.97 1.84 2.02 1.98
4 0.40 0.57 0.63 0.54 0.54
Case 3: Forecasting Combination
of Seasonality and Trend …
Analysis
De-
seasonlized
Time Demand t-Tavg D(t) - Davg (t-Tavg) * (D(t) - Davg) (t-tavg)^2
1 222 -7.5 -172 1290.14 56.25
2 261 -6.5 -133 867.28 42.25
3 263 -5.5 -131 722.82 30.25
4 187 -4.5 -207 933.27 20.25
5 346 -3.5 -49 169.89 12.25
6 288 -2.5 -106 265.44 6.25
7 298 -1.5 -96 144.05 2.25
8 318 -0.5 -77 38.29 0.25
9 494 0.5 100 49.82 0.25
10 456 1.5 61 91.86 2.25
11 420 2.5 25 63.21 6.25
12 533 3.5 138 484.23 12.25
13 494 4.5 100 448.37 20.25
14 565 5.5 170 936.40 30.25
15 586 6.5 192 1248.66 42.25
16 579 7.5 185 1388.05 56.25
Mean 8.5 394.28
Sum b 27 9141.77 340
a 165.74
Case 3: Forecasting Combination
of Seasonality and Trend …
Analysis
Period De-
within Seasonality seasonlized
Time Block Block Demand Average Demand Index Demand Forecast Abs Error
1 1 45 0.18 222 39 6
2 2 335 1.34 261 282 53
1 250
3 3 520 2.08 263 487 33
4 4 100 0.40 187 146 46
5 1 70 0.23 346 61 9
6 2 370 1.23 288 420 50
2 300
7 3 590 1.97 298 700 110
8 4 170 0.57 318 204 34
9 1 100 0.22 494 83 17
10 2 585 1.30 456 558 27
3 450
11 3 830 1.84 420 913 83
12 4 285 0.63 533 261 24
13 1 100 0.17 494 104 4
14 2 725 1.26 565 696 29
4 573.75
15 3 1160 2.02 586 1126 34
16 4 310 0.54 579 319 9
Adaptive Methods
• Moving Average
• Simple Exponential Smoothening
• Holt’s Method
• Winter’s Method
Basic Data
Month TV Sales CD Sales AC Sales
1 30 40 13
2 32 47 7
3 30 50 23
4 39 49 32
5 33 56 58
6 34 53 60
7 34 55 90
8 38 63 93
9 36 68 63
10 39 65 39
11 30 72 37
12 36 69 29
13 38 79 36
14 30 82 21
15 35 80 47
16 30 85 81
17 34 94 112
18 40 89 139
19 36 96 230
20 32 100 201
21 40 100 122
22 36 105 84
23 40 108 74
24 34 110 62
TV Sales
TV Sales

45
40
35
30
T V Sales

25
TV Sales
20
15
10
5
0
1
3
5
7
9

13

19
11

15
17

21
23
Month
CD Sales
CD Sales

120

100

80
CD Sales

60 CD Sales

40

20

0
16

19

22
10

13
1

Month
Moving Average Method
• Time series that fluctuates about a constant
base level
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) Error
1 30
2 32
3 30 31 1
4 39 31 8 30.67 8.33
5 33 34.5 1.5 33.67 0.67 32.75 0.25
6 34 36 2 34.00 0.00 33.50 0.50 32.80 1.20
7 34 33.5 0.5 35.33 1.33 34.00 0.00 33.60 0.40 33.00 1.00
8 38 34 4 33.67 4.33 35.00 3.00 34.00 4.00 33.67 4.33
9 36 36 0 35.33 0.67 34.75 1.25 35.60 0.40 34.67 1.33
10 39 37 2 36.00 3.00 35.50 3.50 35.00 4.00 35.67 3.33
11 30 37.5 7.5 37.67 7.67 36.75 6.75 36.20 6.20 35.67 5.67
12 36 34.5 1.5 35.00 1.00 35.75 0.25 35.40 0.60 35.17 0.83
13 38 33 5 35.00 3.00 35.25 2.75 35.80 2.20 35.50 2.50
14 30 37 7 34.67 4.67 35.75 5.75 35.80 5.80 36.17 6.17
15 35 34 1 34.67 0.33 33.50 1.50 34.60 0.40 34.83 0.17
16 30 32.5 2.5 34.33 4.33 34.75 4.75 33.80 3.80 34.67 4.67
17 34 32.5 1.5 31.67 2.33 33.25 0.75 33.80 0.20 33.17 0.83
18 40 32 8 33.00 7.00 32.25 7.75 33.40 6.60 33.83 6.17
19 36 37 1 34.67 1.33 34.75 1.25 33.80 2.20 34.50 1.50
20 32 38 6 36.67 4.67 35.00 3.00 35.00 3.00 34.17 2.17
21 40 34 6 36.00 4.00 35.50 4.50 34.40 5.60 34.50 5.50
22 36 36 0 36.00 0.00 37.00 1.00 36.40 0.40 35.33 0.67
23 40 38 2 36.00 4.00 36.00 4.00 36.80 3.20 36.33 3.67
24 34 38 4 38.67 4.67 37.00 3.00 36.80 2.80 37.33 3.33
Simple Exponential Smoothing
• A time series that fluctuates about a base
level
• At = αxt + (1 – α) At-1
• A0 = 32
• α = 0.1
Simple Exponential Smoothing
Month
Calculations
TV Sa le s Fore ca st At et
1 30 32 31.8 2.00
2 32 31.8 31.82 0.20
3 30 31.82 31.64 1.82
4 39 31.64 32.37 7.36
5 33 32.37 32.44 0.63
6 34 32.44 32.59 1.56
7 34 32.59 32.73 1.41
8 38 32.73 33.26 5.27
9 36 33.26 33.53 2.74
10 39 33.53 34.08 5.47
11 30 34.08 33.67 4.08
12 36 33.67 33.91 2.33
13 38 33.91 34.32 4.09
14 30 34.32 33.88 4.32
15 35 33.88 34.00 1.12
16 30 34.00 33.60 4.00
17 34 33.60 33.64 0.40
18 40 33.64 34.27 6.36
19 36 34.27 34.45 1.73
20 32 34.45 34.20 2.45
21 40 34.20 34.78 5.80
22 36 34.78 34.90 1.22
23 40 34.90 35.41 5.10
24 34 35.41 35.27 1.41
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 Calculations
ft-1,1
(= Lt-1+Tt- e t (x t - ft-
Month CD Sa les Lt Tt 1) 1,1)
1 40 37.71 2.83 36.73 3.27
2 47 42.47 3.02 40.53 6.47
3 50 46.85 3.15 45.49 4.51
4 49 49.70 3.12 50.00 1.00
5 56 53.78 3.22 52.82 3.18
6 53 55.80 3.10 57.00 4.00
7 55 57.73 2.98 58.90 3.90
8 63 61.40 3.05 60.71 2.29
9 68 65.51 3.16 64.45 3.55
10 65 67.57 3.05 68.67 3.67
11 72 71.03 3.09 70.62 1.38
12 69 72.59 2.94 74.12 5.12
13 79 76.57 3.04 75.52 3.48
14 82 80.32 3.11 79.61 2.39
15 80 82.40 3.01 83.44 3.44
16 85 85.29 3.00 85.41 0.41
17 94 90.00 3.17 88.29 5.71
18 89 91.92 3.04 93.17 4.17
19 96 95.27 3.07 94.96 1.04
20 100 98.84 3.12 98.35 1.65
21 100 101.38 3.06 101.97 1.97
22 105 104.61 3.08 104.44 0.56
23 108 107.78 3.09 107.69 0.31
24 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.9
0.1 2.86 2.80 2.74 2.70 2.75 2.80 2.83 2.86 2.92
0.2 2.77 2.73 2.76 2.79 2.84 2.92 2.97 2.98 2.99
0.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.39
0.5 3.07 3.13 3.19 3.25 3.31 3.36 3.43 3.50 3.58
0.6 3.19 3.26 3.33 3.40 3.48 3.59 3.69 3.78 3.88
0.7 3.32 3.39 3.47 3.60 3.72 3.84 3.95 4.07 4.21
0.8 3.43 3.53 3.67 3.81 3.94 4.07 4.27 4.47 4.68
0.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 = 12 for monthly data.
• st = seasonal multiplicative factor for month t,
obtained after observing xt.
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, s-9 = 0.50, s-8 = 0.72, s-7 = 1.28, s-6 = 1.33, s-5 =
1.97, s-4 = 2.05, s-3 = 1.41, s-2 = 0.88, s-1 = 0.82, s0 = 0.65
• Observation and a check!
– 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
Computation of L1, T1 and S1
• L1 = 0.5 (x1/s-11) + 0.5 (L0 + T0)
= 0.5 (13/0.22) + 0.5 (45.75 + 1.5) = 52.83
• T1 = 0.4 (L1 – L0) + 0.6 T0
= 0.4 (52.83 – 45.75) + 0.6 (1.5) = 3.73
• s1 = 0.6 (x1/L1) + 0.4 (s-11)
= 0.6 (13/52.83) + 0.4 (0.22) = 0.24
Thus, at the end of month 1, our forecast for (say) month 7
AC sales
f1,6 = (L1 + 6T1)s1+6-12 = (52.83 + 6(3.73)) 1.97 = 150.49
Winter’s Method for Air-
Conditioners
Month Sales Lt Tt st ft-1,1 Error
1 13 52.83 3.73 0.24 10.52 2.48
2 7 50.58 1.34 0.15 8.88 1.88
3 23 49.13 0.22 0.48 25.78 2.78
4 32 46.93 -0.75 0.70 35.48 3.48
5 58 45.73 -0.93 1.27 59.16 1.16
6 60 44.90 -0.89 1.34 59.74 0.26
7 90 44.80 -0.57 2.00 86.90 3.10
8 93 44.77 -0.36 2.07 90.76 2.24
9 63 44.53 -0.31 1.41 62.68 0.32
10 39 44.37 -0.25 0.88 38.73 0.27
11 37 44.52 -0.09 0.83 36.34 0.66
12 29 44.41 -0.10 0.65 29.03 0.03

You might also like