25573 Time Series Econometrics Lecture 5: Unit Root Non-Stationarity
Hardy Hulley Finance Department, UTS 27 April 2020
1/43
Contents
1
2
3
Trend Stationarity and Difference Stationarity A General Class of Models
Trend Stationarity
Difference Stationarity
Differencing and Unit Roots ARIMA Models
Testing for Unit Roots
Identifying a Unit Root
The Dickey-Fuller Test
The Augmented Dickey-Fuller Test
Bibliography
2/43
Trend Stationarity and Difference Stationarity
A General Class of Models
Consider a time series {xt} determined by a model of the form
xt = β0 + β1t + zt, (5.1)
where {zt} is a time series whose values z0, z−1, z−2, . . . are known.
We call {β0 + β1t} the deterministic trend of the model, while {zt} is called
the stochastic component.
We assume that the stochastic component follows an ARMA(p, q) model
zt =φ1zt−1 +…+φpzt−p +εt +θ1εt−1 +…+θqεt−q, (5.2) where {εt} is a white noise.
This can be represented more compactly as
φ(L)zt = θ(L)εt,
φ(L) 1 − φ1L − . . . − φpLp and θ(L) 1 + θ1L + . . . + θqLq
are the autoregressive and moving average lag polynomial operators.
3/43
where
Trend Stationarity and Difference Stationarity
A General Class of Models
Recall that the stationarity properties of {zt} are determined by the location of the solutions z1, . . . , zp to the p-th order polynomial equation
1−φ1z−…−φpzp =0
in the complex plane.
• The series is stationary if the solutions all lie outside the unit circle in the complex plane or (equivalently) if the characteristic roots
ω1 1/z1,…,ωp 1/zp all line inside the unit circle.
• It is non-stationary of at least one solution lies inside the unit circle or (equivalently) if at least one characteristic root lies outside the unit circle.
• It is said to be unit root non-stationary if one of the solutions is 1 and the remainder lie outside the unit circle or (equivalently) if one of the characteristic roots is 1 and the remainder lie inside the unit circle.
We distinguish between the following two cases in our analysis of (5.1):
• If {zt} is stationary then {xt} is called a trend-stationary series.
• If {zt} is unit-root non-stationary then {xt} is called a difference-stationary
series.
4/43
Trend Stationarity and Difference Stationarity
Trend Stationarity
In the trend-stationary case, the series {xt} is stationary around a deterministic mean, since the stochastic component {zt} is stationary.
In that case, {zt} is said to be integrated of order zero or I(0).
The simplest trend-stationary series {xt} is obtained by setting zt 0 in
(5.1), in which case we obtain
xt =β0 +β1t=β0 +β1 +β1(t−1), which can also be written as
xt = β1 + xt−1,
with x0 = β0.
In that case, {xt} is a pure trend series without any stochastic component.
5/43
Trend Stationarity and Difference Stationarity
Trend Stationarity
A more interesting trend stationary series {xt} arises when we set zt εt in (5.1), where {εt} is a white noise with Var(εt) = σ2ε, so that
xt = β0 + β1t + εt.
The mean and variance of this series are given by
E(xt)=β0 +β1t+E(εt)=β0 +β1t
and
Var(xt) = Var(εt) = σ2ε, by the properties of white noise.
In other words, the mean of {xt} is a linear function of time but its variance remains constant.
This is generally true for all trend stationary series.
6/43
Trend Stationarity and Difference Stationarity
Difference Stationarity
In the difference stationary case, the stochastic component {zt} is unit root non-stationary, which implies that the differenced series {∆zt}, given by
∆zt zt −zt−1 =(1−L)zt,
In that case, {zt} is said to be integrated of order one or I(1).
is stationary.
The easiest example arises when {zt} is determined by the unit root
non-stationary AR(1) model
zt = zt−1 + εt, where {εt} is a white noise with Var(εt) = σ2ε.
(5.3)
The differenced series {∆zt zt − zt−1 = εt} is then clearly stationary, since it is a white noise.
The series {zt} determined by (5.3) is known as a random walk.
7/43
Trend Stationarity and Difference Stationarity
Difference Stationarity
Expanding (5.3) recursively yields
zt = zt−1 + εt
= zt−2 +εt−1 +εt
= zt−3 +εt−2 +εt−1 +εt
.
t
= z0 + εs.
s=1
The mean and variance of the random walk (5.3) are given by
(5.4)
and
t
E(zt)=z0 +E(εs)=z0
s=1
ÅÅt ã2ã t Var(zt) = E(zt − z0)2 = E εs =
by the properties of white noise.
s=1
E(ε2s ) = σ2εt, s=1
8/43
Trend Stationarity and Difference Stationarity
Difference Stationarity
In other words, the mean of {zt} is constant but its variance is a linear function of time.
A difference stationary series whose stochastic component is a random walk is called a random walk with drift.
Using (5.1) and (5.3), the equation for a random walk with drift can be written as
xt = β0 + β1t + zt
=β0 +β1(t−1)+β1 +zt−1 +εt (5.5) = β1 + xt−1 + εt,
where {εt} is a random walk satisfying Var(εt) = σ2ε.
Using the moving average representation (5.4) for a random walk, it can
also be written as
t
xt = β0 + β1t + z0 + εs.
s=1
9/43
Trend Stationarity and Difference Stationarity
Difference Stationarity
The mean and variance of a random walk with drift (5.5) are therefore given by
t
E(xt)=β0 +β1t+z0 +E(εs)=z0 +β0 +β1t
s=1
and
ÅÅt ã2ã t Var(xt)=Ext −z0 −β0 −β1t)2=E εs =
by the properties of white noise.
s=1
E(ε2s)=σ2εt, s=1
10/43
Trend Stationarity and Difference Stationarity
Differencing and Unit Roots
To understand why differencing removes the unit root from the stochastic component {zt} of a difference stationary seres {xt} described by (5.1), let z1, . . . , zp be the (complex-valued) solutions to the polynomial equation
1−φ1z−…−φpzp =0,
and let ω1 1/z1 , . . . , ωp 1/zp be the corresponding characteristic roots.
It can be shown that the autoregressive lag polynomial operator φ(L) for {zt} factorises as follows:
p φ(L)1−φ1L−…−φpLp =(1−ωiL).
i=1
Suppose {zt} is unit root non-stationary, which is to say that one of the characteristic roots is 1, while the remaining p − 1 characteristic roots lie inside the unit circle in the complex plane.
11/43
Trend Stationarity and Difference Stationarity
Differencing and Unit Roots
Wemayassumethatωp =1and|ωi|<1,foreachi∈{1,...,p−1}, without loss of generality.
The autoregressive lag polynomial operator φ(L) for {zt} then factorises
as follows:
p−1
φ(L) = (1 − L) (1 − ωiL) .
i=1
φ∗ (L)
Since the differenced series {∆zt} is obtained by setting
∆zt zt −zt−1 =(1−L)zt,
we observe that differencing effectively cancels out the first factor in the expression for φ(L).
12/43
Trend Stationarity and Difference Stationarity
Differencing and Unit Roots
The lag polynomial operator for the differences series {∆zt} is thus
p−1
φ∗(L) = (1 − ωiL).
i=1
In particular, the differenced series follows a stationary ARMA(p − 1, q)
model, since |ωi| < 1, for each i ∈ {1, . . . , p − 1}.
Finally, note that if {xt} given by (5.1) is a difference stationary series,
then {∆xt} is a stationary ARMA(p − 1, q) series, since
∆xt xt −xt−1 =β0 +β1t+zt −β0 −β1(t−1)−zt−1 =β1 +∆zt
and {∆zt} is a stationary ARMA(p − 1, q) series.
13/43
Trend Stationarity and Difference Stationarity
Differencing and Unit Roots
Example 5.1
Consider the AR(2) series {zt} given by
zt = 0.5zt−1 + 0.5zt−2 + εt,
where {εt} is a white noise. The autoregressive lag polynomial operator is φ(L)=1−0.5L−0.5L2 =(1−L)(1+0.5L).
The solutions to the autoregressive polynomial equation
1−0.5z−0.5z2 =(1−z)(1+0.5z)=0
are z1 = 1 and z2 = −2, and the characteristic roots are ω1 = 1 and ω2 = −0.5. The first is a unit root, while the second lies inside the unit circle. Hence, {zt} is unit root non-stationary.
14/43
Trend Stationarity and Difference Stationarity
Differencing and Unit Roots
Example 5.1 (continued)
The differenced series {∆zt} satisfies
∆zt zt − zt−1 = −0.5zt−1 + 0.5zt−2 + εt = −0.5(zt−1 − zt−2) + εt
= −0.5∆zt−1 + εt. Its autoregressive lag polynomial operator is
φ∗(L) = 1 + 0.5L,
and the associated autoregressive polynomial equation is
1 + 0.5z = 0.
15/43
Trend Stationarity and Difference Stationarity
Differencing and Unit Roots
Example 5.1 (continued)
The unique solution to this equation is z1 = −2 and the corresponding characteristic root ω1 = −0.5 lies inside the unit circle in the complex plane. Hence, {∆zt} is a stationary series, implying that {zt} is an I(1) series.
16/43
Trend Stationarity and Difference Stationarity
Differencing and Unit Roots
Example 5.2
Consider the AR(3) series {zt} given by
zt = 1.75zt−1 − 0.875zt−2 + 0.125zt−3 + εt,
where {εt} is a white noise. The autoregressive lag polynomial operator is φ(L) = 1 − 1.75L + 0.875L2 − 0.125L3 = (1 − L)(1 − 0.5L)(1 − 0.25L).
The solutions to the autoregressive polynomial equation
1−1.75z+0.875z2 −0.125z3 =(1−z)(1−0.5z)(1−0.25z)=0
arez1 =1,z2 =2andz3 =4,andthecharacteristicrootsareω1 =1, ω2 = 0.5 and ω3 = 0.25. The first is a unit root, while the second two lie inside the unit circle. Hence, {zt} is unit root non-stationary.
17/43
Trend Stationarity and Difference Stationarity
Differencing and Unit Roots
Example 5.2 (continued)
The differenced series {∆zt} satisfies
∆zt zt − zt−1 = 0.75zt−1 − 0.875zt−2 + 0.125zt−3 + εt
= 0.75(zt−1 − zt−2) − 0.125(zt−2 − zt−3) + εt
= 0.75∆zt−1 − 0.125∆zt−2 + εt. Its autoregressive lag polynomial operator is
φ∗(L) = 1 − 0.75L + 0.125L2 = (1 − 0.5L)(1 − 0.25L), and the associated autoregressive polynomial equation is
1 − 1.75z + 0.125z2 = (1 − 0.5z)(1 − 0.25z) = 0.
18/43
Trend Stationarity and Difference Stationarity
Differencing and Unit Roots
Example 5.2 (continued)
The solutions to this equation are z1 = 2 and z2 = 4 and the corresponding characteristic roots ω1 = 0.5 and ω2 = 0.25 lie inside the unit circle in the complex plane. Hence {∆zt} is a stationary series, impling that {zt} is an I(1) series.
19/43
Trend Stationarity and Difference Stationarity
ARIMA Models
Engle and Granger (1987) defined an integrated series to be one that has a stationary ARMA representation after the differenceing operator ∆ is applied d times.
Such a series is said to be integrated of order d.
We use the notation I(d) to denote the class of models that are
integrated of order d.
An integrated series is also referred to as an autoregressive integrated
moving average (ARIMA) series.
If differencing d times produces an ARMA(p, q) series, the original series is described as an ARIMA(p, d, q) series.
20/43
Trend Stationarity and Difference Stationarity
ARIMA Models
Example 5.3
Consider the AR(3) series {xt} defined by
xt = 2.5xt−1 − 2xt−2 + 0.5xt−3 + εt,
where {εt} is a white noise. The autoregressive lag polynomial operator is φ(L)=1−2.5L+2L2 −0.5L3 =(1−L)2(1−0.5L).
The solutions to the autoregressive polynomial equation
1−2.5z+2z2 −0.5z3 =(1−z)2(1−0.5z)=0
arez1 =1,z2 =1andz3 =2,andthecharacteristicrootsareω1 =1,
ω2 = 1 and ω3 = 0.5. The first two are unit roots, while the third lies inside the unit circle. Hence, {zt} is non-stationary with two unit roots.
21/43
Trend Stationarity and Difference Stationarity
ARIMA Models
Example 5.3 (continued)
The differenced series {∆xt} satisfies
∆xt xt − xt−1 = 1.5xt−1 − 2xt−2 + 0.5xt−3 + εt
= 1.5(xt−1 − xt−2) − 0.5(xt−2 − xt−3) + εt
= 1.5∆xt−1 − 0.5∆xt−2 + εt. Its autoregressive lag polynomial operator is
φ∗(L)=1−1.5L+0.5L2 =(1−L)(1−0.5L) and the associated autoregressive polynomial equation is
1−1.5z+0.5z2 =(1−z)(1−0.5z)=0.
22/43
Trend Stationarity and Difference Stationarity
ARIMA Models
Example 5.3 (continued)
The solutions to this equation are z1 = 1 and z2 = 2, and the corresponding characteristic roots are ω1 = 1 and ω2 = 0.5. The first is a unit root, while the second lies inside the unit circle. Hence {∆xt} is unit root non-stationary.
23/43
Trend Stationarity and Difference Stationarity
ARIMA Models
Example 5.3 (continued)
The twice differenced series {∆2xt} satisfies
∆2xt ∆xt − ∆xt−1 = 0.5∆xt−1 − 0.5∆xt−2 + εt
= 0.5(∆xt−1 − ∆xt−2) + εt = 0.5∆2xt−1 + εt.
Its autoregressive lag polynomial operator is
φ∗∗(L) = 1 − 0.5L
and the associated autoregressive polynomial equation is
1 − 0.5z = 0.
24/43
Trend Stationarity and Difference Stationarity
ARIMA Models
Example 5.3 (continued)
The unique solution to this equation is z1 = 2 and the corresponding characteristic root ω1 = 0.5 lies inside the unit circle in the complex plane. Hence {∆2xt} is a stationary series, implying that {xt} is I(2). In particular, {xt } is an ARIMA(1, 2, 0) series.
25/43
Testing for Unit Roots
Identifying a Unit Root
Example 5.4
The R code in Listing 5.1 simulates and plots 500 observations of the stationary AR(1) series {xt} given by
xt = 0.9xt−1 + εt, and the random walk {zt} given by
zt = zt−1 + εt,
with both models driven by the same white noise {εt}. The simulated series are plotted in Figure 5.1. Note that {xt} is an I(0) series and {zt} is an I(1) series. Nevertheless, the two series look very similar, making it impossible to distinguish between a stationary series and a unit root series by visual inspection alone, in general.
26/43
Testing for Unit Roots
Identifying a Unit Root
1 # Simulate an AR(1) series and a random walk.
2 set.seed(123456)
3 T <- 1:500
4 epsilon <- rnorm(T)
5 x <- arima.sim(n=length(T), list(ar=0.9), innov=epsilon)
6 z <- cumsum(epsilon)
7
8 # Plot the time series.
9 df <- data.frame(T, as.numeric(x), z)
10 colnames(df) <- c(’t’,’x’,’z’)
11 ggplot(df, aes(x=t)) +
12
13
14
15
geom_line(aes(y=x), linetype=’solid’, size=0.5, colour=’blue’) +
geom_line(aes(y=z), linetype=’solid’, size=0.5, colour=’red’) +
labs(x=’Time’, y=’Values’, title=’An AR(1) Series and a Random Walk’) + theme(plot.title=element_text(hjust = 0.5, size=15, face=’bold’))
Listing 5.1: R code for simulating and plotting a stationary AR(1) series and a random walk.
27/43
Testing for Unit Roots
Identifying a Unit Root
10
0
An AR(1) Series and a Random Walk
0 100 200
300 400 500
Figure 5.1: The stationary AR(1) series and the random walk simulated in Example 5.4.
Time
28/43
Values
Testing for Unit Roots
The Dickey-Fuller Test
Suppose the series {xt} follows one of the following two AR(1) models:
xt = φ1xt−1 + εt (5.6a)
xt = φ0 + φ1xt−1 + εt, (5.6b) where {εt} is a white noise.
If |φ1| < 1 then both series follow stationary AR(1) models, but if φ1 = 1 then both series possess unit roots.
In that case, it follows from (5.3) and (5.5) that (5.6a) is a random walk and (5.6b) is a random walk with drift.
Dickey and Fuller (1979) proposed a test for determining whether {xt} possesses a unit root.
Under the null hypothesis H0 : φ1 = 1 the series possesses a unit root, while the under the alternative hypothesis H1 : φ1 < 1 it is stationary.
29/43
Testing for Unit Roots
The Dickey-Fuller Test
To perform the test, we estimate one of the models
∆xt xt −xt−1 =(φ1 −1)xt−1 +εt
∆xt xt −xt−1 =φ0 +(φ1 −1)xt−1 +εt,
depending on which form of (5.6) is assumed. The Dickey-Fuller test statistic is the t-ratio
The critical values are also dependent on which form of the model (5.7) was estimated.
In practice, the critical values for the Dickey-Fuller test are estimated by Monte Carlo simulation (see e.g. MacKinnon, 2010).
DF
Obtaining critical values is complicated by the fact that DF does not
(5.7a) (5.7b)
.
SE(φ1 )
follow a Student’s t distribution under the null hypothesis.
φˆ 1 − 1 ”
30/43
Testing for Unit Roots
The Dickey-Fuller Test
David Dickey (b. 1945) Wayne Fuller (b. 1931)
31/43
Testing for Unit Roots
The Dickey-Fuller Test
Example 5.5
The R code in Listing 5.2 performs a Dickey-Fuller test on the simulated random walk from Example 5.4.a The Dickey-Fuller test statistic
DF
φˆ1 −1
≈ −
0.0088 0.0062
≈ −1.4272
SE(φ1)
is greater than the critical value of −1.62 at the 10% level of significance, implying that the estimated coefficient πˆ φˆ1 − 1 is not statistically significant, even at the 10% level. Hence, we cannot reject the null hypothesis H0 : φ1 = 1 that the series possesses a unit root.
aThe R function ur.df used to perform the Dickey-Fuller test is contained in the package urca, which must be installed and loaded before the function can be used.
32/43
Testing for Unit Roots
The Dickey-Fuller Test
1 # Perform a Dickey-Fuller test on the simulated random walk. 2 summary(ur.df(z, type=’none’, lags=0))
3 # 4#
5 #
6 #
7 #
8
Listing 5.2: R code for performing a Dickey-Fuller test on a simulated random walk.
Value of test-statistic is: -1.4272
Critical values for test statistics: 1pct 5pct 10pct
tau1 -2.58 -1.95 -1.62
9 #
10 dfreg <- summary(lm(diff(z)~0+z[1:T-1]))
11 pi <- dfreg$coefficients[1]
12 round(pi, 4) # -0.0088
13 stderr <- dfreg$coefficients[2]
14 round(stderr, 4) # 0.0062
15 dfstat <- pi/stderr
16 round(dfstat, 4) # -1.4272
Compute the Dickey-Fuller test statistic for the simulated random walk directly.
33/43
Testing for Unit Roots
The Dickey-Fuller Test
Example 5.6
The R code in Listing 5.3 performs a Dickey-Fuller test on the simulated random AR(1) series from Example 5.4. The Dickey-Fuller test statistic
DF
φˆ1 −1
≈ −
0.1041 0.0197
≈ −5.2722
SE(φ1)
is less than the critical value of −2.58 at the 1% level of significance, implying that the estimated coefficient πˆ φˆ1 − 1 is statistically significant at the 10% level. Hence, we must reject the null hypothesis H0 : φ1 = 1 that the series possesses a unit root in favour of the alternative hypothesis H1 : φ1 < 1 that it is stationary.
34/43
Testing for Unit Roots
The Dickey-Fuller Test
1 # Perform a Dickey-Fuller test on the simulated AR(1) series. 2 summary(ur.df(x, type=’none’, lags=0))
3 # 4#
5 #
6 #
7 #
8
Listing 5.3: R code for applying the Dickey-Fuller test to a simulated path of a stationary AR(1) process.
Value of test-statistic is: -5.2722
Critical values for test statistics: 1pct 5pct 10pct
tau1 -2.58 -1.95 -1.62
9 #
10 dfreg <- summary(lm(diff(x)~0+x[1:T-1]))
11 pi <- dfreg$coefficients[1]
12 round(pi, 4) # -0.1041
13 stderr <- dfreg$coefficients[2]
14 round(stderr_pi, 4) # 0.0197
15 dfstat <- pi/stderr
16 round(dfstat, 4) # -5.2722
Compute the Dickey-Fuller test statistic for the simulated random walk directly.
35/43
Testing for Unit Roots
The Augmented Dickey-Fuller Test
Dickey and Fuller (1981) proposed the Augmented Dickey-Fuller test, which can be used to determined whether an AR(p) series {xt} possesses a unit root.
In this case we estimate one of the following models:
∆xt = πxt−1 + γ1∆xt−1 + · · · + γp−1∆xt−p + εt
∆xt =β0 +πxt−1 +γ1∆xt−1 +···+γp−1∆xt−p +εt
∆xt =β0 +β1t+πxt−1 +γ1∆xt−1 +···+γp−1∆xt−p +εt,
depending on what deterministic behaviour is assumed.
Under the null hypothesis H0 : π = 0 the series possesses a unit root, while the under the alternative hypothesis H1 : π < 0 it is stationary.
(5.8a) (5.8b) (5.8c)
36/43
Testing for Unit Roots
The Augmented Dickey-Fuller Test
The Augmented Dickey-Fuller (ADF) test statistic is the t-ratio
.
As for the Dickey-Fuller test, the critical values are obtained by Monte Carlo estimation.
37/43
ADF
Its critical values depend on the form of the model (5.8) that was
estimated.
πˆ ”
SE(π)
Testing for Unit Roots
The Augmented Dickey-Fuller Test
Example 5.7
The R code in Listing 5.4 applies the ADF test to the logarithm of the quarterly U.S. GDP over the period from 1947 to 2008. The series is plotted in the upper-left panel of Figure 5.2. We observe that GDP has grown strongly over the sample period, indicating that the series is clearly not stationary. The upper-right panel plots the first difference of the log-GDP, which is effectively the GDP growth rate. That series appears to vary around a fixed mean, although the variability seems to decrease over time. Nevertheless, the differenced series may be stationary, indicating that the original series may be difference stationary. The lower-left panel plots the ACF for the log-GDP, which shows that the log-GDP series exhibits high levels of serial correlation. In order to test the log-GDP series for the existence of a unit root, we should therefore use an ADF test with a large lag order.
38/43
Testing for Unit Roots
The Augmented Dickey-Fuller Test
Example 5.7 (continued)
We run the ADF test twice.a The first test uses uses a lag order of 10, based on the AIC. The second test uses a lag order of 16, based on the PACF for the differenced log-GDP series in the lower-right panel of Figure 5.2. The large p-values of 0.4569 and 0.7603, respectively, indicate that we cannot reject the null hypothesis that the log-GDP series contains a unit root.
aThe R function adfTest is used to perform the ADF tests. It is contained in the package fUnitRoots, which must be installed and loaded before the function can be used.
39/43
Testing for Unit Roots
The Augmented Dickey-Fuller Test
1 # Read the quarterly GDP data and computes the log-GDP.
2 dat <- read.table(’q-gdp4708.txt’, header=TRUE)
3 yrs <- dat$year
4 mths <- dat$mon
5 days <- dat$day
6 dates <- as.Date.character(paste(yrs,’-’,mths,’-’,days, sep=’’))
7 loggdp <- log(dat$gdp)
8 dfgnp <- data.frame(dates[-1], dat$gdp[-1], loggdp[-1], diff(loggdp))
9 colnames(dfgnp) <- c(’Date’,’GNP’,’LogGNP’,’DeltaLogGNP’)
10
11 # Plot the log-GDP, its first difference, the ACF of the log-GDP and the PACF
12 # of the first difference of the log-GDP.
13 p1 <- ggplot(dfgnp, aes(x=Date, y=LogGNP)) +
14 geom_line(size=0.5, colour=’blue’, linetype=’solid’) +
15 labs(x=’Date’, y=’Log(GNP)’) +
16 theme(plot.title=element_text(hjust=0.5, size=15, face=’bold’))
17 p2 <- ggplot(dfgnp, aes(x=Date, y=DeltaLogGNP)) +
18 geom_line(size=0.5, colour=’blue’, linetype=’solid’) +
19 labs(x=’Date’, y=’Delta Log(GDP)’) +
20 theme(plot.title=element_text(hjust = 0.5, size=15, face=’bold’))
21 p3 <- ggAcf(dfgnp$LogGNP, lag.max=20, main=’Log(GDP)’) +
22 geom_segment(lineend=’butt’, color=’red’)
23 geom_hline(yintercept=0, color=’black’) +
24 theme(plot.title=element_text(hjust=0.5))
25 p4 <- ggPacf(dfgnp$DeltaLogGNP, lag.max=20,
26 geom_segment(lineend=’butt’, color=’red’)
27 geom_hline(yintercept=0, color=’black’) +
28 theme(plot.title=element_text(hjust=0.5))
29 p5 <- grid.arrange(arrangeGrob(p1, p2, p3, p4, nrow=2),
30 top=textGrob(’Logarithm of the Quarterly U.S. GDP’,
31 gp=gpar(fontsize=15,font=2)))
+
Listing 5.4: R code for performing an Augmented Dickey-Fuller test to the logarithm of the quarterly U.S. GDP.
main=’Delta Log(GDP)’) + +
40/43
Testing for Unit Roots
The Augmented Dickey-Fuller Test
32 # Perform an ADF test on the log-GDP.
33 mod <- ar(diff(loggdp), aic=TRUE, method=’mle’)
34 adfTest(loggdp, mod$order, type=c(’c’))
35 #
36 #
37 #
38 #
39 #
40 #
41
Test Results: PARAMETER:
Lag Order: 10 STATISTIC:
Dickey-Fuller: -1.6109 P VALUE: 0.4569
42 adfTest(loggdp, 16, type=c(’c’))
43 #
44 #
45 #
46 #
47 #
48 #
Test Results: PARAMETER:
Lag Order: 16 STATISTIC:
Dickey-Fuller: -0.7955 P VALUE: 0.7603
41/43
Testing for Unit Roots
The Augmented Dickey-Fuller Test
Logarithm of the Quarterly U.S. GDP
9
8
7
6
1960 1980 2000
Date
1.00
0.75
0.50
0.25
0.00
Log(GDP)
5 10 15 20
Lag
0.4
0.2
0.0
Delta Log(GDP)
5 10 15 20
Lag
Figure 5.2: The logarithm of the quarterly U.S. GDP over the period 1947–2008, together with the first difference of the log-GDP, the ACF of the log-GDP and the
PACF of the first difference of the log-GDP.
0.06
0.04
0.02
0.00
−0.02
1960 1980 2000
Date
42/43
ACF Log(GNP)
PACF Delta Log(GDP)
Bibliography
Dickey, D. A. and W. A. Fuller (1979). Distribution of the estimators for autoregressive time series with a unit root. J. Amer. Statist.
Assoc. 74(366), 427–431.
Dickey, D. A. and W. A. Fuller (1981). Likelihood ratio statistics for autoregressive time series with a unit root. Econometrica 49(4), 1057–1072.
Engle, R. F. and C. W. J. Granger (1987). Co-integration and error correction: Representation, estimation, and testing. Econometrica 55(2), 251–276.
MacKinnon, J. G. (2010). Critical values for cointegration tests. Working paper.
43/43