Section 10

Daniel Lewis
OH Monday 9-11am Littauer M-42
Ec1123 Section 11 - November 19, 2015
Section 10: Time Series II
In this section, we will try to find a good model for movements in the long-term interest rate for Spanish bonds.1
(a) Levels
(b) Changes (percentage points)
Figure 1: Plots of long-run and short-run yields for Spanish bonds
1
Model selection
Consider the AR(p) model
Yt = β0 + β1 Yt−1 + . . . + βp Yt−p + ut ,
(1)
where the model contains p lags of the dependent variable Y . The question that arises is how many lags to include
in the model. We will base model selection on the Bayesian information criterion (BIC):
SSR(p)
log(T )
BIC(p) = log
(2)
+ (p + 1)
T
T
Three remarks for model selection based on BIC:
1. We want to choose the model with the smallest BIC.
2. The BIC trades off the decrease in bias from including important lags against the increase in variance from
including irrelevant lags.
3. All different models have to include the same number of observations. Otherwise, the values of BIC are not
comparable.
Q1: Why is that important for estimating different AR(p) models?
4. In Stata, the most intuitive way to compute BIC is to first run the regression for which you want to compute
BIC and then compute BIC
dis "BIC = " ln(e(rss)/e(N)) + (e(df_m)+1)*ln(e(N))/e(N)
1 Data
were downloaded from FRED using the freduse command in Stata. Type ssc install freduse to install the freduse package and
freduse IRLTLT01ESM156N, clear to download this data.
1
Daniel Lewis
OH Monday 9-11am Littauer M-42
Model selection in the example:2
. *** Model selection ***
.
. reg dspain_rate L.dspain_rate if tin(1981m2,2014m9), r
Linear regression
Number of obs
F( 1,
402)
Prob > F
R-squared
Root MSE
=
=
=
=
=
404
16.00
0.0001
0.0774
.32671
-----------------------------------------------------------------------------|
Robust
dspain_rate |
Coef.
Std. Err.
t
P>|t|
[95% Conf. Interval]
-------------+---------------------------------------------------------------dspain_rate |
L1. |
.2781705
.069553
4.00
0.000
.1414375
.4149036
|
_cons | -.0247436
.0163461
-1.51
0.131
-.0568782
.0073909
-----------------------------------------------------------------------------. dis "BIC = " ln(e(rss)/e(N)) + (e(df_m)+1)*ln(e(N))/e(N)
BIC = -2.2126248
. quietly reg dspain_rate L(1/2).dspain_rate if tin(1981m2,2014m9), r
. dis "BIC = " ln(e(rss)/e(N)) + (e(df_m)+1)*ln(e(N))/e(N)
BIC = -2.2001924
. quietly reg dspain_rate L(1/3).dspain_rate if tin(1981m2,2014m9), r
. dis "BIC = " ln(e(rss)/e(N)) + (e(df_m)+1)*ln(e(N))/e(N)
BIC = -2.1871159
. quietly reg dspain_rate L(1/4).dspain_rate if tin(1981m2,2014m9), r
. dis "BIC = " ln(e(rss)/e(N)) + (e(df_m)+1)*ln(e(N))/e(N)
BIC = -2.175654
. quietly reg dspain_rate L(1/5).dspain_rate if tin(1981m2,2014m9), r
. dis "BIC = " ln(e(rss)/e(N)) + (e(df_m)+1)*ln(e(N))/e(N)
BIC = -2.1608271
. quietly reg dspain_rate L(1/6).dspain_rate if tin(1981m2,2014m9), r
. dis "BIC = " ln(e(rss)/e(N)) + (e(df_m)+1)*ln(e(N))/e(N)
BIC = -2.1471724
. quietly reg dspain_rate L(1/12).dspain_rate if tin(1981m2,2014m9), r
. dis "BIC = " ln(e(rss)/e(N)) + (e(df_m)+1)*ln(e(N))/e(N)
BIC = -2.0919959
Q2: Our data starts at 1980m1, why do we restrict our sample to 1981m2 onwards?
Q3: Which AR model should we choose based off BIC?
1.1
Testing for structural breaks
A break is when the population regression function changes over the course of the sample, due either to
a discrete change in the population regression coefficient at a distinct date or a gradual evolution of the
coefficients over a longer period of time.
In this case, OLS will produce an average estimate over the entire sample even if the behavior of the series is
very different over different time periods.
Q4: Why should we care about breaks? How could it bias our predictions?
Q5: Is a time series with a break stationary? Why or why not?
2 To
save space, we suppress the regression output here by typing quietly before the regression command.
2
Daniel Lewis
1.1.1
OH Monday 9-11am Littauer M-42
Known break date
If the break date is known, we can test whether the coefficients before and after the break date are different.
Note the similarity to testing for different coefficients for different groups (e.g. men and women).
We define a dummy variable that is 0 before the break date and 1 after the break date,
(
0, t < τ
Dt (τ ) =
.
1, t ≥ τ
(3)
Then we interact the dummy with the regressors such that our model becomes:
Yt = β0 + β1 Yt−1 + γ0 Dt (τ ) + γ1 Dt (τ )Yt−1 + ut .
(4)
Q6: What test do we want to run to test for the break in the AR(1) model?
This is an F-test, but in this particular application, it is often called a Chow-test.
Spain joined the European Union in January 1986. It is possible that this event changed the coefficients on
the interest rate process. Let’s check it out.
. *Chow test for 1986
. gen d86 = tin(1986m1,2014m9)
. gen d86_dspain_rate = d86*dspain_rate
(1 missing value generated)
.
. reg dspain_rate L.dspain_rate d86 L.d86_dspain_rate if tin(1981m2,2014m9), r
Linear regression
Number of obs
F( 3,
400)
Prob > F
R-squared
Root MSE
=
=
=
=
=
404
6.06
0.0005
0.0782
.32738
--------------------------------------------------------------------------------|
Robust
dspain_rate |
Coef.
Std. Err.
t
P>|t|
[95% Conf. Interval]
----------------+---------------------------------------------------------------dspain_rate |
L1. |
.3079455
.1068643
2.88
0.004
.0978596
.5180313
|
d86 |
.0194282
.0566651
0.34
0.732
-.0919704
.1308269
|
d86_dspain_rate |
L1. | -.0410294
.1366374
-0.30
0.764
-.3096466
.2275877
|
_cons | -.0413252
.0541138
-0.76
0.446
-.1477081
.0650578
--------------------------------------------------------------------------------. testparm d86 L.d86_dspain_rate
( 1)
( 2)
d86 = 0
L.d86_dspain_rate = 0
F(
2,
400) =
Prob > F =
0.10
0.9043
Q7: What do we conclude from the Chow test?
1.1.2
Unknown break date
If the break date is unknown (which is often more realistic even if you think you know the break date), you
can test for a structural break at different points by repeating the Chow test above. You can collect all the
F-statistics from these tests (denote the F-statistic for a break at date τ by F (τ )), and just look at the highest
one (the intuition being that if there is a break that is where it should be). The highest F-statistic is called
3
Daniel Lewis
OH Monday 9-11am Littauer M-42
the Quandt likelihood ratio (QLR) statistic, that is, if we compute the F-statistic for all potential break dates
between τ0 and τ1 ,
QLR =
max
τ ∈{τ0 ,...,τ1 }
F (τ ).
(5)
The largest of the F statistics does not have the same distribution as the usual F statistic. Instead, it has
a special distribution that depends on the number of restrictions in the null and the endpoints as a fraction
of the total sample size (τ0 /T ,τ1 /T ). We will generally use 15% trimming where τ1 = 0.85T and τ0 = 0.15T
(rounded to the nearest integer).3 This means we will estimate the F statistic for every period in the middle
70% of our sample’s time range. A couple of notes:
1. If there is a discrete break in [τ0 , τ1 ] the QLR will reject the null that there is no break with a high
probability and will provide an estimate τb as the date with the largest F statistic (i.e., F (b
τ ) = QLR).
2. The QLR also detects other instabilities in the coefficients. ⇒ If the QLR rejects it could mean there is
(1) a single discrete break; (2) multiple discrete breaks; or (3) slow evolution of the regression function.
3. In practice, you rarely know the break date exactly. For instance, the introduction of the Euro was
prepared and anticipated for quite a while. It is not clear why the break date should be the actual
introduction rather than some prior date. We therefore recommend to always use the QLR test statistic.
The computation of the QLR test statistic follows the code in the lecture notes. Here is how you would
proceed for the Spanish interest rate:
. *QLR
. qlr dspain_rate L.dspain_rate if tin(1981m2,2014m9), graph type(png)
(note: file qlr.dta not found)
+------------------------------------------+
|
date
F
restrict
trimming |
|------------------------------------------|
1. | 1999m2
.8317085
2
.15 |
2. | 1999m1
.7830798
2
.15 |
3. | 1999m3
.7478153
2
.15 |
4. | 1999m5
.7325068
2
.15 |
5. | 1998m10
.7177035
2
.15 |
+------------------------------------------+
Computed with Newey-West standard errors with 6 lags. Results saved as qlr.dta and qlr.png
We produce a graph of the F-statistic for the different breakpoint values.
Q8: How many restrictions do we have? How many would we have if we were testing an AR(3) model?
Q9: The QLR test statistic for 2 restrictions and 15% trimming is 5.86, what do we conclude?
3 See table 14.6 on page 559 of the book for critical values with 15% trimming. The critical values are larger than the F
q,∞
distribution’s critical values.
4
Daniel Lewis
OH Monday 9-11am Littauer M-42
Figure 2: QLR test
2
Forecast error and forecast intervals
The forecast error is
F Et+1 = Yt+1 − Ŷt+1|t ,
(6)
which is just the difference between the actual and the predicted value. This error can be due to two sources.
The deviation of our estimated coefficients from the actual values (as before when we were not making
predictions), and idiosyncratic errors from the future disturbance ut+1 . For instance, for the AR(1) model,
we have
h
i
F Et+1 = ut+1 − (β̂0 − β0 ) + (β̂1 − β1 )Yt .
(7)
The mean squared forecast error (MSFE) is defined as
h
i
M SF E = E (Yt+1 − Ŷt+1|t )2 ,
(8)
and its square root is the root mean squared forecast error (RMFSE). Under the assumption that ut+1 is
normally distributed, we want a 95% confidence interval to be
Ŷt+1 ± 1.96RM SF E.
(9)
In period t, we do not know the actual value of Yt+1 , so it is hard to estimate the RMFSE. However, we can
approximate the RMFSE by doing Psuedo-Out-Of-Sample prediction.
We’ll start by estimating our regression using data up to one year from the end of our sample. Then, using
the predict command in Stata we can compute the fitted values from this regression for the last year of our
data. Once we have these fitted values, we can compute the RMSE within the last year of data, which should
approximate the RMSFE. Here is how you would compute this for the AR(1) in our example:
. quietly reg dspain_rate L.dspain_rate if tin(1981m2,2013m8), r
. predict dspain_predicted
(option xb assumed; fitted values)
(2 missing values generated)
. gen dspain_error = dspain_rate - dspain_predicted
(2 missing values generated)
5
Daniel Lewis
OH Monday 9-11am Littauer M-42
. gen dspain_error2 = dspain_error * dspain_error
(2 missing values generated)
. summarize dspain_error2 if tin(2013m9,2014m9)
Variable |
Obs
Mean
Std. Dev.
Min
Max
-------------+-------------------------------------------------------dspain_err~2 |
13
.0253475
.0374748
.0005852
.1194858
. display "RMSFE = " sqrt(r(mean))
RMSFE = .15920895
6