L5 Cycle Forecasting Sep19
L5 Cycle Forecasting Sep19
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
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
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
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
11
MA(q): Summary
12
AR forecasting
13
Optimal Forecast for AR(1) without an Intercept
Yt = φYt−1 + t
14
AR(1) with an Intercept
Yt = α + φYt−1 + t
• Unconditional mean:
15
AR(1) 1-Step-Ahead Forecast Error
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
• The growth rate series looks like pure cycle – no trend, and
seasonal was extracted previously. Level is clearly trending.
18
Example: Estimation AR(1)
------------------------------------------------------------------------------
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
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
------------------------------------------------------------------------------
------------------------------------------
| time lb yhat ub |
|------------------------------------------|
| 2024q3 .0379493 3.039475 6.041001 |
------------------------------------------
------------------------------------------
| time lb_na yhat ub_na |
|------------------------------------------|
| 2024q3 .0428143 3.039475 6.036137 |
------------------------------------------
24
What About 2-Step-Ahead?
• Using back substitution:
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
Yt = α + φYt−1 + t
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
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 :
30
Direct Method
• We have shown by back substitution:
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
------------------------------------------------------------------------------
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
------------------------------------------------------------------------------
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
• Compute forecast:
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:
36
Estimating 2-Step-Ahead Forecast Errors
37
Estimating 2-Step Forecast Errors
38
Estimating 2-Step Forecast Errors
39
Estimating 2-Step Forecast Errors
40
Estimating 2-Step Forecast Errors
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 |
+---------------------------------------------------------------+
43
h-Step-Ahead Forecasting
where
44
Forecast Construction
• Plug-in method:
• Iterated method:
• Direct method:
ŶT +h|T = α̂∗ + φ̂∗ YT
45
Non-Graded Homework Assignment 1
4-Step-Ahead Forecasts
46
AR(2) with an Intercept
(1 − φ1 L − φ2 L2 )Yt = α + t
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:
ŶT +1|T = α + φ1 YT + φ2 YT −1
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
49
Iterated and Direct Methods
• Iterated method:
• Direct method:
(1 − φ1 L − φ2 L2 − · · · − φp Lp )Yt = α + εt
51
Application: Unemployment Rate
52
1-Step-Ahead Direct Regression
------------------------------------------------------------------------------
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
------------------------------------------------------------------------------
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
56
Direct Point Forecasts and 90% Intervals 2/2
57
Iterated or Direct Forecasts?
58
ARMA (p,q) Processes
59
ARMA (p,q): Box-Jenkins Methodology
60
Partial Autocorrelation Function
61
Box-Jenkins Identification Logic 1/2
62
Box-Jenkins Identification 2/2
63
Before you leave...
64
Appendix
65
Useful Stata Commands
tsappend, add(n)
forecast
66