AOT4200 - Lesson 8 Demand Forecasting - BPv3
AOT4200 - Lesson 8 Demand Forecasting - BPv3
Lesson Topic
https://www.clickpost.ai/blog/what-is-demand-management-in-ecommerce
Control
Customers
Suppliers
Resources
Inputs Outputs
Constraints
https://www.youtube.com/watch?v=kGQ1fNQVbj8
AOT 4200 - Introduction to operations management 10
Context
https://strategok.com/the-lost-link-to-make-strategy-work-sales-operations-planning-sop/
https://slideplayer.com/slide/11953423/
Independent
demand
Level 0 Table (random) :
End products
Dependent
Level 1 Surface Support demand
(deterministic) :
Raw materials,
Hinge and components
Level 2 Top Box apron Legs
nails
Fonction Uses
Accounting • Process/Costs estimates, profit projections, cash
management
Finance • New equipment/Equipment replacement needs, timing
and amount of funding/borrowing needs
Human Resources • Hiring activities, layoff planning, training
1. The level (or average or constant): value representing all the data
Demand
Random variation
Demand
Time
Seasonality
Demand
Cycle Time
Trend
Seasonality
Irregular variations
Random variations
Cycle
Random variations
Cycle Economic
• Time series :
Use historical observations (data points) at regular intervals over a
period of time to develop future forecasts.
• Associative models :
Use one or more causal variables to predict future demand.
• The demand for the current period is used as a demand forecast for the following period.
• Example :
- If the current demand (week 1) is 100 units, then the demand forecast for next
week (week 2) will be 100 units.
- If the actual demand for week 2 turned out to be 90 units, then the demand
forecast for the following week (week 3) will be 90 units and so on.
• The naïve forecast does not take into account the behavior of the demand history.
•
t −1
R i
Pt = i =1 [units]
t −1
• A hardware store has compiled the demand for shovels in recent months:
Month Demand
1 492
2 470
3 493
4 485
5 498
6
R i
Pt = i =1
t −1
σ5𝑖=1 𝑅𝑖
𝑃6 =
5
σ5𝑖=1 𝑅𝑖
𝑃6 =
5
𝑅1 + 𝑅2 + 𝑅3 + 𝑅4 + 𝑅5
𝑃6 =
5
492 + 470 + 493 + 485 + 498
𝑃6 =
5
R t −i
[units]
Pt = i =1
a. Using a 3-period moving average, forecast the number of food baskets needed for the
6th month.
b. If the demand for the 6th month turns out to be 39, does this have an influence on the
forecast for the 7th month (using a 3-period moving average)?
AOT 4200 - Introduction to operations management 38
AOT 4200 - Introduction to operations management 39
Moving average
Example
a) Using a 3-period moving average, forecast the number of food baskets needed for the 6th
month.
n
Month Demand
R t −i
Pt = i =1
1 42 n
2 40
𝑡 = Forecast period number = 6
3 43
𝑃𝑡 = Forecast for period 𝑡 = 𝑃6
4 40 𝑅𝑡−𝑖 = Demand realization for period 6 − 𝑖
5 41 𝑛 = number of periods in the moving average = 3
6
σ3𝑖=1 𝑅6−𝑖
𝑃6 =
3
a) Using a 3-period moving average, forecast the number of food baskets needed for the 6th
month.
σ3𝑖=1 𝑅6−𝑖
𝑃6 =
Month Demand 3
1 42
𝑅6−1 + 𝑅6−2 + 𝑅6−3
2 40 𝑃6 =
3
3 43
𝑅5 + 𝑅4 + 𝑅3
4 40 𝑃6 =
3
5 41
41 + 40 + 43
𝑃6 =
3
𝑃6 = 41,33 = 41
Month Demand
1 42 𝑅6 + 𝑅5 + 𝑅4
𝑃7 =
3
2 40
3 43 39 + 41 + 40
𝑃7 =
4 40 3
5 41 𝑃7 = 40 Baskets.
6 39
7
Units Units
Period Period
Legend: Demand Forecast with a 2-period moving average Legend: Demand Forecast with
with aa 6-period
6-period moving
moving average
average
Forecast
i =1
with w =1
i =1
i
[units]
• The first weight (w1) affects the importance given to the most recent demand (Rt-1), the
second weight (w2) affects the importance given to the second most recent demand (Rt-2),
and so on.
AOT 4200 - Introduction to operations management 44
Weighted moving average
Example
The table below presents the demand for raw material over a period of 5 months.
Month Demand
1 38
2 40
3 43
4 40
5 41
6
a) Calculate the forecast for the 6th month using a 4-period weighted moving
n average by
applying the following weighting : wi = 1 i =1
w1 = 0,40; w2 = 0,30; w3 = 0,20 et w4 = 0,10.
b) If the demand for the 6th month is 39, what would be the forecast of the demand for the
7th month? (using the same parameters)
AOT 4200 - Introduction to operations management 45
AOT 4200 - Introduction to operations management 46
Weighted moving average
Example
a) Calculate the forecast for the 6th month using a 4-period weighted moving average by
applying the following weighting : w1 = 0,40, w2 = 0,30, w3 = 0,20 et w4 = 0,10.
4
Month Demand 𝑃6 = 𝑤𝑖 𝑅6−𝑖
1 38 𝑖=1
b) If the demand for the 6th month is 39, what would be the forecast of the demand for the
7th month? (using the same parameters)
4
Month Demand 𝑃7 = 𝑤𝑖 𝑅7−𝑖
1 38 𝑖=1
• Method also based on the principle of the weighted moving average but more
sophisticated than this method.
• Uses forecast error to adjust the calculation of forecasts from one period to the next.
• To calculate the forecast error 𝒆𝒕 for a given period 𝑡, we must know the actual demand
Rt and the forecast of this demand Pt. Previous example:
P6 = 41, R6 = 39 [units]
et = Rt – Pt e6 = R6 - P6 = 39 – 41 = -2
where: 𝛼 = Smoothing constant (0 < 𝛼 < 1) The smoothing constant determines how quickly the forecast is
adjusted (near 0 = little importance to forecast errors)
𝑒𝑡 = forecast error for period 𝑡 When 𝛼 = 0, Pt = Pt-1
Period (t) 1 2 3 4 5 6 7 8 9 10 11
Demand (R) 42 40 43 40 41 39 46 44 45 38 40
• Calculate the forecast of the 12th period using simple exponential smoothing with two
different alpha values: α = 0,10 et α = 0,40.
And so on…
a. α = 0,1 α = 0,1
Period Demand Forecast Forecast error
(t) (Rt) (Pt) (et)
We must start by setting: 1 42
P2 = R1. 2 40
3 43
Add column Forecast Add column Forecast error
(Pt) (et)
4 40
5 41
6 39
7 46
8 44
9 45
10 38
11 40
12
a. α = 0,1 α = 0,1
Period Demand Forecast Forecast error
(t) (Rt) (Pt) (et)
We must start by setting: 1 42
P2 = R1. 2 40 P2 = R1 = 42
3 43
4 40
5 41
6 39
7 46
8 44
9 45
10 38
11 40
12
a. α = 0,1 α = 0,1
Period Demand Forecast Forecast error
(t) (Rt) (Pt) (et)
We must start by setting: 1 42
P2 = R1. 2 40 42 e2 = R2 - P2
e2 = 40-42
= -2
3 43
4 40
5 41
6 39
7 46
8 44
9 45
10 38
11 40
12
a. α = 0,1 α = 0,1
Period Demand Forecast Forecast error
(t) (Rt) (Pt) (et)
We must start by setting: 1 42
P2 = R1. 2 40 42 e2 = R2 - P2
e2 = 40-42
= -2
3 43 P3 = P2 + αe2
= 42 + 0,1(-2)
= 41,8
4 40
5 41
6 39
7 46
8 44
9 45
10 38
11 40
12
a. α = 0,1 α = 0,1
Period Demand Forecast Forecast error
(t) (Rt) (Pt) (et)
We must start by setting: 1 42
P2 = R1. 2 40 42 e2 = R2 - P2
e2 = 40-42
= -2
3 43 P3 = P2 + αe2 e3 = R3 - P3
= 42 + 0,1(-2) e3 = 43- 41,8
= 41,8 = 1,2
4 40
5 41
6 39
7 46
8 44
9 45
10 38
11 40
12
a. α = 0,1 α = 0,1
Period Demand Forecast Forecast error
(t) (Rt) (Pt) (et)
We must start by setting: 1 42
P2 = R1. 2 40 42 e2 = R2 - P2
e2 = 40-42
= -2
3 43 P3 = P2 + αe2 e3 = R3 - P3
= 42 + 0,1(-2) e3 = 43- 41,8
= 41,8 = 1,2
4 40 P4 = 41,8 +0,1*(1,2)
= 41,92
5 41
6 39
7 46
8 44
9 45
10 38
11 40
12
a. α = 0,1 α = 0,1
Period Demand Forecast Forecast error
(t) (Rt) (Pt) (et)
We must start by setting: 1 42
P2 = R1. 2 40 42 e2 = R2 - P2
e2 = 40-42
= -2
3 43 P3 = P2 + αe2 e3 = R3 - P3
= 42 + 0,1(-2) e3 = 43- 41,8
= 41,8 = 1,2
4 40 P4 = 41,8 +0,1*(1,2) e4 = 40 - 41,92
= 41,92 = -1,92
5 41
6 39
7 46
8 44
9 45
10 38
11 40
12
a. α = 0,1 α = 0,1
Period Demand Forecast Forecast error
(t) (Rt) (Pt) (et)
We must start by setting: 1 42
P2 = R1. 2 40 P2 = R1 = 42 e2 = R2 - P2
e2 = 40-42
= -2
3 43 P3 = P2 + αe2 e3 = R3 - P3
= 42 + 0,1(-2) e3 = 43- 41,8
= 41,8 = 1,2
4 40 P4 = 41,8 +0,1*(1,2) e4 = 40 - 41,92
= 41,92 = -1,92
5 41 41,728 -0,728
6 39 41,6552 -2,6552
7 46 41,3897 4,6103
8 44 41,8507 2,1493
9 45 42,0656 2,9344
After calculations, we 10 38 42,3591 -4,3591
41 - 41.728
11 40 41,9232 -1,9232
obtain P12 = 41,73 chairs. 12 41,7309 Keep the decimals
3 43
4 40
5 41
6 39
7 46
8 44
9 45
10 38
11 40
12
P2 = R1. e2 = 40-42
= -2
3 43 P3 = P2 + αe2 e3 = R3 - P3
= 42 + 0,4(-2) e3 = 43- 41,2
= 41,2 = 1,8
4 40 P4 = 41,2 +0,4*(1,8) e4 = 40 - 41,92
= 41,92 = -1,92
5 41 41,152 -0,152
6 39 41,0912 -2,0912
7 46 40,2547 5,7453
8 44 42,5528 1,4472
9 45 43,1317 1,8683
10 38 43,8790 -5,8790
After calculations, we 11 40 41,5274 -1,5274
Units
Period
Legend: Forecast Period
Demand AOT 4200 - Introduction to operations 63
Legend: managementDemand Forecast
Impact of the smoothing constant α
250
Demand
200
Moving average
150
Weighted moving average
(40%-30%-20%-10%)
0
0 2 4 6 8 10 12
140
Demand
120
Moving average
100
Weighted moving average
(40%-30%-20%-10%)
40
0 2 4 6 8 10 12
σ𝑛𝑡=1 𝑒𝑡
𝑀𝐷 =
𝑛
et = Rt − Pt Forecast error
σ𝑛𝑡=1 𝑒𝑡
𝑀𝐴𝐷 = n = Number of periods
𝑛
σ𝑛𝑡=1 𝑒𝑡2
𝑀𝑆𝐸 =
𝑛
𝑒𝑡
σ𝑛𝑡=1
𝑅𝑡
𝑀𝐴𝑃𝐸 = × 100
𝑛
Absolute
Error (𝒆𝒕 ) Absolute Squared percent error
Period (t) Demand (𝑹𝒕 ) Forecast (𝑷𝒕 )
et = Rt – Pt error( 𝒆𝒕 ) error (𝒆𝟐𝒕 )
( 𝒆𝒕 ൗ𝑹𝒕)
1 217 215
2 213 216
3 216 215
4 210 214
5 213 211
6 219 214
7 216 217
8 212 216
Average
Absolute
Error (𝒆𝒕 ) Absolute Squared percent error
Period (t) Demand (𝑹𝒕 ) Forecast (𝑷𝒕 )
et = Rt – Pt error( 𝒆𝒕 ) error (𝒆𝟐𝒕 )
( 𝒆𝒕 ൗ𝑹𝒕)
1 217 215 2
2 213 216 -3
3 216 215 1
4 210 214 -4
5 213 211 2
6 219 214 5
7 216 217 -1
8 212 216 -4
Average
Absolute
Error (𝒆𝒕 ) Absolute Squared percent error
Period (t) Demand (𝑹𝒕 ) Forecast (𝑷𝒕 )
et = Rt – Pt error( 𝒆𝒕 ) error (𝒆𝟐𝒕 )
( 𝒆𝒕 ൗ𝑹𝒕)
1 217 215 2
2 213 216 -3
3 216 215 1
4 210 214 -4
5 213 211 2
6 219 214 5
7 216 217 -1
8 212 216 -4
Average -0,25
Absolute
Error (𝒆𝒕 ) Absolute Squared percent error
Period (t) Demand (𝑹𝒕 ) Forecast (𝑷𝒕 )
et = Rt – Pt error( 𝒆𝒕 ) error (𝒆𝟐𝒕 )
( 𝒆𝒕 ൗ𝑹𝒕)
1 217 215 2 2
2 213 216 -3 3
3 216 215 1 1
4 210 214 -4 4
5 213 211 2 2
6 219 214 5 5
7 216 217 -1 1
8 212 216 -4 4
Average -0,25 2,75
Absolute
Error (𝒆𝒕 ) Absolute Squared percent error
Period (t) Demand (𝑹𝒕 ) Forecast (𝑷𝒕 )
et = Rt – Pt error( 𝒆𝒕 ) error (𝒆𝟐𝒕 )
( 𝒆𝒕 ൗ𝑹𝒕)
1 217 215 2 2 4
2 213 216 -3 3 9
3 216 215 1 1 1
4 210 214 -4 4 16
5 213 211 2 2 4
6 219 214 5 5 25
7 216 217 -1 1 1
8 212 216 -4 4 16
Average -0,25 2,75 9,5
Absolute
Error (𝒆𝒕 ) Absolute Squared percent error
Period (t) Demand (𝑹𝒕 ) Forecast (𝑷𝒕 )
et = Rt – Pt error( 𝒆𝒕 ) error (𝒆𝟐𝒕 )
( 𝒆𝒕 ൗ𝑹𝒕)
• MSE adjusts the errors according to their quadratic values. High errors have a higher
weight.
• For the same time series, the error measurements allow to choose the most accurate
forecasting method.
• Error measures can lead to conflicting results. The manager will need to select the
forecasting method that meets his business objectives.
AOT 4200 - Introduction to operations management 81
Exercise
Absolute
Error (𝒆𝒕 ) Absolute Squared percent error
Period (t) Demand (𝑹𝒕 ) Forecast (𝑷𝒕 )
et = Rt – Pt error ( 𝒆𝒕 ) error (𝒆𝟐𝒕 )
( 𝒆𝒕 ൗ𝑹𝒕)
1 217
2 213
3 216
4 210 215,33
5 213 213
6 219 213
7 216 214
8 212 216
Average
Absolute
Error (𝒆𝒕 ) Absolute Squared percent error
Period (t) Demand (𝑹𝒕 ) Forecast (𝑷𝒕 )
et = Rt – Pt error ( 𝒆𝒕 ) error (𝒆𝟐𝒕 )
( 𝒆𝒕 ൗ𝑹𝒕)
1 217
2 213
3 216
4 210 215,33 -5,33
5 213 213 0
6 219 213 6
7 216 214 2
8 212 216 -4
Average -0,27
Absolute
Error (𝒆𝒕 ) Absolute Squared percent error
Period (t) Demand (𝑹𝒕 ) Forecast (𝑷𝒕 )
et = Rt – Pt error ( 𝒆𝒕 ) error (𝒆𝟐𝒕 )
( 𝒆𝒕 ൗ𝑹𝒕)
1 217
2 213
3 216
4 210 215,33 -5,33 5,33 28,44 0,02540
5 213 213 0 0 0 0
6 219 213 6 6 36 0,02740
7 216 214 2 2 4 0,0093
8 212 216 -4 4 16 0,0189
Average -0,27 3,47 16,89 0,02
Exponential
Moving average Error (𝒆𝒕 )
Period (t) Demand (Rt) smoothing 𝜶 =
of order 3 et = Rt – Pt
𝟎, 𝟑
1 217
2 213
3 216
4 210
5 213
6 219
7 216
8 212
Exponential
Moving average Error (𝒆𝒕 )
Period (t) Demand (Rt) smoothing 𝜶 =
of order 3 et = Rt – Pt
𝟎, 𝟑
1 217
2 213
3 216
4 210
5 213
6 219
7 216
8 212
Exponential
Moving average Error (𝒆𝒕 )
Period (t) Demand (Rt) smoothing 𝜶 =
of order 3 et = Rt – Pt
𝟎, 𝟑
1 217
2 213 217
3 216
4 210
5 213
6 219
7 216
8 212
231 - 217
Exponential
Moving average Error (𝒆𝒕 )
Period (t) Demand (Rt) smoothing 𝜶 =
of order 3 et = Rt – Pt
𝟎, 𝟑
1 217
2 213 217 -4
3 216
4 210
5 213
6 219
7 216
8 212
Exponential
Moving average Error (𝒆𝒕 )
Period (t) Demand (Rt) smoothing 𝜶 =
of order 3 et = Rt – Pt
𝟎, 𝟑
1 217
2 213 217 -4
3 216 215.8
4 210
5 213
6 219
7 216
8 212
217 + 0.3 * (-4)
216 – 215.8
Exponential
Moving average Error (𝒆𝒕 )
Period (t) Demand (Rt) smoothing 𝜶 =
of order 3 et = Rt – Pt
𝟎, 𝟑
1 217
2 213 217 -4
3 216 215,8 0.2
4 210
5 213
6 219
7 216
8 212
Exponential
Moving average Error (𝒆𝒕 )
Period (t) Demand (Rt) smoothing 𝜶 =
of order 3 et = Rt – Pt
𝟎, 𝟑
1 217
2 213 217 -4
3 216 215,8 0.2
4 210 215,86
5 213
6 219
7 216 215.8 + 0.3 * (0.2)
8 212
Exponential
Moving average Error (𝒆𝒕 )
Period (t) Demand (Rt) smoothing 𝜶 =
of order 3 et = Rt – Pt
𝟎, 𝟑
1 217
2 213 217 -4
3 216 215,8 0.2
4 210 215,86 -5.86
5 213
6 219
7 216
8 212
Exponential
Moving average Error (𝒆𝒕 )
Period (t) Demand (Rt) smoothing 𝜶 =
of order 3 et = Rt – Pt
𝟎, 𝟑
1 217
2 213 217 -4
3 216 215,8 0.2
4 210 215,86 -5.86
5 213 214,1
6 219
7 216
8 212 215.86 + 0.3 * (-5.86)
Exponential
Moving average Error (𝒆𝒕 )
Period (t) Demand (Rt) smoothing 𝜶 =
of order 3 et = Rt – Pt
𝟎, 𝟑
1 217
2 213 217 -4
3 216 215,8 0.2
4 210 215,86 -5,86
5 213 214,1 -1,10
6 219 213,77 5,23
7 216 215,34 0,66
8 212 215,54 -3,54
Absolute
Error (𝒆𝒕 ) Absolute Squared percent error
Period (t) Demand (𝑹𝒕 ) Forecast (𝑷𝒕 )
et = Rt – Pt error ( 𝒆𝒕 ) error (𝒆𝟐𝒕 )
( 𝒆𝒕 ൗ𝑹𝒕)
1 217
2 213 217
3 216 215,8
4 210 215,86 -5,86
5 213 214,1 -1,10
6 219 213,77 5,23
7 216 215,34 0,66
8 212 215,54 -3,54
Average -0,92
Absolute
Error (𝒆𝒕 ) Absolute Squared percent error
Period (t) Demand (𝑹𝒕 ) Forecast (𝑷𝒕 )
et = Rt – Pt error ( 𝒆𝒕 ) error (𝒆𝟐𝒕 )
( 𝒆𝒕 ൗ𝑹𝒕)
1 217
2 213 217
3 216 215,8
4 210 215,86 -5,86 5,86 34,34 0,0279
5 213 214,1 -1,10 1,10 1,21 0,0052
6 219 213,77 5,23 5,23 27,34 0,0239
7 216 215,34 0,66 0,66 0,44 0,0031
8 212 215,54 -3,54 3,54 12,52 0,0167
Average -0,92 3,28 15,17 0,02
MAPE 2% 2%
Average error (2%).
Forecast accuracy =
Use of exponential smoothing 98%