A collection and description of functions
for unit root testing. This is a Rmetrics
conform interface to the unitroot tests implemented by B. Pfaff
available through the R package "urca" which is required here.
Added functions based on the urca package include:
[ur*Test] -
a logical flag, by default TRUE. Should a diagnostical
plot be displayed?
lag.max
[urersTest] -
the maximum numbers of lags used for testing of a decent lag
truncation for the "P-test", BIC used, or the maximum
number of lagged differences to be included in the test
regression for "DF-GLS".
lag
[urzaTest] -
the highest number of lagged endogenous differenced variables
to be included in the test regression.
lags
[urkpssTest][urppTest] -
the maximum number of lags used for error term correction.
model
[urersTest] -
a character string dennoting the deterministic model used for
detrending, either "constant", the default, or
"trend".
[urppTest] -
a character string which determines the deterministic part in
the test regression, either "constant", the default, or
"trend".
[urzaTest] -
a character string specifying if the potential break occured
in either the "intercept", the linear "trend" or
in "both".
pol.deg
[urspTest] -
the polynomial degree in the test regression.
signif
[urspTest] -
the significance level for the critical value of the test
statistic.
type
[urkpssTest] -
a character string which denotes the type of deterministic part,
either "mu", the default, or "tau".
[urppTest] -
a character string which specifies the test type, either
"Z-alpha", the default, or "Z-tau".
[urspTest] -
a character string which specifies the test type, either
"tau", the default, or "rho".
use.lag
[urkpssTest] -
a character string specifying the number of lags. Allowed
arguments are lags=c("short", "long", "nil"), for more
information see the details section.
[urppTest] -
Use of a different lag number, specified by the user.
x
a numeric vector or time series object.
Details
Unit Root Tests from Berhard Pfaff's "urca" Package:
Elliott–Rothenberg–Stock Test for Unit Roots:
To improve the power of the unit root test, Elliot, Rothenberg and
Stock proposed a local to unity detrending of the time series. ERS
developed a feasible point optimal test, "P-test", which
takes serial correlation of the error term into account. The second
test type is the "DF-GLS" test, which is an ADF-type test
applied to the detrended data without intercept. Critical values
for this test are taken from MacKinnon in case of model="constant"
and else from Table 1 of Elliot, Rothenberg and Stock. [urca:ur.ers]
KPSS Test for Unit Roots:
Performs the KPSS unit root test, where the Null hypothesis is
stationarity. The test types specify as deterministic component
either a constant "mu" or a constant with linear trend
"tau". lags="short" sets the number of lags to
root 4 of [4 times (n/100), whereas lags="long"
sets the number of lags to root 4 of [12 times (n/100)].
If lags="nil" is choosen, then no error correction is made.
Furthermore, one can specify a different number of maximum lags
by setting use.lag accordingly. [urca:ur.kpss]
Phillips–Perron Test for Unit Roots:
Performs the Phillips and Perron unit root test. Beside the
Z statistics Z-alpha and Z-tau, the Z statistics for the
deterministic part of the test regression are computed, too.
For correction of the error term a Bartlett window is used. [urca:ur.pp]
Schmidt–Phillips Test for Unit Roots:
Performs the Schmidt and Phillips unit root test, where under
the Null and Alternative Hypothesis the coefficients of the
deterministic variables are included. Two test types are available:
the "rho-test" and the "tau-test". Both tests are
extracted from the LM principle. [urca:ur.sp]
Zivot–Andrews Test for Unit Roots:
Performs the Zivot and Andrews unit root test, which allows a
break at an unknown point in either the intercept, the linear
trend or in both. This test is based upon the recursive estimation
of a test regression. The test statistic is defined as the
minimum t-statistic of the coeffcient of the lagged endogenous
variable. [urca:ur.za]
Value
All tests return an object of class "fHTEST" with the
following slots:
@call
the function call.
@data
a data frame with the input data.
@data.name
a character string giving the name of the data frame.
@test
a list object which holds the output of the underlying
test function.
@title
a character string with the name of the test.
@description
a character string with a brief description of the
test.
The entries of the @test slot include the following components:
$statistic
the value of the test statistic.
$parameter
the lag order.
$p.value
the p-value of the test.
$method
a character string indicating what type of test was
performed.
$data.name
a character string giving the name of the data.
$alternative
a character string describing the alternative
hypothesis.
$name
the name of the underlying function, which may be wrapped.
$output
additional test results to be printed.
Note
The functions ur*Test() fullfill the naming conventions
of Rmetrics, return an S4 object named fHTEST as any other
hypothesis test from Rmetrics, and allow for timeSeries objects
as input. These are the only differences to the original implementation
of the functions.
Fur further details we refer to the manual pages of the
urca package which is required for all these.
Author(s)
Bernhard Pfaff for the tests implemented in R's "urca" package,
Diethelm Wuertz for the Rmetrics R-port.
References
Banerjee A., Dolado J.J., Galbraith J.W., Hendry D.F. (1993);
Cointegration, Error Correction, and the Econometric
Analysis of Non-Stationary Data,
Oxford University Press, Oxford.
Dickey, D.A., Fuller, W.A. (1979);
Distribution of the estimators for autoregressive time
series with a unit root,
Journal of the American Statistical Association 74, 427–431.
Kwiatkowski D., Phillips P.C.B, Schmidt P., Shin Y. (1992);
Testing the Null Hypothesis of Stationarity against
the Alternative of a Unit Root,
Journal of Econometrics 54, 159–178.
Perron P. (1988);
Trends and Random Walks in Macroeconomic Time Series,
Journal of Economic Dynamics and Control 12, 297–332.
Phillips P.C.B., Perron P. (1988);
Testing for a unit root in time series regression,
Biometrika 75, 335–346.
Said S.E., Dickey D.A. (1984);
Testing for Unit Roots in Autoregressive-Moving Average
Models of Unknown Order,
Biometrika 71, 599–607.
Schwert G.W. (1989);
Tests for Unit Roots: A Monte Carlo Investigation,
Journal of Business and Economic Statistics 2, 147–159.
Examples
## Time Series
# A time series which contains no unit-root:
x <- rnorm(1000)
# A time series which contains a unit-root:
y <- cumsum(c(0, x))
## ERS Test:
if(require("urca")) {
urersTest(x)
urersTest(y)
}