0% found this document useful (0 votes)
13 views67 pages

L5 Cycle Forecasting Sep19

EC4304

Uploaded by

Jay Tan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views67 pages

L5 Cycle Forecasting Sep19

EC4304

Uploaded by

Jay Tan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Lecture 5

Estimation and Forecasting Cycles

Semester 1 AY 2024/2025

1
The Cycle Component
• Recall the component model:
Yt = Tt + St + Ct .
• In Lecture 4, we concluded that it makes sense to model Ct
as a covariance stationary process.
• Wold’s theorem states that any covariance stationary process
can be represented as a linear combination of innovations,
which follow a white noise process.
• Our modeling of cycles, therefore, involves building
approximations to the Wold representation using ARMA(p,q)
models.
• In this lecture, we will first study the estimation and
forecasting of MA and AR processes separately, and then
discuss how to identify which model is most appropriate.
2
ARMA: Estimation and Forecasting

• We know the structure and properties of AR(p), MA(q) and


ARMA(p,q) processes.
• How do we fit them to data to obtain parameter values?
• How do we construct optimal forecasts?
• We will not dwell much on the former point, but rather focus
on the latter.

3
Roadmap

• MA(q)
• AR(p)
I AR(1) without or with an intercept
• 1-step forecast ŶT +1 and forecast error T +1
• 2-step forecast ŶT +2 : Plug-in, iterated, and direct methods
• 2-step forecast error T +1 + φT : Plug-in, iterated, and direct
methods
• h-step forecast
I AR(2) with an intercept
I AR(p) with an intercept

• ARMA(p,q): How to determine p and q?


I Box-Jenkins methodology

4
MA forecasting

5
Optimal Forecast for MA(1)
• Recall the MA(1) model:
Yt = t + θt−1
• Given ΩT , the 1-step ahead optimal forecast is the conditional
mean (under squared loss):
ŶT +1|T = ET (YT +1 ) = ET (T +1 + θT ) = θT
• What about 2-step ahead (and beyond)?
ŶT +2|T = ET (YT +2 ) = ET (T +2 + θT +1 ) = 0.
• That is, the 2-step (and beyond) optimal forecast based on
the MA(1) is 0, the unconditional mean.
• This observation can be generalized to an MA(q) model: For
h-step-ahead (h > q), the optimal forecast is just the
unconditional mean, which is zero.
6
MA(1): Recursive Forecast
• Note that we do not directly observe t , yet our forecast
formulas are functions of them.
• In practice, we can construct t recursively by assuming
0 = 0:

1 = Y1 − θ0 = Y1
2 = Y2 − θ1
..
.
T = YT − θT −1

• To make this operational, replace θ by its MLE estimate θ̂ to


obtain estimates {ˆ t=1 .
t }T
• Construct the optimal 1-step-ahead forecast: ŶT +1|T = θ̂ˆ
T

7
Forecast Errors for MA(1)
• The 1-step-ahead forecast error is given by:
eT +1|T = YT +1 − ŶT +1|T = T +1 + θT − θT = T +1
• The 2-step ahead forecast error is:
eT +2|T = YT +2 − ŶT +2|T = T +2 + θT +1 − 0
= T +2 + θT +1

I That is, the 2-step ahead forecast error is MA(1).


• Forecast error variances are:
Var(eT +1|T ) = Var(T +1 ) = σ 2
Var(eT +2|T ) = Var(T +2 + θεT +1 ) = σ 2 (1 + θ2 )
• Thus,
Var(eT +h|T ) ≤ Var(Yt ) for h ≤ q
Var(eT +h|T ) = Var(Yt ) for h > q. 8
Generalization for MA(q): Forecasts
• Recall the MA(q) model:
Yt = t + θ1 t−1 + θ2 t−2 + · · · + θq t−q
• The optimal forecasts are:
ŶT +1|T = ET (YT +1 ) = ET (T +1 + θ1 T + · · · + θq T −q+1 )
= θ1 T + · · · + θq T −q+1 (MA(q − 1))
..
.
ŶT +q|T = ET (YT +q )
= ET (T +q + θ1 T +q−1 + θ2 T +q−2 + · · · + θq T )
= θq  T
ŶT +h|T = ET (YT +h )
= ET (T +h + θ1 T +h−1 + θ2 T +h−2 + · · · + θq T +h−q )
= 0 for h > q

• The h-step-ahead forecast is MA(q − h) for h ≤ q and 0


thereafter. 9
Generalization for MA(q): Forecast Errors
• The forecast errors are given by:

eT +1|T = YT +1 − ŶT +1|T = T +1


