5qqmn938 - Week 2
5qqmn938 - Week 2
5qqmn938 - Week 2
Univariate Models –
Autoregression Part 1
Intermediate Econometrics - 5QQMN938
Dr Jack Fosten
This Week
Covered this week
• Introducing the AR(1) model
• Properties of AR(1): conditions for stationarity, mean, variance and autocorrelation
• Estimating the AR(1) model using OLS
• Forecasting: intro to point and interval forecasts
• Real-world case study: we will make a forecast of CPI inflation
Tutorial
• Running the AR(1) model on real world data and making our first forecast
Reading
• S&W: 14.3, 14.4 and Appendix (also Enders: 2.3, 2.7)
Looking Ahead
• We will look at extending the AR(1) model to the AR(p) model
AR(1) Model
Assume that 𝑌0 = 0 and let 𝛽0 = 1 and 𝛽1 = 0.5, so that:
A natural way to forecast 𝑌𝑡 is based on its past
value 𝑌𝑡−1 𝑌𝑡 = 1 + 0.5𝑌𝑡−1 + 𝑢𝑡
𝑌𝑡 = 𝛽0 + 𝛽1 𝑌𝑡−1 + 𝑢𝑡
Exercise: simplify (3) and repeat by substituting in for 𝒀𝒕−𝟐 . Do you notice a pattern?
𝑡−1
𝑌𝑡 = 𝛼𝑗 𝑢𝑡−𝑗 + 𝑑𝑡
𝑗=0
• So ANY weakly stationary process can be written as a function of white noise errors
• Notice how the general solution to the AR(1) model with no constant is a special case
of this decomposition where 𝛼0 , 𝛼1 , 𝛼2 … = 1, 𝛽1 , 𝛽12 … and 𝑑𝑡 = 0
∞
Remember
𝐸(𝑌𝑡 ) = 𝐸 𝛽1𝑖 𝑢𝑡−𝑖 formula for 𝑌𝑡
𝑖=0
= 𝐸 𝑢𝑡 + 𝛽1 𝐸 𝑢𝑡−1 + 𝛽12 𝐸 𝑢𝑡−2 + ⋯
=0
AR(1) Model 1 + 𝑎 + 𝑎2 + 𝑎3 + ⋯
2 1 1 1 1 1
∞ For example, if 𝑎 = 2, then 1 + 2+ 4 + 8 + ⋯ = 1 =2
1−
2
=𝐸 𝛽1𝑖 𝑢𝑡−𝑖 − 𝐸 𝑌𝑡 Remember
formula for 𝑌𝑡 Try it for yourself!
𝑖=0
∞ 2
AR(1) Model 1 + 𝑎 + 𝑎2 + 𝑎3 + ⋯
𝑌𝑡 = 𝛽0 + 𝛽1 𝑌𝑡−1 + 𝑢𝑡
𝑐𝑜𝑣(𝑌𝑡 , 𝑌𝑡−𝑗 )
𝜌𝑗 = 𝑐𝑜𝑟𝑟 𝑌𝑡 , 𝑌𝑡−𝑗 =
𝑣𝑎𝑟 𝑌𝑡 𝑣𝑎𝑟(𝑌𝑡−𝑗 )
• And now we know 𝑐𝑜𝑣(𝑌𝑡 , 𝑌𝑡−𝑗 ) and 𝑣𝑎𝑟 𝑌𝑡 for
the AR(1) model, so we get:
𝑗
𝛽1 𝜎 2 1 − 𝛽12
𝜌𝑗 = ×
1 − 𝛽12 𝜎2
𝑗
= 𝛽1
• So the ACF of the AR(1) model with 𝛽1 < 1
shows a geometric decline
𝑌𝑡 = 1 + 0.5𝑌𝑡−1 + 𝑢𝑡
------------------------------------------------------------------------------
y | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
y |
L1. | .485165 .0617759 7.85 0.000 .3633381 .6069919
|
_cons | .8890972 .1262882 7.04 0.000 .6400468 1.138148
------------------------------------------------------------------------------
Note the degrees of freedom in the F-test is 𝑻 − 𝟏 − 𝒌 and 𝒌 here is 2, so we have 𝑻 − 𝟑 degrees of
freedom, i.e. 𝟐𝟎𝟎 − 𝟑 = 𝟏𝟗𝟕
• We will use the AR(1) model to get a simple 1-period ahead forecast
• We should also think about the uncertainty of the forecast, i.e. a confidence interval
The BoE are credited with being the first to use this
graphical display of forecast uncertainty
Different types of forecast It’s a way of conveying the BoE’s own feelings
• A point forecast is a forecast of the mean of a about future uncertainty of GDP, inflation etc.
variable (a single number) We will create one of these using models later in
• An interval forecast conveys uncertainty around the course when we look at multi-step forecasting
(at the moment we will only look at one-step ahead
the forecast. forecasting)
– E.g. a 90% forecast interval “contains the future
value in 90% of repeated applications”
• Important we do not only report point forecasts
– In the diagram opposite, each of the shaded
bands is an interval
• A fan chart displays the uncertainty at different
levels of confidence
– The collection of shaded red parts forms the fan
chart, or “the river of blood”
𝑌𝑇+1|𝑇 is the same but with estimated coefficients This is very simple to calculate using 𝛽መ0 , 𝛽መ1 and
used in place of unknown population coefficients 𝑌𝑇 , which are all known
𝐸 𝑌𝑇+1 − 𝑌𝑇+1|𝑇
2
Mean squared forecast error
2
𝐸 𝑌𝑇+1 − 𝑌𝑇+1|𝑇
• This is just the square root of the MSFE
= 𝜎 2 + 𝑣𝑎𝑟( 𝛽0 − 𝛽0 + 𝛽1 − 𝛽1 𝑌𝑇 )
• The uncertainty has two parts:
– Uncertainty about the future error term
– Uncertainty about estimation of 𝛽0 , 𝛽1
tsappend, add(1)
we will call se(𝑌𝑇+1 − 𝑌𝑇+1|𝑇 ) 3) Save the RMSFE using stdf, and save the 90% intervals
Point forecast
. regress y L.y
𝑌201|200 =0.889+0.485∗(0.361)=1.064
Source | SS df MS Number of obs = 199
-------------+---------------------------------- F(1, 197) = 61.68
Model | 57.4302648 1 57.4302648 Prob > F = 0.0000
U.S. inflation
has been a
hot topic in
the news
since 2022
Compare the
numbers to
this graph and
explain
------------------------------------------------------------------------------
dCPI | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
dCPI |
L1. | .4738204 .0408877 11.59 0.000 .393472 .5541688
|
_cons | .1203869 .0144974 8.30 0.000 .091898 .1488758
------------------------------------------------------------------------------
------------------------------------------------------------------------------
| Robust
dCPI | Coefficient std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
dCPI |
L1. | .4738204 .0760617 6.23 0.000 .3243516 .6232893
|
_cons | .1203869 .0211387 5.70 0.000 .0788473 .1619265
------------------------------------------------------------------------------
Point forecast
𝑌2022𝑀12|2022𝑀11 = Fill in the gap!
Point forecast
𝑌2022𝑀12|2022𝑀11 =0.120 + 0.474 ∗ 0.096% = 0.166%
• Since the data were downloaded in December 2022, we actually now have the data
release for December 2022, it arrived on 12th Jan 2023!
• You will often find there is a publication delay in many economic series
• Let’s compare our prediction with what happened
• The Bureau of Labour Statistics (BLS) released CPI inflation as -0.1%
• (You can also find data releases on Trading Economics)
• Our prediction was pretty close to the released figure in the grand scheme of things!
• The 90% confidence interval included -0.1%
• Do you think our forecast is missing something? How could we improve the forecast?
Next Time
• We will generalise this to the AR(p) model
• We will learn how to choose between competing forecast models