Lecture 7 Econ 5313
Transcript of Lecture 7 Econ 5313
-
8/13/2019 Lecture 7 Econ 5313
1/18
Lecture 7:
Forecasting: Putting it ALLtogether
-
8/13/2019 Lecture 7 Econ 5313
2/18
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,ta1ta2 t2ut,
ut 1ut1 2ut2 ... putp ...
et 1et1 ...qetq
-
8/13/2019 Lecture 7 Econ 5313
3/18
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 nevertheoretically 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
-
8/13/2019 Lecture 7 Econ 5313
4/18
-
8/13/2019 Lecture 7 Econ 5313
5/18
Important commands in EViews
ar(1): Includes a single autoregressive lag
ar(2): Includes a second autoregressive lag
Note, 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
-
8/13/2019 Lecture 7 Econ 5313
6/18
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 doesnt cutoff, you may need toinclude 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
-
8/13/2019 Lecture 7 Econ 5313
7/18
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. Thereshould 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
-
8/13/2019 Lecture 7 Econ 5313
8/18
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
yty
t (1)y
t1 .... (1)t1y1
yTh T yT
-
8/13/2019 Lecture 7 Econ 5313
9/18
Exponential smoothing with trend
Obtain the smoothed level series, Lt:
Lt=yt+(1-)(Lt-1+Tt-1)
The trend series, Ttis formed as:
Tt=b(Lt-Lt-1)+(1-b)(Tt-1)
The forecasted series:
9
yTh|TLT
hTT
-
8/13/2019 Lecture 7 Econ 5313
10/18
-
8/13/2019 Lecture 7 Econ 5313
11/18
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
-
8/13/2019 Lecture 7 Econ 5313
12/18
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 =b).
Holt-Winters No seasonal (Trend, and bare 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
-
8/13/2019 Lecture 7 Econ 5313
13/18
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
decrease
Acquisition of companies or new technologiesmay alter sales/costs
13
-
8/13/2019 Lecture 7 Econ 5313
14/18
Dealing with breaks?
Solutions:
Limit the sample to the post break period
Sometimes 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 asensible way
A negative linear trend, for example, will imply the data
may eventually turn negative.
14
-
8/13/2019 Lecture 7 Econ 5313
15/18
Break in mean
15
0 20 40 60 80 100 120 140 160 180 200
0
10
20
30
40
50
60
70
80
90
100
time
y
-
8/13/2019 Lecture 7 Econ 5313
16/18
Break in trend
16
0 20 40 60 80 100 120 140 160 180 200
0
10
20
30
40
50
60
70
80
90
-
8/13/2019 Lecture 7 Econ 5313
17/18
Statistics useful in comparing theout 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
( YT1|TYT1)
2 ( Y
T2|TYT2)2 .. . ( Y
Th|TYTh )2
h
| YT1|TYT1||
YT2|TYT2|.. .|
YTh|TYTh |
h
-
8/13/2019 Lecture 7 Econ 5313
18/18
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