Unit Root, Differencing The Time Series, Unit Root Test (ADF Test)
Unit Root, Differencing The Time Series, Unit Root Test (ADF Test)
Unit root,differencing the time series, unit root test (ADF test) – p.1/27
Outline
• What is a unit root and what is its consequence
• If we have unit root - how to transform the data, so that
we can use the ARMA methodology
• How to find from the data that there is a unit root →
unit root tests
Unit root,differencing the time series, unit root test (ADF test) – p.2/27
Examples
• Consider the process yt = yt−1 + ut :
⋄ it is a nonstationary AR(1) process with a unit root
⋄ for its differences ∆yt = yt − yt−1 we have
∆yt = ut
⋄ so ∆yt is a stationary process
• Consider a nonstationary process with a unit root
1 1
(1 − L)(1 − L)xt = 1 + (1 − L)ut
2 3
Then for the differences
∆yt = yt − yt−1 = (1 − L)yt
we have
1 1
(1 − L)∆yt = 1 + (1 − L)ut ,
2 3
so ∆yt is a stationary process
Unit root,differencing the time series, unit root test (ADF test) – p.3/27
Examples
• Consider nonstationary process with a double unit root
1 2 1
(1 − L)(1 − L) xt = 1 + (1 − L)ut
2 3
The for the second differences
∆2 yt = ∆(∆yt ) = (1 − L)(1 − L)yt = (1 − L)2 yt
we have
1 2 1
(1 − L)∆ yt = 1 + (1 − L)ut ,
2 3
so ∆2 yt is a stationary process
• In general:
If the multiplicity of the unit root is k (and the others
are outsider the unit circle), then its k-th differences are
stationary.
Unit root,differencing the time series, unit root test (ADF test) – p.4/27
ARIMA models
• We need need to differentiate the process k times, in
order to get a stationary process, it is called intergrated
process of order k , denoted by I(k)
• If these k -th differences follow ARMA(p,q), then we
say that the original time series is ARIMA(p,k,q).
• For example xt , if
1 2 1
(1 − L)(1 − L) xt = 1 + (1 − L)ut ,
2 3
is ARIMA(1,2,1) process.
Unit root,differencing the time series, unit root test (ADF test) – p.5/27
Our aim
• Consider firstly AR(1) model: xt = δ + ρxt−1 + ut
• We want to:
⋄ test a hypothesis about a unit root (then, the
process is nonstationary), so H0 : ρ = 1
⋄ find out it can be rejected in favour of the
stationarity - H1 : ρ < 1
Unit root,differencing the time series, unit root test (ADF test) – p.6/27
Unit root and the t-statistics
We try to use the hypothesis testing about coefficients of a
regression model known from econometrics.
For example:
• Set x=1:200
• Simulate y=x+rnorm(200)*sigma
• Estimate the model y = c + ρ x + ε
• We note:
⋄ estimate of the parameter ρ
⋄ value of the t-statistics corresponding to hypothesis
H0 : ρ = 1 (which holds)
• Repeat 105 times and plot the histogram
Unit root,differencing the time series, unit root test (ADF test) – p.7/27
Unit root and the t-statistics
• Example of the simulated data:
Unit root,differencing the time series, unit root test (ADF test) – p.8/27
Unit root and the t-statistics
• Estimated regression:
Unit root,differencing the time series, unit root test (ADF test) – p.9/27
Unit root and the t-statistics
• Estimated of ρ: normal distribution
Unit root,differencing the time series, unit root test (ADF test) – p.10/27
Unit root and the t-statistics
• t-statistics to test H0 : ρ = 1: Student t-distribution
Unit root,differencing the time series, unit root test (ADF test) – p.11/27
Unit root and the t-statistics
Another simulation:
• Consider vector z generated as zt = zt−1 + εt
• Take x=z[1:200], y=z[2:201], so yt = zt , xt = zt−1
• Estimate the model y = c + ρ x + ε
• Note again:
⋄ estimate of parameter ρ
⋄ value of t-statistics to test H0 : ρ = 1 (which holds)
• Repeat 105 times and plot the histogram
Unit root,differencing the time series, unit root test (ADF test) – p.12/27
Unit root and the t-statistics
• Example of simulated data - time series s z :
Unit root,differencing the time series, unit root test (ADF test) – p.13/27
Unit root and the t-statistics
• Example of simulated data - data for regression
Unit root,differencing the time series, unit root test (ADF test) – p.14/27
Unit root and the t-statistics
• Estimated regression:
Unit root,differencing the time series, unit root test (ADF test) – p.15/27
Unit root and the t-statistics
• Estimates of parameter ρ: not a normal distribution
Unit root,differencing the time series, unit root test (ADF test) – p.16/27
Unit root and the t-statistics
• "t-statistics" to test H0 : ρ = 1: does not have a
t-distribution
Unit root,differencing the time series, unit root test (ADF test) – p.18/27
Unit root tests
• AR(1) process:
(1) yt = ρyt−1 + ut
unit root means that ρ = 1.
• Equivalently:
∆yt = (ρ − 1)yt−1 + ut
and we are interested in t-statistics from the
significance of coefficient at yt−1 - but with another
critical value
• This critical value
⋄ depends on number of data
⋄ changes, if equation (1) has a constant term or a
linear drift
• In general: ∆yt = α + βt + (ρ − 1)yt−1 + ut
Unit root,differencing the time series, unit root test (ADF test) – p.19/27
Unit root tests
• AR(p) process: yt = α1 yt−1 + α2 yt−2 + . . . αp yt−p + ut
unit root → α1 + . . . αp = 1.
• Write in the form:
• We estimate
∆yt = α + βt + (ρ − 1)yt−1 + θ1 ∆yt−1 + . . . + θk ∆yt−k + ut
where we have to
⋄ decide whether to include a constant α and/or
linear trend β (depending on whether they are
present in process y )
⋄ choose k
• Then, we are interested in t-statistics from significance
test about coefficient in front of yt−1 , but with correct
critical values
Unit root,differencing the time series, unit root test (ADF test) – p.21/27
ADF test - critical values
• James G. MacKinnon (1991) - available as a part of an
expanded version from 2010:
James G. MacKinnon: Critical Values for Cointegration Tests. Queen’s Economics
Department Working Paper No. 1227, 2010..
Dostupné online: http://ideas.repec.org/p/qed/wpaper/1227.html
Unit root,differencing the time series, unit root test (ADF test) – p.22/27
ADF test - critical values
• If we use T data points in the regression, the critical
value is β∞ + β1 /T + β2 /T 2
• In our example from the simulations: constant without
trend, T = 200:
⋄ for 1 percent:
−3.4336 − 5.999/200 − 29.25/2002 = −3.451
⋄ for 5 percent:
−2.8621 − 2.738/200 − 8.36/2002 = −2.879
• Compare with t-distribution (different) and quantiles
from simulations (ok)
Unit root,differencing the time series, unit root test (ADF test) – p.23/27
ADF test in R
• Library urca
• Function ur.df (ur - unit root, df - Dickey-Fuller) with
parameters:
⋄ type: possible values are drift (constant without
linear trend), trend (constant and linear trend),
none (nothing)
⋄ lags: maximal number of lags
⋄ selectlags: criterion for the choice of lags
(information criteri: AIC, BIC)
Unit root,differencing the time series, unit root test (ADF test) – p.24/27
ADF test in R
• Example: spread from the earlier lectures difference
between long-term and short-term rates)
• In R:
summary(ur.df(spread,type="drift",lags=8,selectlags="BIC")
• summary in order to obtain also critical values, not
only the test statistics
Unit root,differencing the time series, unit root test (ADF test) – p.25/27
ADF test in R
• Výstup: estimated regression and the test statistics:
Unit root,differencing the time series, unit root test (ADF test) – p.26/27
ADF test in R
• Output: test statistics and critical values:
Unit root,differencing the time series, unit root test (ADF test) – p.27/27