Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Lecture 4
Forecasting
Dr. Mourad YKHLEF
The slides content is derived and adopted from many references
Outline
Definitions
Forecasting types
Time series
Stationary forecasting models
Performance of forecasting methods
Linear trend time series
Trend, Seasonal and Cyclical time series
Associative forecasting
Definitions
Forecasting is the process of predicting the future.
Forecasting is an integrated part of almost all
business enterprises.
Examples:
Manufacturing firms forecast demand for their product, to schedule
manpower and raw material allocation.
Service organizations forecast customer arrival patterns to maintain
adequate customer service.
Firms consider economic forecasts of indicators (housing starts, changes
in gross national profit) before deciding on capital investments.
Definitions
Good forecasts can lead to
Reduced inventory costs.
Lower overall personnel costs.
Increased customer satisfaction.
Outline
Definitions
Forecasting types
Time series
Stationary forecasting models
Performance of forecasting methods
Linear trend time series
Trend, Seasonal and Cyclical time series
Associative forecasting
Medium-range forecast
3 months to 3 years
Sales and production planning, budgeting
Long-range forecast
3+ years
New product planning, facility location or expansion
Forecasting approaches
Qualtitative forecasts
Quantitive forecasts
Involve intuition,
experience
e.g., forecasting sales
on Internet
Use a variety of
mathematical models
that rely on historical
data and/or causal
variables
e.g., forecasting sales
of color televisions
Delphi method
Panel of experts, queried iteratively
Associative models
Liner regression
Multiple regression
Logistic regression
Outline
Definitions
Forecasting types
Time series
Stationary forecasting models
Performance of forecasting methods
Linear trend time series
Trend, Seasonal and Cyclical time series
Associative forecasting
10
Forecasting technique
That uses a series of past data points to make a forecast
Example
Year
Sales 78.7
63.5
11
Cyclical
Seasonal
Random
12
Trend component
Time series may be relatively
stationary or it may exhibit
trend over time
Trend is the gradual upward
or downward movement of
data over time
Trend indicates that the time
series is increasing or
decreasing
Trend is typically modeled as
a linear, quadratic or
exponential function
Response
13
Seasonal component
When a repetitive pattern
is observed over some time
horizon, the series is said to
have seasonal behavior.
Summer
Response
Mo., Qtr.
Seasonality is a data
pattern that repeats itself
after a period of days,
weeks, months or quarters.
Period of
Pattern
Season
Length
Number of
Seasons in
Pattern
Week
Day
Month
Week
44
Month
Day
28 31
Year
Quarter
Year
Month
12
Year
Week
52
14
Cyclical component
Cycles are patterns in the data that occur every several years.
Usually tied into the business cycle and are of the major
importance in short-term business analysis and planning.
Cycle
Response
Mo., Qtr., Yr.
IS 466 - Forecasting - Dr. Mourad Ykhlef
15
Random component
Erratic, unsystematic fluctuations
Due to random variations or unforeseen events
Union strike
Tornado
16
Future
Linear trend
Stationary
In Stationary, the mean value of the time series is assumed to be constant
IS 466 - Forecasting - Dr. Mourad Ykhlef
Time
17
18
Outline
Definitions
Forecasting types
Time series
Stationary forecasting models
Performance of forecasting methods
Linear trend time series
Trend, Seasonal and Cyclical time series
Associative forecasting
19
yt = 0 + t
independent
The values of et
are assumed to
have a mean of 0.
Where:
yt = the value of the time series at time period t.
0 = the unchanged mean value of the time series.
t = a random error term at time period t
20
21
22
Ft +1 = y t
e.g., if May sales were 50 then June sales will be 50
Sometimes cost effective & efficient
At least it provides a starting point which more
sophisticated models that follow can be compared
23
Ft +1 =
y t + y t 1 + ... + y t n+1
n
24
Example (1/7)
Galaxy Industries is interested in forecasting
weekly demand for its YoHo brand yo-yos.
The yo-yo is a mature product. This year demand
pattern is expected to repeat next year.
To forecast next year demand, the past 52 weeks
demand records were collected.
25
Example (2 /7)
Three forecasting methods were suggested:
Last period technique - suggested by Ahmed.
Four-period moving average - suggested by Karim.
Four-period weighted moving average - suggested by
Omar.
26
Example (3 /7)
Collection of demand records
Week
Week
11
22
33
44
55
66
77
88
99
10
10
11
11
12
12
13
13
Demand
Demand
415
415
236
236
348
348
272
272
280
280
395
395
438
438
431
431
446
446
354
354
529
529
241
241
262
262
Week
Week
14
14
15
15
16
16
17
17
18
18
19
19
20
20
21
21
22
22
23
23
24
24
25
25
26
26
Demand
Demand
365
365
471
471
402
402
429
429
376
376
363
363
513
513
197
197
438
438
557
557
625
625
266
266
551
551
Week
Week
27
27
28
28
29
29
30
30
31
31
32
32
33
33
34
34
35
35
36
36
37
37
38
38
39
39
Demand
Demand
351
351
388
388
336
336
414
414
346
346
252
252
256
256
378
378
391
391
217
217
427
427
293
293
288
288
Week
Week
40
40
41
41
42
42
43
43
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
Demand
Demand
282
282
399
399
309
309
435
435
299
299
522
522
376
376
483
483
416
416
245
245
393
393
482
482
484
484
27
Example (4 /7)
Construct the time series plot
Neither seasonality nor cyclical effects can be
observed
600
Series1
400
200
51
46
41
36
31
26
21
16
11
0
1
Demand
800
Weeks
28
S tand. E rr
t-S tat
P -value
29
Example (6 /7)
Forecast for Week 53
Last period technique (Ahmeds Forecast)
30
Example (7 /7)
Forecast for Weeks 54 and 55
Since the time series is stationary, the forecasts for
weeks 54 and 55 remain as the forecast for week
53.
These forecasts will be revised pending
observation of the actual demand in week 53.
31
32
33
Define:
Lt = smoothed value for time t
Ft+1 = the forecast value for time t+1
yt = the value of the time series at time t
= smoothing constant (weight) between 0 and 1
Ft +1 = L t = y t + (1 )Ft
An initial forecast is needed to start the process.
IS 466 - Forecasting - Dr. Mourad Ykhlef
34
Fn +1 = y n
Fn + 2 = y n +1 + (1 ) Fn +1 = y n +1 + (1 ) y n
IS 466 - Forecasting - Dr. Mourad Ykhlef
35
FN+1 = yN + (1 )FN,
FN+k = FN+1, for k = 2, 3,
36
Example 1 (1/3)
Period
Series
Forecast
1
2
3
45
49
415
236
348
272
280
245
#N/A
50
51
52
53
54
55
393
482
484
415
397.1
392.19
368.8296268
371.2466641
382.3219977
392.4898
392.4898
392.4898
37
Example 1 (2/3)
An exponential smoothing forecast is suggested,
with = 0.1.
An Initial Forecast is created at t=2 by
F2 = y1 = 415.
The recursive formula is used from period 3
onward:
F3 = .1y2 + .9F2 = .1(236) + .9(415) = 397.10
F4 = .1y3 + .9F3 = .1(348) + .9(397.10) = 392.19
and so on, until period 53 is reached (N+1 = 52+1 = 53).
F53 = .1y52 + .9F52 = .1(484) + .9(382.32) = 392.49
F54 = F55 = 392.49 ( = F53)
IS 466 - Forecasting - Dr. Mourad Ykhlef
38
Example 1 (3/3)
700
600
500
400
300
200
100
0
0
60
39
40
Example 2 (1/6)
If Drugs uses exponential smoothing to forecast
sales, which value for the smoothing constant , .1
or .8, gives better forecasts?
Week Sales
1
110
2
115
3
125
4
120
5
125
Week
6
7
8
9
10
Sales
120
130
115
110
130
41
Example 2 (2/6)
Exponential Smoothing: To evaluate the two
smoothing constants, determine how the
forecasted values would compare with the actual
historical values in each case.
Let: Yt = actual sales in week t
Ft = forecasted sales in week t
F2 = Y1 = 110
For other weeks, Ft+1 = .1Yt + .9Ft
42
Example 2 (3/6)
Exponential Smoothing ( = .1, 1 - = .9)
F2
F3 = .1Y2 + .9F2 = .1(115) + .9(110)
F4 = .1Y3 + .9F3 = .1(125) + .9(110.5)
F5 = .1Y4 + .9F4 = .1(120) + .9(111.95)
F6 = .1Y5 + .9F5 = .1(125) + .9(112.76)
F7 = .1Y6 + .9F6 = .1(120) + .9(113.98)
F8 = .1Y7 + .9F7 = .1(130) + .9(114.58)
F9 = .1Y8 + .9F8 = .1(115) + .9(116.12)
F10= .1Y9 + .9F9 = .1(110) + .9(116.01)
= 110
= 110.5
= 111.95
= 112.76
= 113.98
= 114.58
= 116.12
= 116.01
= 115.41
43
Example 2 (4/6)
Exponential Smoothing ( = .8, 1 - = .2)
F2
= 110
F3 = .8(115) + .2(110) = 114
F4 = .8(125) + .2(114) = 122.80
F5 = .8(120) + .2(122.80) = 120.56
F6 = .8(125) + .2(120.56) = 124.11
F7 = .8(120) + .2(124.11) = 120.82
F8 = .8(130) + .2(120.82) = 128.16
F9 = .8(115) + .2(128.16) = 117.63
F10= .8(110) + .2(117.63) = 111.53
44
Example 2 (5/6)
Mean Squared Error: In order to determine which
smoothing constant gives the better performance,
calculate, for each, the mean squared error for the
nine weeks of forecasts, weeks 2 through 10 by:
[(Y2-F2)2 + (Y3-F3)2 + (Y4-F4)2 + . . . + (Y10-F10)2]/9
Select the forecast with the smallest error value
45
Example 2 (6/6)
= .1
Ft
(Yt - Ft)2
= .8
Ft
(Yt - Ft)2
Week
Yt
1
2
3
4
5
6
7
8
9
10
110
115
125
120
125
120
130
115
110
130
110.00
25.00
110.50 210.25
111.95
64.80
112.76 149.94
113.98
36.25
114.58 237.73
116.12
1.26
116.01
36.12
115.41 212.87
110.00
25.00
114.00 121.00
122.80
7.84
120.56
19.71
124.11
16.91
120.82
84.23
128.16 173.30
117.63
58.26
111.53 341.27
MSE
Sum
974.22
Sum/9 108.25
Sum
847.52
Sum/9 94.17
46
Outline
Definitions
Forecasting types
Time series
Stationary forecasting models
Performance of forecasting methods (for reading)
Linear trend time series
Trend, Seasonal and Cyclical time series
Associative forecasting
47
48
MSE =
MAD =
( t)2
MAPE =
| t|
n|t|
n
yt
t|
LAD = max |
49
Example (1/5)
Time
Time series:
100
110
90
80
105
115
100
- 20
98
- 18
93.33
11.67
89
16
91.6
23.4
85.5
29.5
50
Example (2/5)
(
t)2 (-20)2+(11.67)2+(23.4)2
MSE =
=
3
= 361.24
(
t)2 (-18)2 + (16)2 + (29.5)2
MSE =
=
3
= 483.4
51
Example (3/5)
| t|
n
| t|
n
= 21.17
52
Example (4/5)
| t|
MAPE=
n
| t|
MAPE=
n
53
Example (5/5)
54
Outline
Definitions
Forecasting types
Time series
Stationary forecasting models
Performance of forecasting methods
Linear trend time series
Trend, Seasonal and Cyclical time series
Associative forecasting
55
56
57
Tt =
58
Example (1/4)
A large Portland manufacturer uses exponential
smoothing to forecast demand for a piece of
pollution control equipment. It appears that an
increasing trend is present. Month
Demand
1
12
=.2 and =.4
2
17
F1=11 and T1=2
3
20
4
5
6
7
8
9
10
19
24
21
31
28
36
?
59
Example (2/4)
Forecast for month 2
F2 = y1 + (1 ) (F1 + T1)=.2(12)+.8(11+2)=12.8
T2 = (F2 - F1) + (1- )T1=.4(12.8-11)+0.6(2)=1.92
FIT2 = F2 +T2 = 14.72 units
60
Example (3/4)
Actual Smoothed Smoothed
Forecast
Demand Forecast
Trend
including trend
12
11.00
2.00
13.00
17
12.80
1.92
14.72
20
15.18
2.10
17.28
19
17.82
2.32
20.14
24
19.91
2.23
22.14
21
22.51
2.38
24.89
31
24.11
2.07
26.18
28
27.14
1.45
28.59
36
29.28
2.32
31.60
32.48
2.68
35.16
IS 466 - Forecasting - Dr. Mourad Ykhlef
61
Example (4/4)
40
35
Actual
Demand
30
D em an d
25
20
15
Smoothed
forecast
Forecast including
trend
10
Smoothed trend
5
0
1
10
Month
62
Trend Projections
Deviation
Deviation
Deviation
Deviation
Point on
regression
line
Deviation
Deviation
Deviation
Y = a + bx
Time
IS 466 - Forecasting - Dr. Mourad Ykhlef
63
Trend Projections
Least Squares Equations (from statisticians)
Equation:
i = a + bx i
Y
Slope:
b=
xi y i nx y
i =1
n
x i2 n x 2
i =1
Y-Intercept:
a = y bx
IS 466 - Forecasting - Dr. Mourad Ykhlef
64
Example (1/4)
Year
2006
2007
2008
2009
2010
2011
2012
Demand
74
79
80
90
105
142
122
65
Example (2/4)
Year
Time
Power
Period Demand
x2
xy
2006
74
74
2007
79
158
2008
80
240
2009
90
16
360
2010
105
25
525
2011
142
36
852
2012
122
49
854
x=28
y=692
x2=140
xy=3,063
66
Example (3/4)
y 692
=
= 98.86
7
n
x=
x 28
=
=4
n
7
b=
y=
67
Example (4/4)
Electric Power Demand
160
150
140
130
120
110
100
90
80
70
60
1997
1998
1999
2000
2001
2002
2003
2004
2005
Year
68
Outline
Definitions
Forecasting types
Time series
Stationary forecasting models
Performance of forecasting methods
Linear trend time series
Trend, Seasonal and Cyclical time series
Associative forecasting
69
Tt
St
Ct
It
Additive model
Yt = Tt + St + Ct + It
IS 466 - Forecasting - Dr. Mourad Ykhlef
70
Multiplicative model
The magnitude of seasonal component grows in
proportion to the trend of series.
For example the cost of electric power consumption.
71
72
Example (1/11)
Business at Cloths Shop can be viewed as falling into three
distinct seasons:
(1) season 1 (November-December);
(2) season 2 (late May - mid-June); and
(3) all other times.
Average weekly sales (SR) during each of the three
seasons during the past four years are shown on
the next slide.
Determine a forecast for the average weekly sales
in year 5 for each of the three seasons.
73
Example (2/11)
Past Sales (SR)
Year
Season 1
2
3
4
1
1856 1995 2241 2280
2
2012 2168 2306 2408
3
985 1072 1105 1120
74
Example (3/11)
Remove trend
and cyclical components
Moving
Scaled
Year Season Sales (Yt) Average StIt
St
1
1
1856
1.178
2012 / 1617.67= 1.244 1.236
2
3
985
1664.00 .592 .586
2
1
1995
1716.00 1.163 1.178
2
2168
1745.00 1.242 1.236
3
1072
1827.00 .587 .586
3
1
2241
1873.00 1.196 1.178
2
2306
1884.00 1.224 1.236
3
1105
1897.00 .582 .586
4
1
2280
1931.00 1.181 1.178
2
2408
1936.00 1.244 1.236
3
1120
.586
Yt/St
1576
1628
1681
1694
1754
1829
1902
1866
1886
1935
1948
1911
75
Example (4/11)
1. Calculate the centered moving averages
There are three distinct seasons in each year.
Hence, take a three-season moving average to eliminate
seasonal and irregular factors (smoothing).
Moving Average keeps trend and cyclical factors
For example:
1st MA = (1856 + 2012 + 985)/3 = 1617.67
2nd MA = (2012 + 985 + 1995)/3 = 1664.00
etc.
IS 466 - Forecasting - Dr. Mourad Ykhlef
76
Example (5/11)
2. Center the CMAs on integer-valued periods
The first moving average computed in step 1
(1617.67) will be centered on season 2 of year 1.
Note that the moving averages from step 1 center
themselves on integer-valued periods because n=3
is an odd number.
Step 1 = (1+3)/2 = 2
IS 466 - Forecasting - Dr. Mourad Ykhlef
77
Example (6/11)
3. Determine the seasonal & irregular factors (St It )
78
Example (7/11)
4. Determine the average seasonal factors
Averaging all (St It) values corresponding to
that season:
Season 1: (
79
Example (8/11)
5. Scale the seasonal factors (St)
Average the seasonal factors =
(1.180 + 1.238 + .587)/3 = 1.002
Then, divide each seasonal factor by the average of the
seasonal factors.
Season 1: 1.180/1.002 = 1.178
Season 2: 1.238/1.002 = 1.236
Season 3: .587/1.002 = .586
Total = 3.000
IS 466 - Forecasting - Dr. Mourad Ykhlef
80
Example (9/11)
6. Determine the deseasonalized data (Yt /St )
Divide the data point values, Yt , by St .
7. Determine a trend line of the deseasonalized data
Using the least squares method (trend projection) for t = 1,
2, ..., 12, gives:
Tt = 1580.11 + 33.96t
81
Example (10/11)
8. Determine the deseasonalized predictions
Substitute t = 13, 14, and 15 into the least squares
equation:
T13 = 1580.11 + (33.96)(13) = 2022
T14 = 1580.11 + (33.96)(14) = 2056
T15 = 1580.11 + (33.96)(15) = 2090
82
Example (11/11)
9. Take into account the seasonality.
Multiply each deseasonalized prediction by its
seasonal factor to give the following forecasts for
year 5:
Season 1: (1.178)(2022) = 2382
Season 2: (1.236)(2056) = 2541
Season 3: ( .586)(2090) = 1225
83
Outline
Definitions
Forecasting types
Time series
Stationary forecasting models
Performance of forecasting methods
Linear trend time series
Trend, Seasonal and Cyclical time series
Associative forecasting
84
Associative Forecasting
Regression analysis (Trend projection)
Multiple regression analysis
Logistic regression
85
Final Thought
The best way to
predict the future
is to create it!
86