Forecasting

advertisement
Forecasting
• Purpose is to forecast, not to explain the historical pattern
• Models for forecasting may not make sense as a description for
”physical” behaviour of the time series
• Common sense and mathematics in a good combination produces
”optimal” forecasts
• With time series regression models, forecasting (prediction) is a
natural step and forecasting limits (intervals) can be constructed
• With Classical decomposition, forecasting may be done, but
estimation of accuracy lacks and no forecasting limits are
produced
• Classical decomposition is usually combined with Exponential
smoothing methods
Exponential smoothing
• Use the historical data to forecast the future
• Let different parts of the history have different impact on
the forecasts
• Forecast model is not developed from any statistical theory
Single exponential smoothing
• Given are historical values y1,y2,…yT
• Assume data contains no trend
Algorithm for forecasting:
 t    yt  (1   )   t 1 ; t  t1 , t1  1,, T
yˆT    T ;   1,2, ( constant forecasts! )
where  is a smoothing parameter with value between 0 and 1
• The forecast procedure is a recursion formula
• How shall we choose α?
• Where should we start, i.e. which is the initial value  t0 ?
For long length time series:
Use a part (usually first half) of the historical data
y1 ,, yt0
and calculate their average:
Set
yhist
1

t0
t0
y
t 1
 t0  yhist
Update with the rest of the historical data
yt0 1 , , yT
using the recursion formula
t
Example: Sales of everyday commodities
Year
Sales values
1985
151
1986
151
1987
147
1988
149
1989
146
1990
142
1991
143
1992
145
1993
141
1994
143
1995
145
1996
138
1997
147
1998
151
1999
148
2000
148
Note! This time series is short but
we use it for illustration purposes!
Calculate the average of the first 8 observations of the series:
yhist  (151  151  ...145)/8  146.75
Set  8  yhist  146.75
Assume first that the sales are very stable, i.e. during the period
the background mean value is assumed not to change
Set α to be relatively small. This means that the latest
observation plays a less role than the history in the forecasts.
Thumb rule: 0.05 < α < 0.3
E.g. Set α=0.1
Update using the next 8 values of the historical data
 9  0.1  y9  0.9   8  0.1 141  0.9 146.75  146.175
 10  0.1  y10  0.9   9  0.1 143  0.9 146.175  145.8575
 11  0.1  y11  0.9   10  0.1 145  0.9 145.8575  145.772
 12  0.1  y12  0.9   11  0.1 138  0.9 145.772  144.995
 13  0.1  y13  0.9   12  0.1 147  0.9 144.995  145.1955
 14  0.1  y14  0.9   13  0.1 151  0.9 145.1955  145.776
 15  0.1  y15  0.9   14  0.1 148  0.9 145.776  145.998
Forecasts:
 16  0.1 y16  0.9   15  0.1 148  0.9 145.998  146.2
yˆ17  146.2
yˆ18  146.2
yˆ19  146.2
etc.
For short length time series:
Calculate the average of all historical data i.e.
1 T
yhist   yt
T t 1
Update from the beginning of the time series:
 t    yt  (1   )   t 1 ; t  1,2,, T
1 T
 t 0   0   yt
T t 1
There are a lot of alternatives:
• Average of all data, update from the middle of the series
• Average of the first half, update from beginning
• etc.
Analysis of example data with MINITAB

