Chapter 7
Chapter 7
Exponential smoothing
o o* o* ? o* o* Regression
o * o o*
* Model 1 * Model 2 ARIMA
Which model
performs better?
7.1 Introduction to forecasting 7.1 Introduction to forecasting
To choose a forecasting method, we can evaluate forecast Choose SSE if it is important to avoid (even a few) large
accuracy using the actual time series. errors.
• The two most commonly-used measures of Otherwise, use MAD.
n
forecast accuracy are: y −F t t • A useful procedure for model selection
– mean absolute deviation MAD = t =1 – Use some of the observations to develop several
n
competing forecasting models.
n
– sum of squares for forecast error SSE = (y t − Ft )2 – Run the models on the rest of the observations.
t =1 – Calculate the accuracy of each model.
– Select the model with the best accuracy measure.
Example: 3-Year Moving Average John is a building contractor with a record of a total of
24 single family homes constructed over a 6-year
Y1 + Y2 + Y3 period. Provide John with a 3-year moving average
First average: MA(3) = graph.
3
Year Units Moving Ave
Y + Y3 + Y4
Second average: MA (3) = 2
3 1994 2 NA
1995 5 NA
1996 2 3
1997 2 3
1998 7 3.67
1999 6 5
7.3 Time-series forecasting with exponential 7.3 Time-series forecasting with exponential
smoothing weight - example
Weighted Moving Average
Weights decline exponentially
Most recent observation weighted most
Used for Smoothing and Short-Term Forecasting
Weights are:
Subjectively chosen
Range from 0 to 1
- Close to 0 for smoothing out unwanted cyclical
and irregular components
- Close to 1 for forecasting
7.2 Time-series forecasting with moving 7.2 Time-series forecasting with moving
average average
Implementation with Python Implementation with Python
7.4 Time-series forecasting with regression 7.4 Time-series forecasting with regression
(linear trend model) (linear trend model)
Output
7.4 Time-series forecasting with regression 7.4 Time-series forecasting with regression
(linear trend model) (linear trend model)
Implementation with Python Implementation with Python
7.4 Time-series forecasting with regression 7.4 Time-series forecasting with regression
(linear trend model) (linear trend model)
Implementation with Python Implementation with Python
7.4 Time-series forecasting with regression 7.5 Time-series forecasting with ARIMA
(linear trend model)
Implementation with Python Problems
16
14
12
10
8
Y (t)
6
4
2
0
-2 0 10 20 30 40 50
t
16
14
12 Compare
10
8
Y (t)
6
4
2
0
-5 -2 0 5 10 15
Y (t-1)
7.5 Time-series forecasting with ARIMA 7.5 Time-series forecasting with ARIMA
7.5 Time-series forecasting with ARIMA 7.5 Time-series forecasting with ARIMA
7.5 Time-series forecasting with ARIMA 7.5 Time-series forecasting with ARIMA
How to choose values of p, d and q? there are various ways to
choose the values of parameters of the ARIMA model.
Test for stationarity using the augmented dickey fuller test.
If the time series is stationary try to fit the ARMA model,
and if the time series is non-stationary then seek the value
of d.
In words, we can explain this expression as, If the data is getting stationary then draw the
autocorrelation and partial autocorrelation graph of the
Prediction = constant + linear combination lags of Y + linear data.
combination of lagged forecast errors. Draw a partial autocorrelation graph(ACF) of the data. This
will help us in finding the value of p because the cut-off
point to the PACF is p.
Draw an autocorrelation graph(ACF) of the data. This will
help us in finding the value of q because the cut-off point to
the ACF is q.
7.5 Time-series forecasting with ARIMA 7.5 Time-series forecasting with ARIMA
7.5 Time-series forecasting with ARIMA 7.5 Time-series forecasting with ARIMA
Implementation of ARIMA
7.5 Time-series forecasting with ARIMA 7.5 Time-series forecasting with ARIMA
47