eT +2|T = YT +2 − ŶT +2|T = T +2 + θ1 T
..
.
eT +q|T = YT +q − ŶT +q|T
= T +q + θ1 T +q−1 + θ2 T +q−2 + · · · + θq−1 T
eT +h|T = YT +h − ŶT +h|T
= T +h + θ1 T +h−1 + θ2 T +h−2 + . . .
+ θq T +h−q for h > q

• Forecast errors are MA(h − 1) for h ≤ q and MA(q)


thereafter. MA(q) forecastable up to q periods out of sample.
10
Forecast Error Variances for MA(q)
Forecast error variances are:
Var(eT +1|T ) = Var(T +1 ) = σ 2
Var(eT +2|T ) = Var(T +2 + θ1 T ) = σ 2 (1 + θ12 )
..
.
Var(eT +q|T ) = Var(T +q + θ1 T +q−1 + θ2 T +q−2 + · · · + θq−1 T )
= σ 2 (1 + θ12 + θ22 + · · · + θq−1
2
)
Var(eT +h|T ) = Var(T +h + θ1 T +h−1 + θ2 T +h−2 + . . .
+ θq T +h−q )
= σ 2 (1 + θ12 + θ22 + · · · + θq2 ) for h > q

• Forecast error variances are increasing in h until it hits the


unconditional variance.

11
MA(q): Summary

• The MA(q) process is not forecastable more than q steps


ahead. Forecast reverts to unconditional mean after that.
• Forecast errors:
I The 1-step-ahead optimal forecast errors are white noise.
I The h-step-ahead optimal forecast errors are MA(h − 1)
∀h ∈ [1, q] and MA(q) thereafter.
I Forecast error variance increases with h until it hits Var(Yt )
when h > q.
• Since dynamics “wash out” quickly, pure MA(q) models are
not used often in forecasting typically persistent economic
data.

12
AR forecasting

• AR(1) without or with an intercept


I 1-step forecast ŶT +1 and forecast error T +1
I 2-step forecast ŶT +2 : Plug-in, iterated, and direct methods
I 2-step forecast error T +1 + φT : Plug-in, iterated, and direct
methods
I h-step forecast

• AR(2) with an intercept


• AR(p) with an intercept

13
Optimal Forecast for AR(1) without an Intercept

• Recall the AR(1) model without an intercept:

Yt = φYt−1 + t

• Given ΩT , the optimal 1-step-ahead forecast is the conditional


mean:

ŶT +1|T = ET (YT +1 ) = ET (φYT + T +1 ) = φYT

• The optimal 1-step-ahead forecast is a linear function of the


last observed value. It can be obtained using OLS (best linear
predictor).

14
AR(1) with an Intercept

• Consider an AR(1) with an intercept:

Yt = α + φYt−1 + t

• Unconditional mean:

E(Yt ) = E(α + φYt−1 + t ) = α + φE(Yt−1 )


α
E(Yt ) = (why?)
1−φ
• The optimal 1-step-ahead forecast is:

ŶT +1|T = ET (α + φYT + T +1 ) = α + φYT

15
AR(1) 1-Step-Ahead Forecast Error

• The 1-period-ahead forecast error is:

YT +1 − ŶT +1|T = α + φYT + T +1 − (α + φYT )


= T +1

• Variance of the forecast error:

Var(YT +1 − ŶT +1|T ) = Var(T +1 ) = σ 2

• This is the same as the MA(1) case.


I 1-step ahead errors are white noise.
I We will discuss multi-step-ahead errors later.

16
AR(1) 1-Step-Ahead Forecast Intervals
• If we assume forecast errors are normally distributed, we can
use the Normal method, i.e., 100×α% interval is:
ŶT +1|T ± zα × σ̂
• Estimating variance of the forecast error (recall that the
forecast error is Var(T +1 )):
T
1 X
σ̂ 2 = ˆ2
T t=1 t
• Recall from Lecture 2 that there is another part of the
variance due to parameter estimation uncertainty. We then
can get the forecast standard deviation adjusted for it with
the following Stata command.

predict s, stdf

17
Example: GDP Growth Rate

Why Growth Rate and Not Level?

• The growth rate series looks like pure cycle – no trend, and
seasonal was extracted previously. Level is clearly trending.

18
Example: Estimation AR(1)

reg gdpgr L.gdpgr

Source | SS df MS Number of obs = 308


-------------+---------------------------------- F(1, 306) = 5.55
Model | 109.305069 1 109.305069 Prob > F = 0.0192
Residual | 6030.99698 306 19.7091404 R-squared = 0.0178
-------------+---------------------------------- Adj R-squared = 0.0146
Total | 6140.30204 307 20.0009839 Root MSE = 4.4395

