Time Series Models and Forecasting and Forecasting
Time Series Models and Forecasting and Forecasting
( 1) n n
today
1 n
n
Example:
Weighted Moving
Average Forecasting
Weighted Moving Average
(Example)
Actual wMA(n=3)
Month Burglaries 100.00% =SUM(C4:C6) All weights should add-up exactly to 1
To determine best
weights and
Month Burglaries 100.00% =SUM(C4:C6) All weights should add-up exactly to 1
42 88 0.1 The further away from the forecast period
43 44 0.3 weights: the lower is the weight
44 60 0.6 Most recent observation has the highest weight
45 56 58.0 =B5*$C$6+B4*$C$5+B3*$C$4
46 70 56.0 =B6*$C$6+B5*$C$5+B4*$C$4
47 91 64.8 =B7*$C$6+B6*$C$5+B5*$C$4
48 54 81.2 :
49 60 66.7 :
50 48 61.3 :
51 35 52.2 :
52 49 41.4 :
53 44 44.7 :
weights and
period (n) we can
use forecast
accuracy.
MSE = Mean
Square Error is a
good measure for
53 44 44.7 :
54 61 44.6 :
55 68 54.7 :
56 82 63.5 :
57 71 75.7 :
58 50 74.0
59 59.5 Preliminary forecasted number of burglaries
MSE = 256.3 =SUMXMY2(B7:B20,C7:C20)/COUNT(B7:B20)
RMSE = 16.01 =SQRT(C22)
good measure for
forecast accuracy.
RMSE = is the
square root of the
MSE.
Weighted Moving Average
(Example)
Best weights for a given n (in this
Actual wMA(k=3)
Month Burglaries 100.00%
Best weights for a given n (in this
case 3) is determined by
minimizing RMSE.
Same procedure could be applied
to models with different ns and
the one with lowest RMSE could
be considered as the model with
Month Burglaries 100.00%
42 88 0.0285
43 44 0.2093
44 60 0.7622
45 56 57.5
46 70 56.5
47 91 66.8
48 54 85.6
49 60 62.2
50 48 59.6
51 35 50.7
52 49 38.4
be considered as the model with
best forecasting period.
53 44 46.0
54 61 44.8
55 68 57.1
56 82 65.8
57 71 78.5
58 50 73.2
59 55.3
MSE = 250.6
RMSE = 15.83
Exponential Smoothing: Concept
Include all past observations
Weight recent observations much more heavily
than very old observations: than very old observations:
weight
Decreasing weight given
to older observations
0 1 < <
2
(1 )
(1 )
today
(1 )
3
(1 )
Exponential Smoothing: Math
| |
2
1 2
1 2
(1 ) (1 )
(1 ) (1 )
t t t t
t t t t
F D D D
F D D D
= + + +
= + + +
1
(1 )
t t t
F D F
= +
| |
1 2 t t t t
Exponential Smoothing: Math
2
1 2
1
(1 ) (1 )
(1 )
t t t t
t t t
F D D D
F D F
= + + +
= +
Thus, new forecast is weighted sum of old forecast and actual
demand
Notes:
- Only 2 values (D
t
and F
t-1
) are required, compared with n for moving
average
- Parameter determined empirically (whatever works best)
1 t t t
- Rule of thumb: < 0.5
- Typically, = 0.2 or = 0.3 works well
Forecast for k periods into future is:
t k t
F F
+
=
Exponential Smoothing
450
Internet Unicycle Sales (1000's)
150
200
250
300
350
400
450
U
n
i
t
s
a = 0.2
0
50
100
150
Jan-03 May-04 Sep-05 Feb-07 Jun-08 Nov-09 Mar-11 Aug-12
Month
Example:
Exponential Smoothing
Complicating Factors
Simple Exponential Smoothing works well Simple Exponential Smoothing works well
with data that is moving sideways
(stationary)
Must be adapted for data series which
exhibit a definite trend
Must be further adapted for data series
which exhibit seasonal patterns
Must be further adapted for data series
which exhibit seasonal patterns
Holts Method:
Double Exponential Smoothing
What happens when there is a definite trend?
A trendy clothing boutique has had the following sales
over the past 6 months: over the past 6 months:
1 2 3 4 5 6
510 512 528 530 542 552
530
540
550
560
D
e
m
a
n
d
Actual
Forecast
480
490
500
510
520
530
1 2 3 4 5 6 7 8 9 10
Month
D
e
m
a
n
d
Forecast
Holts Method:
Double Exponential Smoothing
Ideas behind smoothing with trend:
- ``De-trend'' time-series by separating base from trend effects
- Smooth base in usual manner using - Smooth base in usual manner using
- Smooth trend forecasts in usual manner using
Smooth the base forecast B
t
Smooth the trend forecast T
t
1 1
(1 )( )
t t t t
B D B T
= + +
( ) (1 ) T B B T
= +
Forecast k periods into future F
t+k
with base and trend
1 1
( ) (1 )
t t t t
T B B T
= +
t k t t
F B kT
+
= +
ES with Trend
Internet Unicycle Sales (1000's)
200
250
300
350
400
450
U
n
i
t
s
a = 0.2, b = 0.4
0
50
100
150
Jan-03 May-04 Sep-05 Feb-07 Jun-08 Nov-09 Mar-11 Aug-12
Month
Example:
Exponential Smoothing
with Trend
Winters Method:
Exponential Smoothing
w/ Trend and Seasonality
Ideas behind smoothing with trend and seasonality:
- De-trend: and de-seasonalizetime-series by separating base from - De-trend: and de-seasonalizetime-series by separating base from
trend and seasonality effects
- Smooth base in usual manner using
- Smooth trend forecasts in usual manner using
- Smooth seasonality forecasts using g
Assume m seasons in a cycle
- 12 months in a year - 12 months in a year
- 4 quarters in a month
- 3 months in a quarter
- et cetera
Winters Method:
Exponential Smoothing
w/ Trend and Seasonality
Smooth the base forecast B
t
Smooth the trend forecast T
t
1 1
(1 )( )
t
t t t
t m
D
B B T
S
= + +
1 1
( ) (1 )
t t t t
T B B T
= +
Smooth the seasonality forecast S
t
(1 )
t
t t m
t
D
S S
B
= +
Winters Method:
Exponential Smoothing
w/ Trend and Seasonality
Forecast F
t
with trend and seasonality
Smooth the trend forecast T
t
1 1
( )
t k t t t k m
F B kT S
+ +
= +
1 1
( ) (1 )
t t t t
T B B T
= +
Smooth the seasonality forecast S
t
(1 )
t
t t m
t
D
S S
B
= +
ES with Trend and Seasonality
Internet Unicycle Sales (1000's)
200
250
300
350
400
450
500
U
n
i
t
s
a = 0.2, b = 0.4, g = 0.6
0
50
100
150
200
Jan-03 May-04 Sep-05 Feb-07 Jun-08 Nov-09 Mar-11 Aug-12
Month
Example:
Exponential Smoothing Exponential Smoothing
with
Trend and Seasonality
Forecasting Performance
Mean Forecast Error (MFE or Bias): Measures
average deviation of forecast from actuals.
How good is the forecast?
average deviation of forecast from actuals.
Mean Absolute Deviation (MAD): Measures
average absolute deviation of forecast from
actuals.
Mean Absolute Percentage Error (MAPE):
Measures absolute error as a percentage of the Measures absolute error as a percentage of the
forecast.
Standard Squared Error (MSE): Measures
variance of forecast error
Forecasting Performance Measures
1
( )
n
t t
MFE D F
n
=
1
( )
t t
t
MFE D F
n
=
=
1
1
n
t t
t
MAD D F
n
=
=
100
n
t t
D F
MAPE
=
1
t t
t
t
MAPE
n D
=
=
2
1
1
( )
n
t t
t
MSE D F
n
=
=
=
Measures deviation as a percentage of actual data
Mean Squared Error (MSE)
2
1
( )
n
MSE D F =
0
= Intercept of the trend line
1
= Slope of the trend line
t = Time (t = 1, 2, . . . )
Linear Trend Model (Example)
Year t Sales
Taft Ice Cream Sales
Year t Sales
1991 1 $300,000
1992 2 $295,000
1993 3 $330,000
1994 4 $345,000
1995 5 $320,000
1996 6 $370,000 1996 6 $370,000
1997 7 $380,000
1998 8 $400,000
1999 9 $385,000
2000 10 $430,000
Linear Trend Model
(Example, Contd.) (Example, Contd.)
$500,000
$200,000
$250,000
$300,000
$350,000
$400,000
$450,000
S
a
l
e
s
$0
$50,000
$100,000
$150,000
1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001
Year
Linear Trend Model
(Example, Contd.) (Example, Contd.)
LEAST SQUARES EQUATIONS LEAST SQUARES EQUATIONS
t y
1 2
2
t
t
t y
t y
n
b
t y
t
n
0 1
t
y t
b b
n n
=
where:
n = Number of periods in the time series
t = Time period independent variable
y
t
= Dependent variable at time t
n n
Linear Trend Model
(Example, Contd.) (Example, Contd.)
Taft Linear Trend Model
$500,000
y = 14576t + 277333
$150,000
$200,000
$250,000
$300,000
$350,000
$400,000
$450,000
$500,000
S
a
l
e
s
$0
$50,000
$100,000
1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001
Year
Linear Trend Model
- Forecasting -
Trend Projection: Trend Projection:
Forecasting Period t = 11:
277, 333.33 14, 575.76( )
t
F t = +
277, 333.33 14, 575.76(11)
$437, 666.69
t
F = +
Nonlinear Trend Models
2
y t = + +
2
0 1 t t
y t = + +