Time Series
Time Series
MODELS
Definitions
Quantity
– Cyclical effect (C).
– Seasonal effect (S).
– Random variation (R).
Time
into:
1 42
predicted(forecasted) 9 45 43.0 42
11 40 42.3 42.4
12 41.0 42.6
Simple Moving Average -
Example
Actual
MA5
47
45
43
41
39
37 MA3
35
1 2 3 4 5 6 7 8 9 10 11 12
Sample Excel analysis for Actual,
Moving Averages for 3 and 5 periods
Period Actual MA3 MA5
1 42 #N/A #N/A
2 40 #N/A #N/A
3 43 41.66667 #N/A
4 40 41 #N/A
5 41 41.33333 41.2
6 39 40 40.6
7 46 42 41.8
8 44 43 42
9 45 45 43
10 38 42.33333 42.4
11 40 41 42.6
Sample Excel analysis for Actual, Centred
Moving Averages for 2 and 4 periods
Period Actual Avg2 Centered MA2 Avg4 Centered MA4
1 42 NA NA
41
2 40 41.25 NA
41.5 41.25
3 43 41.5 41.125
41.5 41
4 40 41 40.875
40.5 40.75
5 41 40.25 41.125
40 41.5
6 39 41.25 42
42.5 42.5
7 46 43.75 43
45 43.5
8 44 44.75 43.375
44.5 43.25
9 45 43 42.5
41.5 41.75
10 38 40.25 NA
39
11 40 NA NA
Sample SPSS analysis for Actual,
Centered MA3 and Prior MA3
1 42
2 40 41.7
3 43 41.0
4 40 41.3 41.7
5 41 40.0 41.0
6 39 42.0 41.3
7 46 43.0 40.0
Sample SPSS graph for Actual,
Centered MA5 and Prior MA5
Example: Weekly Department Store Sales
Period (t) Sales (y)
• The weekly sales 1
2
5.3
4.4
department store to 13
14
5
6.2
personnel. 20
21
5.1
5.8
22 6.7
23 5.2
24 6
25 5.8
Example: Weekly Department Store Sales
forecast
a
S
14 6.2 5.3
15 5.6 5.666667
3
16 6.7 5.6
17 5.2 6.166667
2 18 5.5 5.833333
19 5.8 5.8
20 5.1 5.5
1
21 5.8 5.466667
22 6.7 5.566667
0 23 5.2 5.866667
0 5 10 15 20 25 30 24 6 5.9
Weeks 25 5.8 5.966667
5.666667
Problem: Robert’s Drugs
During the past ten weeks, sales of cases of Comfort
brand headache medicine at Robert's Drugs have been as
follows:
Week Sales Week Sales
1 110 6 120
2 115 7 130
3 125 8 115
4 120 9 110
5 125 10 130
If Robert's uses a 3-period moving average to forecast
sales, what is the forecast for Week 11?
Exponential Smoothing Methods
• This method provides an exponentially
weighted moving average of all previously
observed values.
• Appropriate for data with no predictable
upward or downward trend.
• The aim is to estimate the current level and use
it as a forecast of future value.
Simple Exponential Smoothing Method
Ft 1 yt (1 ) Ft
yt (1 )[ yt 1 (1 ) Ft 1 ]
yt (1 ) y t 1 (1 ) 2 Ft 1
Simple Exponential Smoothing Method
CFE = Et
(Et – E )2
= Et2 n–1
MSE =
n
|Et | [ |Et | (100) ] / yt
MAD = MAPE = n
n
Example
The following table shows the actual
sales of upholstered chairs for a
furniture manufacturer and the
forecasts made for each of the last
eight months. Calculate CFE, MSE, σ,
MAD and MAPE for this product.
Choosing a Method
Forecast Error
Absolute
Error Absolute Percent
Month, Demand, Forecast, Error, Squared, Error, Error,
t yt Ft Et Et2
|Et| (|Et|/yt)(100)
1 200 225 -25 625 25 12.5%
2 240 220 20 400 20 8.3
3 300 285 15 225 15 5.0
4 270 290 –20 400 20 7.4
5 230 250 –20 400 20 8.7
6 260 240 20 400 20 7.7
7 210 250 –40 1600 40 19.0
8 275 240 35 1225 35 12.7
Total –15 5275 195 81.3%
Choosing a Method
Forecast Error
Measures of Error
Absolute
CFE = – 15 Error Absolute Percent
Month, Demand, Forecast, Error, Squared, Error, Error,
– 15 D
E =t = –t 1.875 Ft Et Et2
|Et| (|Et|/Dt)(100)
8
1 200 225 –25 625 25 12.5%
2 240
5275 220 20 400 20 8.3
MSE 3= 300 = 659.4
285 15 225 15 5.0
4 8 270 290 –20 400 20 7.4
5 230 250 –20 400 20 8.7
6 = 27.4
260 240 20 400 20 7.7
7 210 250 –40 1600 40 19.0
8 195
275= 24.4 240 35 1225 35 12.7
MAD =
8 Total –15 5275 195 81.3%
81.3%
MAPE = = 10.2%
8
Measures of Forecast Accuracy
• Choose MSE if it is important to avoid (even a
few) large errors. Otherwise, use MAD / MAPE.
• 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
F1 = Y1 = 110
For other weeks, Ft+1 = .1Yt + .9Ft
Example: Robert’s Drugs
• Exponential Smoothing
For = .1, 1 - = .9
F1 = 110
F2 = .1Y1 + .9F1 = .1(110) + .9(110) = 110
F3 = .1Y2 + .9F2 = .1(115) + .9(110) = 110.5
F4 = .1Y3 + .9F3 = .1(125) + .9(110.5) = 111.95
F5 = .1Y4 + .9F4 = .1(120) + .9(111.95) = 112.76
F6 = .1Y5 + .9F5 = .1(125) + .9(112.76) = 113.98
F7 = .1Y6 + .9F6 = .1(120) + .9(113.98) = 114.58
F8 = .1Y7 + .9F7 = .1(130) + .9(114.58) = 116.12
F9 = .1Y8 + .9F8 = .1(115) + .9(116.12) = 116.01
F10= .1Y9 + .9F9 = .1(110) + .9(116.01) = 115.41
Example: Robert’s Drugs
• Exponential Smoothing
For = .8, 1 - = .2
F1 = 110
F2 = .8(110) + .2(110) = 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
Example: Robert’s Drugs
• 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
Example: Robert’s Drugs
= .1 = .8
Week Yt Ft (Yt - Ft)2 Ft (Yt - Ft)2
1 110
2 115 110.00 25.00 110.00 25.00
3 125 110.50 210.25 114.00 121.00
4 120 111.95 64.80 122.80 7.84
5 125 112.76 149.94 120.56 19.71
6 120 113.98 36.25 124.11 16.91
7 130 114.58 237.73 120.82 84.23
8 115 116.12 1.26 128.16 173.30
9 110 116.01 36.12 117.63 58.26
10 130 115.41 212.87 111.53 341.27
Sum 974.22 Sum 847.52
MSE Sum/9 108.25
108.25
Sum/9 94.17
94.17
Seasonal Analysis
• Seasonal variation may occur within a
year or within a shorter period (month,
week)
• To measure the seasonal effects we
construct seasonal indices.
• Seasonal indexes express the degree to
which the seasons differ from the average
time series value across all seasons.
Computing Seasonal Indices
• Remove the effects of the seasonal and
random variations by regression analysis
ŷt = b0 + b1t
• For each time period compute the ratio
yt/yt > This is based on the Multiplicative Model.
>
• For each season calculate the average of yt/yt
which provides the measure of seasonality.
• Adjust the average above so that the sum of averages
of all seasons is 1 (if necessary)
Computing Seasonal Indices
• Example
– Calculate the quarterly seasonal indices for
hotel occupancy rate in order to measure
seasonal variation.
– Data:
Year Quarter Rate Year Quarter Rate Year Quarter Rate
1996 1 0.561 1998 1 0.594 2000 1 0.665
2 0.702 2 0.738 2 0.835
3 0.8 3 0.729 3 0.873
4 0.568 4 0.6 4 0.67
1997 1 0.575 1999 1 0.622
2 0.738 2 0.708
3 0.868 3 0.806
4 0.605 4 0.632
Computing Seasonal Indices
• Perform regression analysis for the model
y = 0 + 1t + where t represents the time,
and y represents the occupancy rate.
ŷ .639368 .005246t
Time (t) Rate
1 0.561
2 0.702
3 0.800
Rate
4 0.568
5 0.575
6 0.738
7 0.868 0 5 10 15 20 25
8 0.605 The regression linet represents trend.
. .
. .
The Ratios
>
yt y t
t yt ŷ t Ratio
1 .561 .645 .561/.645=.870
2 .702 .650 .702/.650=1.08
3 ………………………………………………….
=.639368+.005245(1)
No trend is observed, but
yt seasonality and randomness
Rate/Predicted rate
ŷ t still exist.
1.5
0.5
0
1
11
15
17
13
19
The Average Ratios by Seasons
Rate/Predictedrate
Rate/Predicted rate
0.870
0.870
1.080
1.080
• To remove most of the random variation
1.221
1.221 but leave the seasonal effects,average
0.860
0.860
0.864
0.864
the terms yt / yˆ t for each season.
1.100
1.100
1.284
1.284 Rate/Predicted rate
0.888
0.888
0.865
0.865 1.5
1.067
1.067
1.046
1.046 1
0.854
0.854
0.879 0.5
0.879
0.993
0.993 0
1.122
1.122
0.874 1 3 5 7 9 11 13 15 17 19
0.874 Average ratio for quarter 1: (.870 + .864 + .865 + .879 + .913)/5 = .878
0.913
0.913
1.138
1.138
Average ratio for quarter 2: (1.080+1.100+1.067+.993+1.138)/5 = 1.076
1.181
1.181 Average ratio for quarter 3: (1.221+1.284+1.046+1.122+1.181)/5 = 1.171
0.900
0.900
Average ratio for quarter 4: (.860 +.888 + .854 + .874 + .900)/ 5 = .875
Adjusting the Average Ratios
• In this example the sum of all the averaged ratios
must be 4, such that the average ratio per season is
equal to 1.
• If the sum of all the ratios is not 4, we need to adjust
them proportionately.
Suppose the sum of ratios is equal to 4.1. Then each
ratio will be multiplied by 4/4.1.
0.7
0.6
0.6
0.4
0.2
0
0 5 10 15 20 25