------------------------------------------------------------------------------
gdpgr | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
gdpgr |
L1. | .1332381 .0565773 2.35 0.019 .0219083 .2445679
|
_cons | 2.651897 .3060457 8.67 0.000 2.049677 3.254118
------------------------------------------------------------------------------

19
Example: Actual vs. Fitted by AR(1)

20
Examine Residuals: ACF Plot

21
Examine Residuals: Q-test

LAG AC PAC Q Prob>Q | LAG AC PAC Q Prob>Q


------------------------------------------ | -------------------------------------------
1 -0.0151 -0.0151 .07085 0.7901 | 19 0.0277 0.0147 12.483 0.8640
2 0.1012 0.1011 3.2696 0.1950 | 20 0.0421 0.0358 13.069 0.8744
3 -0.0096 -0.0068 3.2985 0.3479 | 21 -0.0533 -0.1008 14.016 0.8689
4 -0.0484 -0.0596 4.035 0.4013 | 22 -0.0070 0.0068 14.032 0.9003
5 -0.0532 -0.0540 4.9269 0.4249 | 23 -0.0732 -0.0769 15.826 0.8626
6 -0.0486 -0.0397 5.6743 0.4606 | 24 -0.0047 0.0223 15.833 0.8940
7 -0.0256 -0.0171 5.8822 0.5536 | 25 0.0582 0.1348 16.974 0.8827
8 0.0137 0.0198 5.9418 0.6537 | 26 -0.0228 -0.0832 17.15 0.9045
9 0.0412 0.0425 6.4827 0.6908 | 27 0.0348 0.0203 17.561 0.9164
10 0.0410 0.0324 7.0217 0.7234 | 28 0.0553 0.0990 18.603 0.9099
11 0.0279 0.0159 7.2725 0.7766 | 29 0.0173 0.0168 18.705 0.9286
12 -0.0410 -0.0526 7.8148 0.7994 | 30 -0.0353 -0.0823 19.132 0.9372
13 -0.0569 -0.0649 8.8645 0.7831 | 31 -0.0216 -0.0363 19.293 0.9498
14 -0.0278 -0.0193 9.1163 0.8235 | 32 -0.0348 -0.0145 19.713 0.9561
15 -0.0452 -0.0291 9.7808 0.8333 | 33 0.0088 0.0553 19.74 0.9669
16 0.0522 0.0679 10.67 0.8294 | 34 0.0304 0.0340 20.062 0.9723
17 0.0187 0.0168 10.785 0.8675 | 35 0.0443 0.0500 20.749 0.9731
18 0.0663 0.0807 12.23 0.8352 | 36 -0.0019 -0.0433 20.751 0.9803

22
GDP Growth in 2024:Q3 Forecast
The estimates were

------------------------------------------------------------------------------
gdpgr | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
gdpgr |
L1. | .1332381 .0565773 2.35 0.019 .0219083 .2445679
|
_cons | 2.651897 .3060457 8.67 0.000 2.049677 3.254118
------------------------------------------------------------------------------

list time gdpgr if time >= tq(2023q3)


+-------------------+
| time gdpgr |
|-------------------|
| 2023q3 4.747199 |
| 2023q4 3.339664 |
| 2024q1 1.399642 |
| 2024q2 2.908913 |
+-------------------+

• Ŷ2024:Q3|2024:Q2 = 2.651897 + 0.1332381 × 2.908913 = 3.039475


23
GDP Growth in 2024:Q3 Forecast Interval

• 50% forecast interval using variance adjusted for estimation


uncertainty (i.e., predict with stdf)

------------------------------------------
| time lb yhat ub |
|------------------------------------------|
| 2024q3 .0379493 3.039475 6.041001 |
------------------------------------------

• 50% forecast interval using regression RMSE estimates (i.e.,


z0.25 × RMSE)

------------------------------------------
| time lb_na yhat ub_na |
|------------------------------------------|
| 2024q3 .0428143 3.039475 6.036137 |
------------------------------------------

24
What About 2-Step-Ahead?
• Using back substitution:

Yt = φYt−1 + t = t + φ(φYt−2 + t−1 )


= φ2 Yt−2 + t + φt−1

• Given ΩT , the 2-period-ahead optimal forecast is the


conditional mean:

ŶT +2|T = ET (YT +2 ) = ET (φ2 YT + T +2 + φT +1 )


= φ2 Y T

• The optimal 2-step-ahead forecast is also a linear function of


the last observed value.
• Note also:

ŶT +2|T = φ2 YT = φ × φYT = φŶT +1|T

