TimeSeries
TimeSeries
Statistics
Time-Series Forecasting
The Importance of Forecasting
Common Approaches
to Forecasting
Example:
Time Series
Sales
Time
Trend Component
(continued)
Trend can be upward or downward
Trend can be linear or non-linear
Sales Sales
Time Time
Downward linear trend Upward nonlinear trend
Seasonal Component
Sales
Summer
Winter
Summer
Winter Spring Fall
Spring Fall
Time (Quarterly)
Cyclical Component
Year
Irregular Component
Moving Averages
Calculate moving averages to get an overall
impression of the pattern of movement over time
Averages of consecutive time series values for a
chosen period of length L
Exponential Smoothing
A weighted moving average
Moving Averages
Examples:
For a 5 year moving average, L = 5
For a 7 year moving average, L = 7
Etc.
Moving Averages
(continued)
Example: Five-year moving average
First average:
Y1 + Y2 + Y3 + Y4 + Y5
MA(5) =
5
Second average:
Y2 + Y3 + Y4 + Y5 + Y6
MA(5) =
5
etc.
Example: Annual Data
Year Sales
Annual Sales
1 23
2 40 60
3 25
50
4 27
5 32 40
Sales
6 48 30
7 33 20
8 37
10
9 37
10 50 0
1 2 3 4 5 6 7 8 9 10 11
11 40
Year
etc… etc…
Calculating Moving Averages
5-Year
Average Moving
Year Sales Year Average
1+ 2 + 3 + 4 + 5
1 23 3 29.4 3=
5
2 40 4 34.4
3 25 23 + 40 + 25 + 27 + 32
5 33.0 29.4 =
4 27 5
6 35.4
5 32 7 37.4
6 48 8 41.0
7 33 9 39.4
8 37 etc… … …
9 37
Each moving average is for a
10 50
consecutive block of 5 years
11 40
Annual vs. Moving Average
The 5-year 60
moving average
50
smoothes the
40
data and makes
Sales
it easier to see 30
the underlying 20
trend 10
0
1 2 3 4 5 6 7 8 9 10 11
Year
E1 = Y1
Ei = WYi + (1 − W )Ei−1
For i = 2, 3, 4, …
where:
Ei = exponentially smoothed value for period i
Ei-1 = exponentially smoothed value already
computed for period i - 1
Yi = observed value in period i
W = weight (smoothing coefficient), 0 < W < 1
Exponential Smoothing Example
Fluctuations
have been
smoothed
60
50
NOTE: the
40
smoothed value in Sales
30
this case is
generally a little 20
low, since the 10
trend is upward
0
sloping and the 1 2 3 4 5 6 7 8 9 10
weighting factor is Time Period
only .2 Sales Smoothed
Exponential Smoothing
(continued)
The weight (smoothing coefficient) is W
Subjectively chosen
Ranges from 0 to 1
Smaller W gives more smoothing, larger W gives less
smoothing
Ŷi+1 = Ei
Three Popular Methods
for Trend Fitting & Forecasting
Autoregressive Modeling
Linear Trend Forecasting
Ŷ = b0 + b1X
2017 0 20
2018 1 40
2019 2 30 In least squares linear, non-linear, and
2020 3 50 exponential modeling, time periods are
numbered starting with 0 and increasing
2021 4 70 by 1 for each time period.
2022 5 65
Linear Trend Forecasting
(continued)
The linear trend forecasting equation
is:
Time
Year Period Sales Ŷi = 21.905 + 9.5714 Xi
(X) (Y)
Sales trend
2017 0 20
80
2018 1 40 70
60
2019 2 30 50
sales
40
2020 3 50 30
20
2021 4 70 10
0
2022 5 65
0 1 2 3 4 5 6
Year
Linear Trend Forecasting
(continued)
Forecast for time period 6 (2023):
40
2021 4 70 30
20
2022 5 65 10
0
2023 6 ??
0 1 2 3 4 5 6
Year
Nonlinear Trend Forecasting
Yi = β0 + β1Xi + β2 X + εi
2
i
Year Units
15 4
16 3
17 2
18 3
19 2
20 2
21 4
22 6
Autoregressive Model: Example Solution