Description Usage Arguments Details Value Note Author(s) References See Also Examples
Computes a nonparametric bootstrap model average test for the null hypothesis that x has a unit root against stationary, explosive, or both alternatives.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | hr.test(x = NULL,
adf.type = c("c","ct","nc","all"),
alpha = 0.05,
alternative = c("both","stationary","explosive"),
B = 399,
boot.method = c("geom","fixed","iid"),
boot.weights = FALSE,
df.type = c("nc","c","ct","nccct","ncc","nct","cct","none"),
group.start = 4,
group.by = 4,
lag.vec = NULL,
method = c("mma","jma"),
quantile.vec = c(0.005,0.01,0.025,0.05,0.95,0.975,0.99,0.995),
random.seed = 42,
S = 12,
verbose = TRUE)
|
x |
a univariate time series ( |
adf.type |
whether to include in the estimating equations Augmented Dickey-Fuller (ADF) models with no constant (nc), constant (c) or constant and trend (ct), or to include all three |
alpha |
size of the test |
alternative |
alternative hypothesis (null hypothesis is that x has a unit root) |
B |
number of bootstrap replications |
boot.method |
whether to use |
boot.weights |
logical value indicating whether to keep the weight vector constant at that for the original series or to re-estimate it for each bootstrap replication |
df.type |
whether to include in the estimating equations a Dickey-Fuller (DF) model with no constant (nc), constant (c), or constant and a trend (ct), two DF models with no constant and constant (ncc) or no constant and constant and trend (nct) or constant and constant and trend (cct), or three DF models with no constant and constant and constant and trend (nccct), or to include no DF models (none) |
group.start |
maximum lag for first starting group for Hansen's (2014) grouping of covariates |
group.by |
group size (subsequent to |
lag.vec |
optional vector of lags for the ADF estimating equations (default uses a modification of Schwert's (1989) ad hoc rule) |
method |
whether to use Hansen's (2007) Mallows model averaging criterion or Hansen and Racine's (2012) jackknife model averaging criterion |
quantile.vec |
vector of probabilities for the null quantile values returned |
random.seed |
random seed for the procedure |
S |
the constant in Schwert's (1989) ad-hoc formula for maximum lag selection |
verbose |
whether or not to display progress |
Typical usages are
1 2 3 4 5 |
The default involves taking a set of DF and ADF estimating equations (ADF contain k > 0 lags of the differenced series, DF contain 0 lags) with covariates i) the first lag of x (DF, (nc)) an ii) a constant, the first lag of x and 1 through 3, 7, and 11 lags of the differenced x (ADF, (c)). The convention to consider blocks of at least 4 regressors is adopted (Hansen (2014)). Next, take the unit root test statistics from each of the estimating equations (in each estimating equation the first difference of x is regressed on the covariates and the test statistic is the t-statistic associated with the coefficient on the first lag of x). Finally, average these statistics using either a Mallows criterion (Hansen (2007)) or a jackknife criterion (Hansen and Racine (2012)). By default, Schwert's (1989) ad-hoc rule is used to determine the maximum lag k to be used (round(S*(T/100)^0.25)
) where T is the length of x).
The null distribution of the model averaged test statistic is constructed using a model-free nonparametric bootstrap applied to the first difference of x similar to that outlined in Swensen (2003). A stationary geometric bootstrap (Politis and Romano (1994)) with automatic expected block length selection (Patton, Politis and White (2009)) is employed, and the null is imposed by taking the cumulative sum of the bootstrap values initialized to the first value of x; see vignette("bmaur", package = "hr")
for further details.
Simulations reveal that the test's size and power is quite balanced regardless of how large the number of estimating equations may be, more so than those for its peers, particularly in cases known to confound existing tests. The test displays the lowest size distortions in such cases among the range of tests considered (Phillips-Perron, Ng-Perron with modified AIC model selection, ADF with BIC model selection). Of these three peers, the Ng-Perron test exhibits the smallest size distortions in cases known to confound existing tests. Not only does our model average test have the lowest size distortions in such cases among all tests considered, but it also exhibits higher power than Ng-Perron's approach. The Phillips-Perron and ADF tests can fail to distinguish between stationary and non-stationary cases even for large samples of data (see the example below) and therefore cannot be recommended for general application. To the best of our knowledge, this is the first such unit root test to be proposed that is based on model averaging.
Note that, when the units in which a series is measured are extreme (e.g., measured in the tens of millions or billions), this may cause issues with solve.QP failing with error "constraints are inconsistent, no solution!". If this happens try normalizing your series by dividing by the mean of the series.
We use the function b.star
from the np package for the automatic dependent bootstrap procedure, solve.QP
from the quadprog package to solve the quadratic program for the model average weights), tsboot
from the boot package to generate the stationary geometric bootstrap resample, and the adfTest
function from the fUnitRoots package to generate the statistics that are averaged.
Note that the default is to test for the presence of a unit root (point null) version either a stationary or explosive alternative as we believe it is important to be agnostic about the alternative. Furthermore, when testing versus a stationary alternative, failure to reject could arise when the series contains a unit root or is explosive. This is the reason why two critical values are returned no matter what the alternative (for the one-sided alternatives they are the alpha tail critical values instead of the alpha/2 tail ones, so you can determine whether failure to reject is an indication of a unit root or an explosive series).
A list with class "hrtest" containing the following components:
adf.lags |
vector of lags used for the augmented models |
alpha |
size of test |
decision |
outcome of test |
e.block.length |
expected block length for the stationary geometric bootstrap returned by |
ma.weights |
vector of model average weights |
quantiles |
vector of nonparametric null quantiles |
reject |
1 if reject, 0 otherwise |
tau.boot |
sorted vector of bootstrapped test statistics generated under the null of a unit root |
tau.low |
lower critical value |
tau.up |
upper critical value |
tau |
model averaged test statistic |
This package is in beta status until further notice - proceed accordingly.
Jeffrey S. Racine
Dickey, D. A. & W. A. Fuller (1979), “Distribution of the estimators for autoregressive time series with a unit root,” Journal of the American Statistical Association 74(366), 427-431.
Hansen, B. E. (2007), “Least squares model averaging,” Econometrica 75, 1175-1189.
Hansen, B. E. (2014), “Model averaging, asymptotic risk, and regressor groups,” Quantitative Economics 5(3), 495-530.
Hansen, B. E. & J. S. Racine (2018), “Bootstrap Model Averaging Unit Root Inference,” Technical Report.
Hansen, B. E. & J. S. Racine (2012), “Jackknife model averaging,” Journal of Econometrics 167(1), 38-46.
Ng, S. & P. Perron (2001), “Lag length selection and the construction of unit root tests with good size and power,” Econometrica 69(6), 1519-1554.
Palm, F. C. & S. Smeekes & J. P. Urbain (2008), “Bootstrap unit-root tests: Comparison and extensions,” Journal of Time Series Analysis 29(2), 371-401.
Patton, A. & D. N. Politis & H. White (2009), “CORRECTION TO "Automatic block-length selection for the dependent bootstrap" by D. Politis and H. White”, Econometric Reviews 28(4), 372-375.
Phillips, P. C. B. & P. Perron (1988), “Testing for a unit root in time series regression,” Biometrika 75(2), 335-346.
Politis, D. N. & J. P. Romano (1994), “Limit theorems for weakly dependent Hilbert space valued random variables with applications to the stationary bootstrap”, Statistica Sinica 4, 461-476.
Politis, D. N. & H. White (2004), “Automatic block-length selection for the dependent bootstrap”, Econometric Reviews 23(1), 53-70.
Said, S. E. & D. A. Dickey (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 & Economic Statistics 7(2), 147-159.
Swensen, A. R. (2003), “Bootstrapping unit root tests for integrated processes,” Journal of Time Series Analysis 24(1), 99-126.
pp.test
, PP.test
, adf.test
, adfTest
, unitrootTest
, ur.df
, CADFtest
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Generate a series with a unit root, MA errors
set.seed(42)
T <- 100
x <- arima.sim(list(order=c(0,1,1),ma=-0.8),n=T)
## Compute the test
hr.test(x,B=99)
## The Phillips-Perron test rejects 100% of the time for this DGP
suppressPackageStartupMessages(library("tseries"))
pp.test(x)
## The ADF test with BIC model selection incorrectly rejects the null a large
## fraction of the time for this DGP
suppressPackageStartupMessages(library("CADFtest"))
CADFtest(x,max.lag.y=round(12*(T/100)^0.25),criterion="BIC",type="drift")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.