25
h-Step-Ahead and the Chain Rule
• Similarly using back substitution:
Yt = φh Yt−h + t + φt−1 + ... + φh−1 t−h+1
• Given ΩT , the optimal forecast is:
ŶT +h|T = ET (YT +h )
= ET (φh YT + T +h + φT +h−1 + ...)
= φh YT
• This gives rise to the chain rule of forecasting:
ŶT +1|T = φYT
ŶT +2|T = φ2 YT = φŶT +1|T
..
.
ŶT +h|T = φh YT = φŶT +h−1|T
26
2-Step-Ahead of AR(1) with an Intercept 1/2

• Recall that AR(1) with an intercept is of interest:

Yt = α + φYt−1 + t

and the optimal 1-step-ahead forecast is:

ŶT +1|T = ET (α + φYT + T +1 ) = α + φYT

• What if we want 2-period ahead forecast? Not as simple as


AR(1) without an intercept.
• From what we know already, we can take different routes,
some of which will be more tedious than the others.

27
2-Step-Ahead Optimal Forecast of AR(1) with an
Intercept

27
2-Step-Ahead Forecasting of AR(1) with an
Intercept 2/2

We can utilize three methods to achieve our goal:

1. Plug-in method: Calculate optimal forecast as a function of


model parameters (back substitution). Replace unknown
parameters with the estimates.
2. Iterated method: Compute 1-step forecast, then iterate
using the chain rule to get 2-step forecast.
3. Direct method: Estimate a 2-step regression function and
use it for forecasting.

28
Plug-In Method
• Using back substitution:
Yt = α + φYt−1 + t = α + φ(α + φYt−2 + t−1 ) + t
= (1 + φ)α + φ2 Yt−2 + t + φt−1
• Given ΩT , the 2-period-ahead optimal forecast is:
ŶT +2|T = ET (YT +2 )
= ET [(1 + φ)α + φ2 YT + T +2 + φT +1 ]
= (1 + φ)α + φ2 YT
• Plug-in the estimates to obtain a feasible forecast:
ŶT +2|T = (1 + φ̂)α̂ + φ̂2 YT
• Simple but will become cumbersome for multi-step forecasts
and larger models.
29
Iterated Method
• Since YT +2 = α + φYT +1 + T +2 , we take conditional
expectation w.r.t. ΩT :

ET (YT +2 ) = ET (α + φYT +1 + T +2 ) = α + φET (YT +1 )

• The LHS is the optimal 2-step-ahead forecast, the RHS is a


function of the 1-step-ahead optimal forecast.
• We know how to build a 1-step-ahead forecast, so it’s easy to
build:

ŶT +1|T = α̂ + φ̂YT


ŶT +2|T = α̂ + φ̂ŶT +1|T
• Convenient in linear models (our main focus).
I Doesn’t work in nonlinear models.
I Less useful in regression-based forecasting (coming up later).

30
Direct Method
• We have shown by back substitution:

Yt = (1 + φ)α + φ2 Yt−2 + t + φt−1


= α∗ + φ∗ Yt−2 + ut

where

α∗ = (1 + φ)α; φ∗ = φ2 ; ut = t + φt−1
• This is a regression with a 2-step forecast error as an error
term.
I Note that this can be estimated directly by OLS.
• This is NOT the same as the iterated estimator!!!
I Minimizes the 2-step ahead forecast error explicitly.
• The error term is NOT white noise but is still uncorrelated
with the regressor.
31
Real GDP Growth Rate: AR(1) Regression

Recall the AR(1) estimates.

reg gdpgr L.gdpgr

Source | SS df MS Number of obs = 308


-------------+---------------------------------- F(1, 306) = 5.55
Model | 109.305069 1 109.305069 Prob > F = 0.0192
Residual | 6030.99698 306 19.7091404 R-squared = 0.0178
-------------+---------------------------------- Adj R-squared = 0.0146
Total | 6140.30204 307 20.0009839 Root MSE = 4.4395

------------------------------------------------------------------------------
gdpgr | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
gdpgr |
L1. | .1332381 .0565773 2.35 0.019 .0219083 .2445679
|
_cons | 2.651897 .3060457 8.67 0.000 2.049677 3.254118
------------------------------------------------------------------------------

32
Example: 2-Step-Ahead Forecast of Real GDP
Growth Rate
• Running an AR(1) yields:
α̂ = 2.651897; φ̂ = 0.1332381;
YT = 2.908913; ŶT +1|T = 3.039475
• Plug-in Method
ŶT +2|T = (1 + φ̂)α̂ + φ̂2 YT
= (1 + 0.1332381) × 2.651897
+ 0.13323812 × (2.908913)
= 3.056871
• Iterated Method
ŶT +2|T = α̂ + φ̂ŶT +1|T = 3.056871
• These are identical – based on the same estimates.
33
Example: 2-Step-Ahead Forecast of Real GDP
Growth Rate

