lecture 7: forecasting: putting it all together
DESCRIPTION
Lecture 7: Forecasting: Putting it ALL together. The full model. The model with seasonality, quadratic trend, and ARMA components can be written: Ummmm, say what???? The autoregressive components allow us to control for the fact that data is directly related to itself over time. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/1.jpg)
Lecture 7: Forecasting: Putting it
ALL together
![Page 2: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/2.jpg)
The full model
The model with seasonality, quadratic trend, and ARMA components can be written:
Ummmm, say what????The autoregressive components allow us to control
for the fact that data is directly related to itself over time.
The moving average components, which are often less important, can be used in instances where past errors are expected to be useful in forecasting.
2
€
y t = b1D1,t + ...+ bsDs,t +a1t +a2 t 2 + ut ,
ut = φ1ut−1 + φ2ut−2 + ...+ φput− p + ...+
et + θ1et−1 + ...+ θqet−q
![Page 3: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/3.jpg)
Model selection
Autocorrelation (AC) can be used to choose a model. The autocorrelations measure any correlation or persistence. For ARMA(p,q) models, autocorrelations begin behaving like an AR(p) process after lag q.
Partial autocorrelations (PAC) only analyze direct correlations. For ARMA(p,q) processes, PACs begin behaving like an MA(q) process after lag p.
For AR(p) process, the autocorrelation is never theoretically zero, but PAC cuts off after lag p.
For MA(q) process, the PAC is never theoretically zero, but AC cuts off after lag q.
3
![Page 4: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/4.jpg)
Model selection
An important statistic that can used in choosing a model is the Schwarz Bayesian Information Criteria. It rewards models that reduce the sum of squared errors, while penalizing models with too many regressors.SIC=log(SSE/T)+(k/T)log(T), where k is the number
of regressors.
The first part is our reward for reducing the sum of squared errors. The second part is our penalty for adding regressors. We prefer smaller numbers to larger number (-17 is smaller than -10).
4
![Page 5: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/5.jpg)
Important commands in EViews
ar(1): Includes a single autoregressive lag
ar(2): Includes a second autoregressive lagNote, if you include only ar(2), EViews will not
include a first order autoregressive lag
ma(1): Includes a first order moving average term. This is not the same as forecasting using an average of recent values
5
![Page 6: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/6.jpg)
Selecting an appropriate time series model, concluded
Determine if trend/seasonality is important If it is, include it in your model
Estimate the model with necessary trend/seasonal components. Look at the correlogram of the residuals: From the equation dialogue box:
View => Residual Tests => Correlogram Q-statistics If ACs decay slowly with abrupt cutoff in PAC, this is indicative
of AR components. If the PAC doesn’t cutoff, you may need to include MA components as well.
Re-estimate the full model with trend/seasonality included with necessary ARMA components. You will likely have several models to choose from.
6
![Page 7: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/7.jpg)
Selecting an appropriate model, cont.
After you estimate each model, record SIC/AIC values
Use the SIC/AIC values to select an appropriate model.
Finally, investigate the final set of residuals. There should be no correlation in your residuals.Evidenced by individual correlation coefficients
within 95% confidence intervals about zero.Ljung-Box Q-statistics should be small with
probability values typically in excess of 0.05.
7
![Page 8: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/8.jpg)
Exponential smoothing
Very useful when we have only a handful of observations
Exponential smoothing can be modified to account for trend and seasonality.
If you suspect your data does not contain trend/seasonality, simply use single exponential smoothing:
The forecast h periods into the future is constant and given by:
8
€
ˆ y t = α y t + (1−α )y t−1 + ....+ (1−α )t−1 y1[ ]
€
ˆ y T +h |T = ˆ y T
![Page 9: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/9.jpg)
Exponential smoothing with trend
Obtain the smoothed level series, Lt:
Lt=yt+(1-)(Lt-1+Tt-1)
The trend series, Tt is formed as:
Tt=Lt-Lt-1)+(1-)(Tt-1)
The forecasted series:
9
€
ˆ y T +h |T = LT + hTT
![Page 10: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/10.jpg)
Example:
Suppose the first three observations of a series are 500, 350, and 250. Suppose =0.30, =0.10. Suppose the trend and level are initialized such that T1=0, L1=500.
L2=0.30 (350) +(1-0.30)(500-0) = 455
T2=0.10(455-500) + 0.90 (0) = -4.5.
The forecasted value for the third period then becomes:
10
€
ˆ y T +1|T = LT +1TT
= 455 − 4.5 = 450.5
![Page 11: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/11.jpg)
Exponential smoothing: Trend and seasonality
Eviews also allows for exponential smoothing with trend and seasonality.With seasonality we use a smoothed series along
with estimates based on trends and seasonality.Which option should I select?
If you believe your series lacks either seasonality or trend, single smoothing works perfectly.
From visual inspection of your series, if only trend appears to be present, you will need either “double smoothing” or “Holt-Winters” with “no seasonal.”
If seasonality and trend are expected, you will need to use “Holt-Winters” with the allowance of multiplicative or additive seasonality.
11
![Page 12: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/12.jpg)
HUH?
Eviews provides five options when you ask it, no tell it, to provide exponential smoothing:Single: (no seasonality/no trend)Double: (trend – value of =).Holt-Winters – No seasonal (Trend, and are not
equal, but are estimated in the data).Holt-Winters – Additive (Trend and Seasonality. The
seasonal component is estimated with an additive filter).
Holt-Winters - Multiplicative
12
![Page 13: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/13.jpg)
Breaks?
Uh oh? My data appears to have a break.
The developed time series methods assume the black box generating the data is constant.Not necessarily true:Learning curves may cause cost curves to
decreaseAcquisition of companies or new
technologies may alter sales/costs
13
![Page 14: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/14.jpg)
Dealing with breaks?
Solutions:Limit the sample to the post break periodSometimes taking logs and/or differencing can help
mitigate the effects of breaks/outliers. Include variables that help identify the breaks Model the breaks directly:
The most obvious way is to include a break in mean and/or a break in trend.
We should make sure that the included break is modeled in a sensible way A negative linear trend, for example, will imply the
data may eventually turn negative.
14
![Page 15: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/15.jpg)
Break in mean
15
0 20 40 60 80 100 120 140 160 180 2000
10
20
30
40
50
60
70
80
90
100
time
y
![Page 16: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/16.jpg)
Break in trend
16
0 20 40 60 80 100 120 140 160 180 2000
10
20
30
40
50
60
70
80
90
![Page 17: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/17.jpg)
Statistics useful in comparing the out of sample forecasting accuracy
Mean squared error: For an h-step extrapolation forecast:
Root mean squared error is the square root of this number.
Mean absolute error
17
€
( ˆ Y T +1|T −YT +1)2 + ( ˆ Y T +2|T −YT +2)2 + ...+ ( ˆ Y T +h |T −YT +h )2
h
€
| ˆ Y T +1|T −YT +1 | + | ˆ Y T +2|T −YT +2 | +...+ | ˆ Y T +h |T −YT +h |
h
![Page 18: Lecture 7: Forecasting: Putting it ALL together](https://reader035.vdocuments.net/reader035/viewer/2022062409/56814dbe550346895dbb152e/html5/thumbnails/18.jpg)
In Eviews:
If you have a forecasted series, say xf, and an original series x, you can calculate the mean squared error as:
genr mse=@sum((x-xf)^2)/h
To calculate the moving average forecasts: Suppose you use the most recent four periods Limit your data set to include only the last four
observations A variable called “maf_4” is calculated by: genr maf_4=@mean(x)
18