Manajemen Persediaan 3- Peramalan
Agenda Metode Peramalan Kuantitatif Time Series Average Exponential Smoothing
Causal Regresi
Kesalahan Peramalan
Metode Time Series Digunakan untuk membuat analisis detail dari pola demand masa lalu dan memproyeksikan pola tersebut untuk masa yang akan datang
Average
Time Series: Moving average
• The moving average model uses the last t periods in order to predict demand in period t+1. • There can be two types of moving average models: simple moving average and weighted moving average
• The moving average model assumption is that the most accurate prediction of future demand is a simple (linear) combination of past demand.
Time series: simple moving average In the simple moving average models the forecast value is At + At-1 + … + At-n Ft+1 = n
t
is the current period.
Ft+1 is the forecast for next period n
is the forecasting horizon (how far back we look),
A
is the actual sales figure from each period.
Example: forecasting sales at Kroger Kroger sells (among other stuff) bottled spring water
Month
Bottles
Jan
1,325
Feb
1,353
Mar
1,305
Apr
1,275
May
1,210
Jun
1,195
Jul
?
What will the sales be for July?
What if we use a 3-month simple moving average?
FJul =
AJun + AMay + AApr
= 1,227
3
What if we use a 5-month simple moving average?
FJul =
AJun + AMay + AApr + AMar + AFeb 5
= 1,268
1400 1350
5-month MA forecast 3-month MA forecast
1300 1250 1200 1150 1100 1050 1000 0
1
2
3
4
5
6
What do we observe?
5-month average smoothes data more; 3-month average more responsive
7
8
Stability versus responsiveness in moving averages
d n a m e D
950 900 850 800 750 700 650 600 550 500
Demand 3-Week 6-Week
1
2
3
4 5
6
7
Week
8
9 10 11 12
Time series: weighted moving average We may want to give more importance to some of the data… Ft+1 = wt At + wt-1 At-1 + … + wt-n At-n wt + wt-1 + … + wt-n = 1 t
is the current period.
Ft+1 is the forecast for next period n
is the forecasting horizon (how far back we look),
A
is the actual sales figure from each period.
w
is the importance (weight) we give to each period
Why do we need the WMA models? Because of the ability to give more importance to what happened recently, without losing the impact of the past. Demand for Mercedes E-class
Actual demand (past sales) Prediction when using 6-month SMA Prediction when using 6-months WMA
Jan Feb Mar Apr May Jun Jul Aug
Time
For a 6-month SMA, attributing equal weights to all past data we miss the downward trend
Example: Kroger sales of bottled water
Month
Bottles
Jan
1,325
Feb
1,353
Mar
1,305
Apr
1,275
May
1,210
Jun
1,195
Jul
?
What will be the sales for July?
6-month simple moving average…
FJul =
AJun + AMay + AApr + AMar + AFeb + AJan
= 1,277
6
In other words, because we used equal weights, a slight downward trend that actually exists is not observed…
What if we use a weighted moving average? Make the weights for the last three months more than the first three months…
July Forecast
6-month SMA
WMA 40% / 60%
WMA 30% / 70%
WMA 20% / 80%
1,277
1,267
1,257
1,247
The higher the importance we give to recent data, the more we pick up the declining trend in our forecast.
Month
Bottles weight equal weight (40:60)
Jan
1,325
Feb
1,353
Mar
1,305
Apr
1,275
May
1,21
Jun
1,195
Jul
?
0,133 0,133 0,133 0,200 0,200 0,200 1,277
bxw 0,177 0,180 0,174 0,255 0,242 0,239 1,267
weight (30:70) 0,100 0,100 0,100 0,233 0,233 0,233
bxw 0,133 0,135 0,131 0,298 0,282 0,279 1,257
weight (20:80) 0,067 0,067 0,067 0,267 0,267 0,267
bxw 0,088 0,090 0,087 0,340 0,323 0,319 1,247
Time Series: Exponential Smoothing (ES) Main idea: The prediction of the future depends mostly on the most recent observation, and on the error for the latest forecast.
Smoothing constant alpha α
Denotes the importance of the past error
Why use exponential smoothing?
1. Uses less storage space for data
2. Extremely accurate 3. Easy to understand 4. Little calculation complexity
5. There are simple accuracy tests
Exponential smoothing: the method Assume that we are currently in period t. We calculated the forecast for the last period (Ft-1) and we know the actual demand last period (At-1) …
Ft Ft1 ( At1 Ft1 ) The smoothing constant α expresses how much our forecast will react to observed differences… If α is low: there is little reaction to differences. If α is high: there is a lot of reaction to differences.
Example: bottled water at Kroger Month
Actual
Forecasted
Jan
1,325
1,370
Feb
1,353
1,361
Mar
1,305
1,359
Apr
1,275
1,349
May
1,210
1,334
Jun
?
1,309
= 0.2
=1,334+(0,2X(1,210-1,334))
Example: bottled water at Kroger Month
Actual
Forecasted
Jan
1,325
1,370
Feb
1,353
1,334
Mar
1,305
1,349
Apr
1,275
1,314
May
1,210
1,283
Jun
?
1,225
= 0.8
=1,283+(0,8X(1,21-1,283))
Impact of the smoothing constant
1380 1360 1340 1320 1300 1280 1260 1240 1220 1200
Actual a = 0.2 a = 0.8
0
1
2
3
4
5
6
7
Soal Latihan periode waktu 1 2 3 4 5 6 7 8 9 10 11 12
Nilai Pengamatan Aktual 200 135 195 197 310 175 155 130 220 277 235 -
Lakukan peramalan menggunakan SMA 3 periode SMA 5 periode WMA 5 periode (30(2):70(3)) Eksponential smoothing alpha 0,1;0,5; dan 0,9
Jawaban
Linear regression in forecasting Linear regression is based on 1. Fitting a straight line to data 2. Explaining the change in one variable through changes in other variables.
dependent variable = a + b (independent variable)
By using linear regression, we are trying to explore which independent variables affect the dependent variable
Example: do people drink more when it’s cold? Alcohol Sales Which line best fits the data?
Average Monthly Temperature
The best line is the one that minimizes the error The predicted line is …
Y a bX So, the error is …
εi yi - Yi Where: ε is the error y is the observed value Y is the predicted value
Least Squares Method of Linear Regression
The goal of LSM is to minimize the sum of squared errors…
Min
2 i
What does that mean?
Alcohol Sales
ε
ε
So LSM tries to minimize the distance between the line and the points! Average Monthly Temperature
ε
Least Squares Method of Linear Regression Then the line is defined by
Y a bX (Y )(X 2 ) (X )(XY ) a Y bX 2 2 (n)(X ) (X ) (n)(XY ) (X )(Y ) b (n)(X 2 ) (X ) 2
Contoh Soal Berikut ini data mengenai pengalaman kerja dan penjualan X=pengalaman kerja (tahun) Y=omzet penjualan (ribuan)
Tentukan nilai a dan b!
___
24 X 3 8
___
Y
56 7 8
(Y )(X 2 ) (X )(XY ) a Y bX 2 2 (n)(X ) (X ) (n)(XY ) (X )(Y ) b (n)(X 2 ) (X ) 2 (56)(96) ( 24)(198) a (8)(96) ( 24) 2 5.376 4.752 a 3,25 768 576
(8)(198) (24)(56) b (8)(96) (24) 2 1.584 1.344 b 1,25 768 576
Koefisien determinasi (R2) 2 (( n )( XY ) ( X )( Y )) R2 ( n(X 2 ) (X ) 2 (n(Y 2 ) (Y ) 2 )
((8)(198) ( 24)(56)) 2 R (8(96) ( 24) 2 (8( 448) (56) 2 ) 2
2 ( 1 . 584 1 . 344 ) R2 (768 576) (3.584 3.136)
( 240) 2 R (192)( 448) 2
57.600 0,6696 86.016
a. Diperoleh nilai a = 3,25 dan nilai b = 1,25 b. Persamaan regresi linearnya adalah Y=3,25+1,25X
How can we compare across forecasting models? We need a metric that provides estimation of accuracy
Errors can be:
Forecast Error
1. biased (consistent) 2. random
Forecast error = Difference between actual and forecasted value (also known as residual)
Kesalahan Peramalan Beberapa metode lebih ditentukan untuk meringkas kesalahan (error) yang dihasilkan oleh fakta (keterangan) pada teknik peramalan. Sebagian besar dari pengukuran ini melibatkan rata-rata beberapa fungsi dari perbedaan antara nilai aktual dan nilai peramalannya. Perbedaan antara nilai observasi dan nilai ramalan ini sering dimaksud sebagai residual.
Measuring Accuracy: MFE MFE = Mean Forecast Error (Bias) It is the average error in the observations n
MFE
A F i 1
t
t
n
1. A more positive or negative MFE implies worse performance; the forecast is biased.
Measuring Accuracy: MAD MAD = Mean Absolute Deviation It is the average absolute error in the observations n
MAD
A F i1
t
t
n
1. Higher MAD implies worse performance. 2. If errors are normally distributed, then σε=1.25MAD
MFE & MAD: A Dartboard Analogy
Low MFE & MAD:
The forecast errors are small & unbiased
An Analogy (cont’d)
Low MFE but high MAD: On average, the arrows hit the bullseye (so much for averages!)
MFE & MAD: An Analogy
High MFE & MAD:
The forecasts are inaccurate & biased
Key Point Forecast must be measured for accuracy! The most common means of doing so is by measuring the either the mean absolute deviation or the standard deviation of the forecast error
Measuring Accuracy: Tracking signal The tracking signal is a measure of how often our estimations have been above or below the actual value. It is used to decide when to re-evaluate using a model. n
RSFE (At Ft ) i1
RSFE TS MAD
Positive tracking signal: most of the time actual values are above our forecasted values
Negative tracking signal: most of the time actual values are below our forecasted values
If TS > 4 or < -4, investigate!
Example: bottled water at Kroger Month
Actual
Forecast
Month
Actual
Forecast
Jan
1,325
1,370
Jan
1,325
1370
Feb
1,353
1,361
Feb
1,353
1306
Mar
1,305
1,359
Mar
1,305
1334
Apr
1,275
1,349
Apr
1,275
1290
May
1,210
1,334
May
1,210
1251
Jun
1,195
1,309
Jun
1,195
1175
Metoda A
Metode B
Question: Which one is better?
Bottled water at Kroger: compare MAD and TS MAD
TS
Metode A
69,83
-6
Metode B
32,83
- 1,92
We observe that B performs a lot better than A Conclusion: Probably there is trend in the data which A cannot capture
Which Forecasting Method Should You Use Gather the historical data of what you want to forecast Divide data into initiation set and evaluation set Use the first set to develop the models Use the second set to evaluate Compare the MADs and MFEs of each model
Jadi,,pilih metode yang mana?? (hitung MAD dan TS untuk masing-masing hasil peramalan)
Periode waktu 1 2 3 4 5 6 7 8 9 10 11 12
Nilai Pengamatan Aktual 200 135 195 197 310 175 155 130 220 277 235 -
SMA (3 periode)
SMA (5 periode)
WMA (5 periode) (30:70)
176,67 175,67 234,00 227,33 213,33 153,33 168,33 209,00 244,00
207,40 202,40 206,40 193,40 198,00 191,40 203,40
214,05 208,63 208,13 183,38 190,58 195,80 213,55
Eksponential Smoothing α = 0,1 α = 0,5 α = 0,9 200 200 200 193,50 167,50 141,50 193,65 181,25 189,65 193,99 189,13 196,27 205,59 249,56 298,63 202,53 212,28 187,36 197,78 183,64 158,24 191,00 156,82 132,82 193,90 188,41 211,28 202,21 232,71 270,43 205,49 233,85 238,54
Nilai Pengamatan Aktual 175,00 155,00 130,00 220,00 277,00 235,00 MFE MAD TS
SMA (3 periode)
SMA (5 periode)
234,00 227,33 213,33 153,33 168,33 209,00 -2.22 69,33 -0,192
207,40 202,40 206,40 193,40 198,00 191,40 -1.166 50,9 -0,137
WMA (5 periode) (30:70) 214,05 208,63 208,13 183,38 190,58 195,80 -1.42 55,5 -0,154
Eksponential Smoothing α = 0,1 α = 0,5 α = 0,9 205,59 249,56 298,63 202,53 212,28 187,36 197,78 183,64 158,24 191,00 156,82 132,82 193,90 188,41 211,28 202,21 232,71 270,43 -0.168 -5.237 -11.12 48,46 56,59 62,09 -0,020 -0,55 -1,07