Direct 2-Step Method

reg gdpgr L2.gdpgr

Source | SS df MS Number of obs = 307


-------------+---------------------------------- F(1, 305) = 3.90
Model | 77.2371951 1 77.2371951 Prob > F = 0.0493
Residual | 6047.9773 305 19.8294338 R-squared = 0.0126
-------------+---------------------------------- Adj R-squared = 0.0094
Total | 6125.21449 306 20.0170408 Root MSE = 4.453

------------------------------------------------------------------------------
gdpgr | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
gdpgr |
L2. | .1120256 .0567622 1.97 0.049 .0003305 .2237207
|
_cons | 2.728514 .3075121 8.87 0.000 2.1234 3.333628
------------------------------------------------------------------------------

34
Example: 2-Step-Ahead Forecast of Real GDP
Growth Rate

• Running the direct 2-step regression yields:

α̂∗ = 2.728514; φ̂∗ = 0.1120256;


YT = 2.908913

• Compute forecast:

ŶT +2|T = α̂∗ + φ̂∗ YT


= 2.728514 + 0.1120256 × 2.908913 = 3.054387

• This value differs from the iterated forecast.


• This is because here we are using the estimates that minimize
the 2-step-ahead squared loss explicitly.

35
2-Step-Ahead Forecast Errors
• Recall:
Yt = α∗ + φ∗ Yt−2 + ut ,
where ut = t + φt−1 .
• The standard error of regression is that of ut , not t .
• The variance of the error term is thus:

Var(ut ) = Var(t + φt−1 ) = (1 + φ2 )σ 2

• This is different from the 1-step error, and we need to


estimate it to construct forecast intervals.
• How to estimate it?
I Plug-in
I Direct estimation
I Iterated estimation

36
Estimating 2-Step-Ahead Forecast Errors

Plug-In Variance Estimation

• Same logic as before, use estimates to replace unknowns:


q
σ̂u = (1 + φ̂2 )σ̂ 2

• This formula is hard to generalize beyond AR(1) models.


• Note that you actually have to run the AR(1) regression to
get the estimates.
• In our GDP example (see Slide 32), φ̂ = 0.1332381,
σ̂ = 4.4385, so we get:
q
σ̂u = (1 + 0.13323812 ) × 4.43852 = 4.724946.

37
Estimating 2-Step Forecast Errors

Direct Variance Estimation

• Just use the regression RMSE:


v
T
u1 X
u
σ̂u = t ût2
T t=1

• Similarly, we can use Stata command stdf to adjust for


parameter uncertainty (but assuming homoskedasticity).
• In our GDP example (see Slide 34), we have:

σ̂u = 4.453 vs. σ̂u,stdf = 4.460

38
Estimating 2-Step Forecast Errors

Iterated Forecast Variance Estimation Idea The idea behind


the simulation approach is to generate many possible realizations
of YT +1 and YT +2 , find the associated forecast errors, and
compute the variance across simulations. How?

39
Estimating 2-Step Forecast Errors

Iterated Forecast Variance Estimation Using Stata

• They are not easy to calculate directly, as the corresponding


forecast error is not a direct output.
• Instead, it is typical to use simulation to calculate forecast
variance in this case.
• This is more flexible than the formulas, and can be done in
Stata version 13 and up using the forecast command:

forecast solve, simulate(errors, statistic(stddev, prefix(sd ))


reps(1000))

40
Estimating 2-Step Forecast Errors

Iterated Forecast Variance Using Stata

• Option ‘errors’ treats t as draws from N(0, regression MSE).


• Option ‘residuals’ draws t from the saved residuals (could be
a more realistic representation).
• Option ‘betas’ adds accounting for estimation uncertainty:
every time we simulate, we draw the OLS parameters from
their asymptotic distributions.

41
2-Step-Ahead Forecast of AR(1): Real GDP
Example 1/2
• Here we show 1-step and 2-step ahead forecasts (via the
iterated method) and respective σ̂u computed using 10,000
simulations with ‘errors’, ‘errors betas’, ‘residuals’, and
‘residuals betas’:

+---------------------------------------------------------------+
| time f_gdpgr sd_gdpgr sd2_gd˜r sd3_gd˜r sd4_gd˜r |
|---------------------------------------------------------------|
| 2024q3 3.039475 4.486872 4.466901 4.506106 4.408622 |
| 2024q4 3.056871 4.4474 4.466401 4.312433 4.466259 |
+---------------------------------------------------------------+

• The forecast interval can then be constructed using the


Normal rule and the appropriate RMSFE estimate:
ŶT +2|T ± zα/2 σ̂u .
42
2-Step-Ahead Forecast of AR(1): Real GDP
Example 2/2

