Time Series Exponential Smoothing STAT317-455
Semester 2, 2021
Fidelio Statistical Services
Time Series Exponential Smoothing Semester 2, 2021 1 / 19
Forecasting
Predicting the next value(s) in time series
How you do it is often less relevant than how successful are your predictions
And sometimes success is less important than confidence you will be right next time!
Successful predictions means success for predictor, and Modelling is important but not always necessary Context is important
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 2 / 19
Context For Making a Prediction
How important is it that you get it right?
How much faith have you in the data?
How much do you believe that things are staying the same? How many forecasts do you need to do?
How long have you got to do them?
Are you going to have to do them again?
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 3 / 19
Need a Prediction? Where To Start
Usually the major assumption is what happened in the past is a good predictor of what will happen in the future Or more correctly, all you have to predict the future is the past data.
If the past predicts the future the first method of prediction is to predict that next value will be equal to current value. It is simple and you better be sure that doing complicated modelling does better than this.
But, what if current value is odd e.g. COVID on hospitality industry? You want to make some allowance for the general pattern of the data and not be too influenced by unusual measurements.
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 4 / 19
Forecasting – Better than Repeating Current value?
So what you want is some combination of current value, but with allowance for what’s generally happened in the past. In other words, a balance between current effects on DGP and the general behaviour of DGP. Partly based on what your model tells you – look at your residuals – and partly on subject matter knowledge.
So consider combining the current value and the predicted (modelled) current value, which has information on past values prior to recent values.
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 5 / 19
Exponential Smoothing
An obvious approach is to make a prediction, then modify it when you get the extra data point. That is;
yˆ =αy +(1−α)yˆ t+1t t
0≤α≤1
This is the approach used for basic forecasting using the method of exponential smoothing. It was developed in the 1950’s and is still extensively used.
For example an April 2020 paper“Orbit: Probabilistic Forecast with Exponential Smoothing” by 5 researchers at Uber.
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 6 / 19
Exponential Smoothing
We use yˆ as part of our method to forecast yˆ , but where does yˆ come t t+1 t
from?
yˆ =αy +(1−α)yˆ
t+1t t
=αy +(1−α)(αy +(1−α)yˆ ) t t−1 t−1
+(1−α)2yˆ
=αyt +α(1−α)yt−1 +α(1−α)2xt−2 +…+α(1−α)tx0
=αy +α(1−α)y
t t−1 t−1
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 7 / 19
Choice of α
The larger your value of α, the more weight you put on most recent measured value. Conversely the smaller the α, the more you rely on the estimate, that is, past behaviour of the series.
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 8 / 19
Value of α – A statistical Approach
For forecasting – as for any statistical modelling – you are trying to minimise your prediction error e = x − xˆ . You don’t know this in
ttt
advance, but you can evaluate how well you would have done in the past. That is, how close are your model estimates to your measured estimates.
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 9 / 19
Minimising Model Error
So from beginning to end of measurements we sum up the error for each time point
T
Q = e t2
t=2
T Tt−1 2
=y −yˆ
t t|t−1
t=2
2
t
= y −α(1−α)j−1y
t=2 j=1
t−j
Fidelio Statistical Services
Time Series
Exponential Smoothing
Semester 2, 2021
10 / 19
Types of Time Series – Other examples
Assume an infinite series with
Corr(yt,yt−k) = ρk
Then
0 − 1 ≤ ρ ≤ 31 α = 1 − 1−ρ 1 ≤ ρ ≤ 1
2ρ 3
Clearly you can use your software’s default, which may not be wise, though at the very least you should know what it is. 0.2 < α < 0.3 usually works well. Also, while it would not be expected that the optimal α varies from one time period to the next, you should check it every so often. In fact, checking your model after the addition of some extra measurements is generally a good idea.
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 11 / 19
Series With a Trend
Let’s assume a simple series with trend yt = a + bt + et . t−1
= α (1 − α)j y
t −j
j=0
t−1
=α(1−α)j [a+b(t−j)]
j=0
t−1
= α (1 − α)j α + b(1 − α)j t − j(1 − α)j t
j=0
= a + bt − αb
From the equation used to create the data we should predict a + bt as that’s what the formula says it should be, but we have another term which will be the modelling error – the estimate is biased.
xˆ
t +1|t
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 12 / 19
Exponential Smoothing With Changing Levels
Once we go beyond simple exponential smoothing – estimating the level of the series – it is better to look at the series in terms of components. If there series seems flat we can say the “level” of the series is constant.
So we have a forecast equation xˆ = L
t+1|t t
and a smoothing equation Lt = αxt + (1 − α)Lt−1
The value we are measuring is the current level of the series which if there is a trend will be changing over time. So for the rest of this section I will be estimating Lt+1 and the change in the level – the trend Tt – from the data to time t.
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 13 / 19
Exponential Smoothing With Trend Term
Forecast Equation Level Equation
xˆ =L+T t+1|t t t
Lt =αxt +(1−α)(Lt−1 +Tt−1) 0≤α≤1
Trend Equation
Tt =β[Lt −Lt−1]+(1−β)Tt−1
0≤β≤1
The Lt measures the level at time t and Ct is the first difference at time t.
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 14 / 19
Trends
I have assumed a linear trend, termed double exponential smoothing. A constant series – that is, no trend – is single exponential smoothing. Can have trends of trends -– triple exponential smoothing. The series with trend and level term is
xt =Lt +Tt +et
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 15 / 19
Series With a Seasonal Pattern
Termed Holt- . There is a R package HoltWinters but its better to use the forecast.HoltWinters() option in the forecast package. Given s measures in a year ( s = 4 for quarterly data, s = 12 for monthly) we assume
...≈St−2s ≈St−s ≈St ≈St+s =≈St+2s ≈... where the time series is assumed to be
xt =Mt +Tt +St +et
Just like when we added a trend we also have to have a way to update our
estimates with each new data point
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 16 / 19
Level, Trend and Seasonal Components
We now have three components to estimate, the level, trend and seasonal, which are combined to create the forecast value.
xˆ =L+T+S
t+1 t t t+1−s
Lt =α(xt −St−s)+(1−α)(Lt−1 +Tt−1) Tt =β(Lt −Lt−1)+(1−β)Tt−1
St =γ(xt −Lt −Tt)+(1−γ)St−s With α,β and γ all between 0 and 1.
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 17 / 19
Some Final Points
When estimating xˆ1 what was xˆ0? If series is long enough, say t > 30 then having xˆ0 = x0 is not a problem. For shorter series some average of the first 3-5 points a better idea.
Despite it being simple exponential smoothing is related to ARIMA models
Single exponential smoothing is ARIMA(0,1,1) Double exponential smoothing is ARIMA(0,2,2) Triple Exponential smoothing is ARIMA(0,3,3)
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 18 / 19
Why Exponential Smooth?
Using exponential smoothing may appear rather simple and more sophisticated techniques will forecast more accurately, but this is not necessarily the case. It was developed in the 1950’s so there must be reasons it’s still in the time series modeller’s toolbox.
It is very simple to implement. As I showed you can do it in a spreadsheet
You don’t need a long time series
It is simple to explain and usually is understandable by non-technical users
Tests of forecasting accuracy have shown overall it works well It is often the default forecasting approach in basic software.
It works incredibly fast which is useful is forecasting billions of time series every day
Fidelio Statistical Services Time Series Exponential Smoothing Semester 2, 2021 19 / 19