MTB > Name c3 "FORE1" c4 "UPPE1" c5 "LOWE1"
MTB > SES 'Sales values';
SUBC>
Weight 0.1;
SUBC>
Initial 8;
SUBC>
Forecasts 3;
SUBC>
Fstore 'FORE1';
SUBC>
Upper 'UPPE1';
SUBC>
Lower 'LOWE1';
SUBC>
Title "SES alpha=0.1".
Single Exponential Smoothing for Sales values
Data
Sales values
Length
16
Smoothing Constant
Alpha
0.1
Accuracy Measures
MAPE
2.2378
MAD
3.2447
MSD
14.4781
Forecasts
Period
Forecast
Lower
Upper
17
146.043
138.094
153.992
18
146.043
138.094
153.992
19
146.043
138.094
153.992
MINITAB uses smoothing
from 1st value!
Assume now that the sales are less stable, i.e. during the
period the background mean value is possibly changing.
(Note that a change means an occasional “level shift” ,
not a systematic trend)
Set α to be relatively large. This means that the latest
observation becomes more important in the forecasts.
E.g. Set α=0.5 (A bit exaggerated)
Single Exponential Smoothing for Sales values
Data
Sales values
Length
16
Smoothing Constant
Alpha
0.5
Accuracy Measures
MAPE
1.9924
MAD
2.8992
MSD
13.0928
Forecasts
Period
Forecast
Lower
Upper
17
147.873
140.770
154.976
18
147.873
140.770
154.976
19
147.873
140.770
154.976
Slightly narrower prediction intervals
We can also use some adaptive procedure to continuosly
evaluate the forecast ability and maybe change the smoothing
parameter over time
Alt. We can run the process with different alphas and choose
the one that performs best. This can be done with the
MINITAB procedure.
Single Exponential Smoothing for Sales values
--Smoothing Constant
SES optimal alpha
156
Alpha
Variable
Actual
Fits
Forecasts
95.0% PI
0.567101
Accuracy Measures
MAPE
1.7914
MAD
2.5940
MSD
12.1632
Sales values
152
Smoothing Constant
0.567101
Alpha
148
144
140
2
Forecasts
Period
Accuracy Measures
1.7914
MAPE
2.5940
MAD
12.1632
MSD
4
Forecast
Lower
Upper
17
148.013
141.658
154.369
18
148.013
141.658
154.369
19
148.013
141.658
154.369
6
8
10
Index
12
14
16
18
Yet, narrower prediction
intervals
Exponential smoothing for times series with trend
and/or seasonal variation
• Double exponential smoothing (one smoothing parameter)
for trend
• Holt’s method (two smoothing parameters) for trend
• Multiplicative Winter’s method (three smoothing
parameters) for seasonal (and trend)
• Additive Winter’s method (three smoothing parameters)
for seasonal (and trend)
Example: Real Estate Price Index for Weekend
Cottages in Sweden
REPI_C
1993
226
1994
241
1995
239
1996
240
1997
268
1998
303
1999
336
2000
414
2001
472
2002
496
2003
505
2004
546
2005
591
Time Series Plot of REPI_C
600
500
REPI_C
Year
400
300
200
1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005
Year
Trend but no seasonal variation
Applying Holt’s method with MINITAB (denoted Double
exponential smoothing in Minitab)
2 smoothing
parameters, one for
level and one for
trend.
Option to let Minitab
calculate optimal
parameters.
Smoothing parameters
should still be kept low
(0.05,0.3)
Double Exponential Smoothing for REPI_C
Data
REPI_C
Length
13
Double Exponential Smoothing Plot for REPI_C
Variable
A ctual
Fits
Forecasts
95.0% PI
700
Smoothing Constants
600
0.2
Gamma (trend)
0.2
Smoothing C onstants
A lpha (lev el)
0.2
Gamma (trend)
0.2
500
REPI_C
Alpha (level)
Accuracy Measures
MAPE
9.78
MAD
30.15
MSD
1160.79
400
Accuracy Measures
300
MAPE
9.78
MAD
30.15
MSD
1160.79
200
100
1
2
Forecasts
Period
Forecast
Lower
Upper
14
611.411
537.537
685.286
15
646.167
570.753
721.581
3
4
5
6
7
8 9
Index
10 11 12 13 14 15
Example: Quarterly sales data
year
quarter sales
1991
1
124
1991
2
157
1991
3
163
1991
4
126
200
1992
1
119
190
1992
2
163
180
1992
3
176
170
1992
4
127
160
1993
1
126
1993
2
160
1993
3
181
1993
4
121
1994
1
131
1994
2
168
1994
3
189
1994
4
134
1995
1
133
1995
2
167
1995
3
195
1995
4
131
sales
Time Series Plot of sales
150
140
130
120
110
Quarter Q1
Year 1991
Q3
Q1
1992
Q3
Q1
1993
Q3
Q1
1994
Q3
Q1
1995
Q3
Applying Winter’s multiplicative method with MINITAB
3 smoothing parameters, one for level, one for trend an one for
seasonal variation.
No option to calculate optimal parameters. Choices have do be based
on visual inspection of the times series
Winters' Method for sales
Multiplicative Method
Data
sales
Length
20
Winters' Method Plot for sales
Multiplicative Method
210
Variable
Actual
Fits
Forecasts
95.0% PI
200
Smoothing Constants
190
0.2
Gamma (trend)
0.2
Delta (seasonal)
0.2
180
sales
Alpha (level)
Smoothing C onstants
A lpha (lev el)
0.2
Gamma (trend)
0.2
Delta (seasonal)
0.2
170
160
Accuracy Measures
MA PE
2.6446
MA D
3.8808
MSD
23.7076
150
Accuracy Measures
140
MAPE
2.6446
130
MAD
3.8808
120
MSD
23.7076
Quarter
Year
Q3
2008
Forecasts
Period
Forecast
Lower
Upper
Q3-2013
135.625
126.117
145.133
Q4-2013
174.430
164.773
184.087
Q1-2014
194.667
184.844
204.490
Q2-2014
136.933
126.928
146.939
Q3
2009
Q3
2010
Q3
2011
Q3
2012
Q3
2013
Download