Method Point Forecast RMSFE


Iterated with errors + betas 3.057 4.466
Iterated with resid. + betas 3.057 4.466
Direct with unadj rmsfe 3.054 4.453
Direct with stdf. 3.054 4.460

43
h-Step-Ahead Forecasting

• Back substitution gives:

Yt = α + φYt−1 + t = α + φ(α + φYt−2 + t−1 ) + t


= (1 + φ)α + φ2 (α + φYt−3 + t−2 ) + t + φt−1
= (1 + φ + φ2 )α + φ3 Yt−3 + t + φt−1 + φ2 t−2
= (1 + φ + φ2 + · · · + φh−1 )α + φh Yt−h + ut ,

where

ut = t + φt−1 + φ2 t−2 + · · · + φh−1 t−h+1

• Given ΩT , the h-period-ahead optimal forecast is:

ŶT +h|T = ET (YT +h ) = (1 + φ + φ2 + · · · + φh−1 )α + φh YT

44
Forecast Construction

• Plug-in method:

ŶT +h|T = (1 + φ̂ + φ̂2 + · · · + φ̂h−1 )α̂ + φ̂h YT

• Iterated method:

ŶT +h|T = α̂ + φ̂ŶT +h−1|T

• Direct method:
ŶT +h|T = α̂∗ + φ̂∗ YT

where α∗ and φ∗ are coefficients in the regression of Yt on its


h-th lag.

45
Non-Graded Homework Assignment 1

4-Step-Ahead Forecasts

• Using GDPC1 from FRED to forecast the U.S. GDP growth


for the next 4 quarters, i.e., 2024q3 – 2025q2.
I Provide point forecasts using iterated and direct methods
I Provide the 50% forecast intervals.
• Direct method: Using RMSFE from Stata command stdf
• Iterated method: errors and betas

46
AR(2) with an Intercept

• The process is given by:

Yt = α + φ1 Yt−1 + φ2 Yt−2 + t ; t ∼ WN(0, σ 2 )

• Lag operator notation:

(1 − φ1 L − φ2 L2 )Yt = α + t

• Necessary condition for stationarity: φ1 + φ2 < 1


• Alternative equivalent expression (in lag and lagged change):

Yt = α + φ1 Yt−1 + φ2 Yt−2 + t
= α + (φ1 + φ2 )Yt−1 − φ2 (Yt−1 − Yt−2 ) + t
= α + (φ1 + φ2 )Yt−1 − φ2 ∆Yt−1 + t

47
AR(2) with an Intercept
• Estimation by OLS:

Yt = α̂ + φ̂1 Yt−1 + φ̂2 Yt−2 + ˆt

• 1-period-ahead optimal forecast:

ŶT +1|T = α + φ1 YT + φ2 YT −1

• 2-period-ahead optimal forecast obtains from:

Yt = α + φ1 Yt−1 + φ2 Yt−2 + t
= α + φ1 (α + φ1 Yt−2 + φ2 Yt−3 ) + φ2 Yt−2 + t
= (1 + φ1 )α + (φ21 + φ2 )Yt−2 + φ1 φ2 Yt−3 + t + φ1 t−1

• 2-period forecast is a linear function of 2 lags with an MA(1)


forecast error.
48
AR(2) with an Intercept

• 3-period-ahead optimal forecast obtains from:

Yt = (1 + φ1 )α + (φ21 + φ2 )Yt−2 + φ1 φ2 Yt−3 + t + φ1 t−1


= (1 + φ1 )α + (φ21 + φ2 )(α + φ1 Yt−3 + φ2 Yt−4 + t−2 ) + φ1 φ2 Yt−3
+ t + φ1 t−1
= (1 + φ1 + φ21 + φ2 )α + (φ31 + 2φ1 φ2 )Yt−3 + (φ21 φ2 + φ22 )Yt−4
+ t + φ1 t−1 + (φ21 + φ2 )t−2

• 3-period forecast is a linear function of third and fourth lags


with an MA(2) forecast error.
• Now we can see how plug-in method quickly becomes
burdensome here.

49
Iterated and Direct Methods
• Iterated method:

ŶT +1|T = α̂ + φ̂1 YT + φ̂2 YT −1


ŶT +2|T = α̂ + φ̂1 ŶT +1|T + φ̂2 YT
..
.
ŶT +h|T = α̂ + φ̂1 ŶT +h−1|T + φ̂2 ŶT +h−2|T

• Direct method:

Yt = α̂∗ + φ̂∗1 Yt−h + φ̂∗2 Yt−h−1 + ût


ŶT +h|T = α̂∗ + φ̂∗1 YT + φ̂∗2 YT −1

