You are on page 1of 18

# 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.
 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
= b
1
D
1,t
+ ...+ b
s
D
s,t
+a
1
t +a
2
t
2
+ u
t
,
u
t
= |
1
u
t÷1
+ |
2
u
t÷2
+ ...+ |
p
u
t÷p
+ ...+
e
t
+u
1
e
t÷1
+ ...+u
q
e
t÷q
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
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
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
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
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%
 Ljung-Box Q-statistics should be small with probability
values typically in excess of 0.05.
7
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
=o y
t
+(1÷o)y
t÷1
+....+(1÷o)
t÷1
y
1
| |

ˆ
y
T +h|T
=
ˆ
y
T
Exponential smoothing with trend
 Obtain the smoothed level series, L
t
:
 L
t
=oy
t
+(1-o)(L
t-1
+T
t-1
)
 The trend series, T
t
is formed as:
 T
t
=|(L
t
-L
t-1
)+(1-|)(T
t-1
)
 The forecasted series:

9

ˆ
y
T +h|T
= L
T
+ hT
T
Example:
 Suppose the first three observations of a series are 500,
350, and 250. Suppose o=0.30, |=0.10. Suppose the
trend and level are initialized such that T
1
=0, L
1
=500.
 L
2
=0.30 (350) +(1-0.30)(500-0) = 455
 T
2
=0.10(455-500) + 0.90 (0) = -4.5.
 The forecasted value for the third period then becomes:

10

ˆ
y
T +1|T
= L
T
+1T
T
= 455÷ 4.5 = 450.5
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
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 o=|).
 Holt-Winters – No seasonal (Trend, o 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
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 technologies
may alter sales/costs

13
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 a
sensible way
 A negative linear trend, for example, will imply the data
may eventually turn negative.
14
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
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
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
÷Y
T +1
)
2
+ (
ˆ
Y
T +2|T
÷Y
T +2
)
2
+ ...+ (
ˆ
Y
T +h|T
÷Y
T +h
)
2
h

|
ˆ
Y
T +1|T
÷Y
T +1
| + |
ˆ
Y
T +2|T
÷Y
T +2
| +...+ |
ˆ
Y
T +h|T
÷Y
T +h
|
h
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