R: Hansen's Covariate-Augmented Dickey Fuller (CADF) test for...
CADFtest
R Documentation
Hansen's Covariate-Augmented Dickey Fuller (CADF) test for unit roots
Description
This function is an interface to CADFtest.default that computes the CADF unit root test
proposed in Hansen (1995). The asymptotic p-values of the test are also computed along the lines
proposed in Costantini et al. (2007). Automatic model selection is allowed. A full description
and some applications can be found in Lupi (2009).
a formula of the kind y ~ x1 + x2 containing the variable y to be tested and
the stationary covariate(s) to be used in the test. If the model is specified as
y ~ 1, then an ordinary ADF is carried out. Note that the specification
y ~ . here does not imply a model with all the disposable regressors,
but rather a model with no stationary covariate (which correspons to an ADF test).
This is because the stationary covariates have to be explicitly indicated (they
are usually one or two). An ordinary ADF is performed also if model=y
is specified, where y is a vector or a time series. It should
be noted that model is not the actual model, but rather a representation that is
used to simplify variable specification. The covariates are assumed to be stationary.
X
if model=y, a matrix or a vector time series of stationary covariates X can be passed
directly, instead of using the formula expression. However, the formula
expression should in general be preferred.
type
defines the deterministic kernel used in the test. It accepts the values used in package
urca. It specifies if the underlying model must be with linear trend ("trend", the
default), with constant ("drift") or without constant ("none").
data
data to be used (optional). This argument is effective only when model is passed as a
formula.
max.lag.y
maximum number of lags allowed for the lagged differences of the variable to be tested.
min.lag.X
if negative it is maximum lead allowed for the covariates. If zero, it is the minimum lag
allowed for the covariates.
max.lag.X
maximum lag allowed for the covariates.
dname
NULL or character. It can be used to give a special name to the model.
If the NULL default is accepted and the model is specified using a formula notation, then
dname is computed according to the used formula.
criterion
it can be either "none" (the default), "BIC", "AIC",
"HQC" or "MAIC". If criterion="none", no automatic model selection
is performed. Otherwise, automatic model selection is performed using the specified
criterion. In this case, the max and min orders serve as upper and lower bounds in the
model selection.
...
Extra arguments that can be set to use special kernels, prewhitening, etc. in the estimation of
ρ^2. A Quadratic kernel with a VAR(1) prewhitening is the default choice. To set
these extra arguments to different values, see kernHAC in package sandwich
(Zeileis, 2004, 2006). If Hansen's results have to be duplicated, then
kernel="Parzen" and prewhite=FALSE must be specified.
Value
The function returns an object of class c("CADFtest", "htest") containing:
statistic
the t test statistic.
parameter
the estimated nuisance parameter ρ^2 (see Hansen, 1995, p. 1150).
method
the test performed: it can be either ADF or CADF.
p.value
the p-value of the test.
data.name
the data name.
max.lag.y
the maximum lag of the differences of the dependent variable.
min.lag.X
the maximum lead of the stationary covariate(s).
max.lag.X
the maximum lag of the stationary covariate(s).
AIC
the value of the AIC for the selected model.
BIC
the value of the BIC for the selected model.
HQC
the value of the HQC for the selected model.
MAIC
the value of the MAIC for the selected model.
est.model
the estimated model.
estimate
the estimated value of the parameter of the lagged dependent variable.
null.value
the value of the parameter of the lagged dependent variable under the null.
Zeileis A (2004). Econometric Computing with HC and HAC
Covariance Matrix Estimators, Journal of Statistical Software, 11(10),
1–17. http://www.jstatsoft.org/v11/i10/
Zeileis A (2006). Object-Oriented Computation of Sandwich
Estimators, Journal of Statistical Software, 16(9), 1–16.
http://www.jstatsoft.org/v16/i09/.
See Also
fUnitRoots, urca
Examples
##---- ADF test on extended Nelson-Plosser data ----
##-- Data taken from package urca
data(npext, package="urca")
ADFt <- CADFtest(npext$gnpperca, max.lag.y=3, type="trend")
##---- CADF test on extended Nelson-Plosser data ----
data(npext, package="urca")
npext$unemrate <- exp(npext$unemploy) # compute unemployment rate
L <- ts(npext, start=1860) # time series of levels
D <- diff(L) # time series of diffs
S <- window(ts.intersect(L,D), start=1909) # select same sample as Hansen's
CADFt <- CADFtest(L.gnpperca~D.unemrate, data=S, max.lag.y=3,
kernel="Parzen", prewhite=FALSE)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(CADFtest)
Loading required package: dynlm
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Loading required package: sandwich
Loading required package: tseries
Loading required package: urca
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/CADFtest/CADFtest.Rd_%03d_medium.png", width=480, height=480)
> ### Name: CADFtest
> ### Title: Hansen's Covariate-Augmented Dickey Fuller (CADF) test for unit
> ### roots
> ### Aliases: CADFtest CADFtest.formula CADFtest.default
> ### Keywords: ts htest univar
>
> ### ** Examples
>
> ##---- ADF test on extended Nelson-Plosser data ----
> ##-- Data taken from package urca
> data(npext, package="urca")
> ADFt <- CADFtest(npext$gnpperca, max.lag.y=3, type="trend")
>
> ##---- CADF test on extended Nelson-Plosser data ----
> data(npext, package="urca")
> npext$unemrate <- exp(npext$unemploy) # compute unemployment rate
> L <- ts(npext, start=1860) # time series of levels
> D <- diff(L) # time series of diffs
> S <- window(ts.intersect(L,D), start=1909) # select same sample as Hansen's
> CADFt <- CADFtest(L.gnpperca~D.unemrate, data=S, max.lag.y=3,
+ kernel="Parzen", prewhite=FALSE)
>
>
>
>
>
> dev.off()
null device
1
>