Run OLS on two lags, h periods in the past. Build forecast


using the final two observations.
50
AR(p) with an Intercept

• The process is given by:

Yt = α+φ1 Yt−1 +φ2 Yt−2 +· · ·+φp Yt−p +εt ; εt ∼ WN(0, σ 2 )

• Lag operator notation:

(1 − φ1 L − φ2 L2 − · · · − φp Lp )Yt = α + εt

• Necessary condition for stationarity: φ1 + φ2 + · · · + φp < 1


• Alternative equivalent expressions:

Yt = α + γ1 Yt−1 + γ2 ∆Yt−1 + · · · + γp ∆Yt−p+1 + εt

∆Yt = α + (γ1 − 1)Yt−1 + γ2 ∆Yt−1 + · · · + γp ∆Yt−p+1 + εt

51
Application: Unemployment Rate

• Monthly data. Consider forecasting 1 year ahead with an


AR(12) model.
• Not discussing model selection here, but intuitively AR(12)
may arise with monthly data because we may believe that lags
up to 1 year into the past have effect on the current
unemployment rate.
• Seasonally adjusted US civilian unemployment rate data,
January 1948 – August 2024.
• Try both direct (12 regression) and iterated forecasts.

52
1-Step-Ahead Direct Regression

reg unrate L(1/12).unrate

Source | SS df MS Number of obs = 908


-------------+---------------------------------- F(12, 895) = 1191.58
Model | 2485.21045 12 207.100871 Prob > F = 0.0000
Residual | 155.553708 895 .173803026 R-squared = 0.9411
-------------+---------------------------------- Adj R-squared = 0.9403
Total | 2640.76416 907 2.91153711 Root MSE = .4169

------------------------------------------------------------------------------
unrate | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
unrate |
L1. | 1.025782 .0334114 30.70 0.000 .9602079 1.091355
L2. | -.0905994 .0478613 -1.89 0.059 -.1845328 .0033339
L3. | .0822872 .047937 1.72 0.086 -.0117949 .1763692
L4. | -.094577 .0480147 -1.97 0.049 -.1888116 -.0003424
L5. | .0866091 .0481022 1.80 0.072 -.0077972 .1810155
L6. | -.0655311 .0481518 -1.36 0.174 -.1600348 .0289726
L7. | .0533822 .0481572 1.11 0.268 -.0411321 .1478964
L8. | -.0085926 .0480839 -0.18 0.858 -.1029629 .0857776
L9. | .0080373 .0479765 0.17 0.867 -.0861223 .1021969
L10. | -.0412281 .0478987 -0.86 0.390 -.1352349 .0527787
L11. | .0387615 .0478158 0.81 0.418 -.0550827 .1326056
L12. | -.0295803 .0333592 -0.89 0.375 -.0950517 .0358912
|
_cons | .2016399 .0524722 3.84 0.000 .098657 .3046227
------------------------------------------------------------------------------ 53
12-Step-Ahead Direct Regression

reg unrate L(12/23).unrate

Source | SS df MS Number of obs = 897


-------------+---------------------------------- F(12, 884) = 56.56
Model | 1141.5926 12 95.1327167 Prob > F = 0.0000
Residual | 1486.88978 884 1.68200201 R-squared = 0.4343
-------------+---------------------------------- Adj R-squared = 0.4266
Total | 2628.48238 896 2.93357408 Root MSE = 1.2969

------------------------------------------------------------------------------
unrate | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
unrate |
L12. | .7715287 .1039806 7.42 0.000 .567451 .9756063
L13. | -.0448489 .1489686 -0.30 0.763 -.3372223 .2475246
L14. | .0333864 .1492426 0.22 0.823 -.2595247 .3262975
L15. | -.0508025 .1494873 -0.34 0.734 -.3441938 .2425889
L16. | .0441463 .149792 0.29 0.768 -.249843 .3381357
L17. | -.0528527 .1499622 -0.35 0.725 -.3471762 .2414708
L18. | .0207284 .1499513 0.14 0.890 -.2735737 .3150305
L19. | -.0500704 .1497322 -0.33 0.738 -.3439424 .2438016
L20. | -.0180183 .1494246 -0.12 0.904 -.3112867 .2752501
L21. | -.0206035 .1491866 -0.14 0.890 -.3134048 .2721979
L22. | .0190501 .1489253 0.13 0.898 -.2732382 .3113385
L23. | -.0151079 .1038916 -0.15 0.884 -.2190109 .1887951
|
_cons | 2.059801 .1655065 12.45 0.000 1.734969 2.384632
------------------------------------------------------------------------------ 54
Direct Point Forecasts and 90% Intervals 1/2

+---------------------------------------------------+
| time unrate p pL pU |
|---------------------------------------------------|
| 2024m8 4.2 . . . |
|---------------------------------------------------|
| 2024m9 . 4.256652 3.569717 4.943587 |
| 2024m10 . 4.320787 3.336202 5.305372 |
| 2024m11 . 4.368957 3.183083 5.554832 |
| 2024m12 . 4.428874 3.066387 5.791362 |
| 2025m1 . 4.481324 2.983881 5.978766 |
|---------------------------------------------------|
| 2025m2 . 4.53235 2.912093 6.152606 |
| 2025m3 . 4.583299 2.860043 6.306555 |
| 2025m4 . 4.629097 2.811804 6.446389 |
| 2025m5 . 4.661696 2.754575 6.568818 |
| 2025m6 . 4.710241 2.717079 6.703403 |
|---------------------------------------------------|
| 2025m7 . 4.736525 2.672587 6.800462 |
| 2025m8 . 4.780036 2.642966 6.917106 |
+---------------------------------------------------+

55
Non-Graded Homework Assignment 2

Point Forecasts and 90% Forecast Intervals

• Using the same data UNRATE from FRED to forecast the


unemployment rate for the next 12 months
I Provide point forecasts using the iterated method.
I Provide the 90% forecast intervals via the iterated method
with errors and betas.

56
Direct Point Forecasts and 90% Intervals 2/2

57
Iterated or Direct Forecasts?

• Theoretical literature: use direct forecasts.


I Bias/variance tradeoff — iterated forecasts are more efficient,
but prone to bias.
I If the true process is, say, AR(4) and we are using AR(2), the
direct forecast MSE will be less or equal to that of the iterated
one. Direct forecasts are more robust to misspecification.
• Empirical literature: not so clear-cut.
I Marcellino et al. (2006) show that iterated forecasts may be
preferable in macro forecasting.
I Findings may vary based on the variable in question and
forecast horizon.

58
ARMA (p,q) Processes

• Everything we’ve done so far transfers readily to ARMA(p,q)


processes.
• Naturally, the forecasts will have an AR part and an MA part.
• The MA part will “wash out” in q periods, leaving only the
AR forecast component.
• It is a pain to write down, but the mechanics of building
forecasts are the same. Thankfully, Stata will do it for you.

59
ARMA (p,q): Box-Jenkins Methodology

• Which model is appropriate (identification)?


I Examine ACF/PACF.
I Use model selection criteria such as AIC/BIC (more on this
later).
• How do we fit them to data to obtain parameter values? –
MLE estimation assuming Gaussianity. For AR(p) models
can use OLS estimation (asymptotically equivalent to MLE).
• Diagnostic checking: examine whether residuals are white
noise (i.e., no serial correlation left).

60
Partial Autocorrelation Function

• The partial autocorrelation function p(k) is defined simply as


the regression coefficient on Yt−k in the population AR(k)
regression.
• Called “partial” because it focuses on the association between
Yt and Yt−k after controlling for lags 1 through (t − k + 1).
• Estimated by finite sample AR(k) regression. Conveniently
plotted in Stata using pac command (syntax same as ac),
also reported when running corrgram.

61
Box-Jenkins Identification Logic 1/2

• Remember that our goal is to find a reasonable approximation


for the process that generated the data, not necessarily
exactly the true model.
• Box and Jenkins proposed observing sample ACF and PACF
and thinking which MA or AR model fits theoretically.
• For MA(q), only the first q autocorrelations are nonzero, so
the ACF should cut off after lag q.
• For AR(p), the autocorrelations may decline gradually, but the
PACF should cut off after lag p (why?).

62
Box-Jenkins Identification 2/2

• If neither ACF/PACF shows clear cut-off, we may try an


ARMA model (starting with low order).
• Typically we’ll have a few candidate models based on this, so
we check AIC/BIC to select the “best”.
• It is also customary to examine residuals for:
1. any remaining serial correlation (white noise test – Ljung-Box
Q);
2. Normality (kernel density plot, Jarque-Bera test).
• (1) tells us whether cycle is modeled well. (2) tells us whether
using Normal rule for forecast intervals is appropriate.

63
Before you leave...

• Diebold, Francis X., “Elements of Forecasting,” 4th edition.


Chapter 9.
• Exercises will be posted after the recess week.

64
Appendix

65
Useful Stata Commands

• Add empty datapoints for n future periods, so that when


“predict” command is executed after estimation, those are
automatically filled with out-of-sample forecasts.

tsappend, add(n)

• A flexible suite of commands that helps build iterated AR


forecasts and compute RMSFE by simulation. See lecture
do-file and Stata manual for more details.

forecast

66

You might also like