Title: | Bootstrap Unit Root Tests |
---|---|
Description: | Set of functions to perform various bootstrap unit root tests for both individual time series (including augmented Dickey-Fuller test and union tests), multiple time series and panel data; see Smeekes and Wilms (2023) <doi:10.18637/jss.v106.i12>, Palm, Smeekes and Urbain (2008) <doi:10.1111/j.1467-9892.2007.00565.x>, Palm, Smeekes and Urbain (2011) <doi:10.1016/j.jeconom.2010.11.010>, Moon and Perron (2012) <doi:10.1016/j.jeconom.2012.01.008>, Smeekes and Taylor (2012) <doi:10.1017/S0266466611000387> and Smeekes (2015) <doi:10.1111/jtsa.12110> for key references. |
Authors: | Stephan Smeekes [cre, aut] , Ines Wilms [aut] |
Maintainer: | Stephan Smeekes <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.4 |
Built: | 2024-11-17 06:34:46 UTC |
Source: | CRAN |
This function performs a standard augmented Dickey-Fuller unit root test on a single time series.
adf(data, data_name = NULL, deterministics = "intercept", min_lag = 0, max_lag = NULL, criterion = "MAIC", criterion_scale = TRUE, two_step = TRUE)
adf(data, data_name = NULL, deterministics = "intercept", min_lag = 0, max_lag = NULL, criterion = "MAIC", criterion_scale = TRUE, two_step = TRUE)
data |
A |
data_name |
Optional name for the data, to be used in the output. The default uses the name of the 'data' argument. |
deterministics |
String indicating the deterministic specification. Only relevant if
If |
min_lag |
Minimum lag length in the augmented Dickey-Fuller regression. Default is 0. |
max_lag |
Maximum lag length in the augmented Dickey-Fuller regression. Default uses the sample size-based rule |
criterion |
String for information criterion used to select the lag length in the augmented Dickey-Fuller regression. Options are: |
criterion_scale |
Logical indicator whether or not to use the rescaled information criteria of Cavaliere et al. (2015) ( |
two_step |
Logical indicator whether to use one-step ( |
The function encompasses the standard augmented Dickey-Fuller test. The reported p-values are MacKinnon's unit root p-values taken from the package urca.
Lag length selection is done automatically in the ADF regression with the specified information criterion. If one of the modified criteria of Ng and Perron (2001) is used, the correction of Perron and Qu (2008) is applied. For very short time series (fewer than 50 time points) the maximum lag length is adjusted downward to avoid potential multicollinearity issues in the bootstrap. To overwrite data-driven lag length selection with a pre-specified lag length, simply set both the minimum 'min_lag' and maximum lag length 'max_lag' for the selection algorithm equal to the desired lag length.
An object of class "bootUR"
, "htest"
with the following components:
method |
The name of the hypothesis test method; |
data.name |
The name of the variable on which the method is performed; |
null.value |
The value of the (gamma) parameter of the lagged dependent variable in the ADF regression under the null hypothesis. Under the null, the series has a unit root. Testing the null of a unit root then boils down to testing the significance of the gamma parameter; |
alternative |
A character string specifying the direction of the alternative hypothesis relative to the null value. The alternative postulates that the series is stationary; |
estimate |
The estimated value of the (gamma) parameter of the lagged dependent variable in the ADF regression; |
statistic |
The value of the test statistic of the ADF unit root test; |
p.value |
The p-value of the ADF unit root test. |
specifications |
The specifications used in the test. |
Error: Multiple time series not allowed. Switch to a multivariate method such as boot_ur, or change argument data to a univariate time series.
The function provides a standard ADF test with asymptotic p-value. It does not support multiple time series
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.
# standard ADF test on GDP_BE GDP_BE_adf <- adf(MacroTS[, 1], deterministics = "trend")
# standard ADF test on GDP_BE GDP_BE_adf <- adf(MacroTS[, 1], deterministics = "trend")
This function performs a standard augmented Dickey-Fuller bootstrap unit root test on a single time series.
boot_adf(data, data_name = NULL, bootstrap = "AWB", B = 1999, block_length = NULL, ar_AWB = NULL, deterministics = "intercept", min_lag = 0, max_lag = NULL, criterion = "MAIC", detrend = "OLS", criterion_scale = TRUE, show_progress = TRUE, do_parallel = TRUE, cores = NULL)
boot_adf(data, data_name = NULL, bootstrap = "AWB", B = 1999, block_length = NULL, ar_AWB = NULL, deterministics = "intercept", min_lag = 0, max_lag = NULL, criterion = "MAIC", detrend = "OLS", criterion_scale = TRUE, show_progress = TRUE, do_parallel = TRUE, cores = NULL)
data |
A |
data_name |
Optional name for the data, to be used in the output. The default uses the name of the 'data' argument. |
bootstrap |
String for bootstrap method to be used. Options are
|
B |
Number of bootstrap replications. Default is 1999. |
block_length |
Desired 'block length' in the bootstrap. For the MBB, BWB and DWB bootstrap, this is a genuine block length. For the AWB bootstrap, the block length is transformed into an autoregressive parameter via the formula |
ar_AWB |
Autoregressive parameter used in the AWB bootstrap method ( |
deterministics |
String indicating the deterministic specification. Only relevant if
If |
min_lag |
Minimum lag length in the augmented Dickey-Fuller regression. Default is 0. |
max_lag |
Maximum lag length in the augmented Dickey-Fuller regression. Default uses the sample size-based rule |
criterion |
String for information criterion used to select the lag length in the augmented Dickey-Fuller regression. Options are: |
detrend |
String indicating the type of detrending to be performed. Only relevant if |
criterion_scale |
Logical indicator whether or not to use the rescaled information criteria of Cavaliere et al. (2015) ( |
show_progress |
Logical indicator whether a bootstrap progress update should be printed to the console. Default is FALSE. |
do_parallel |
Logical indicator whether bootstrap loop should be executed in parallel. Default is TRUE. |
cores |
The number of cores to be used in the parallel loops. Default is to use all but one. |
The options encompass many test proposed in the literature. detrend = "OLS"
gives the standard augmented Dickey-Fuller test, while detrend = "QD"
provides the DF-GLS test of Elliott, Rothenberg and Stock (1996). The bootstrap algorithm is always based on a residual bootstrap (under the alternative) to obtain residuals rather than a difference-based bootstrap (under the null), see e.g. Palm, Smeekes and Urbain (2008).
Lag length selection is done automatically in the ADF regression with the specified information criterion. If one of the modified criteria of Ng and Perron (2001) is used, the correction of Perron and Qu (2008) is applied. For very short time series (fewer than 50 time points) the maximum lag length is adjusted downward to avoid potential multicollinearity issues in the bootstrap. To overwrite data-driven lag length selection with a pre-specified lag length, simply set both the minimum 'min_lag' and maximum lag length 'max_lag' for the selection algorithm equal to the desired lag length.
An object of class "bootUR"
, "htest"
with the following components:
method |
The name of the hypothesis test method; |
data.name |
The name of the data on which the method is performed; |
null.value |
The value of the (gamma) parameter of the lagged dependent variable in the ADF regression under the null hypothesis. Under the null, the series has a unit root. Testing the null of a unit root then boils down to testing the significance of the gamma parameter; |
alternative |
A character string specifying the direction of the alternative hypothesis relative to the null value. The alternative postulates that the series is stationary; |
estimate |
The estimated value of the (gamma) parameter of the lagged dependent variable in the ADF regression.; |
statistic |
The value of the test statistic of the unit root test; |
p.value |
The p-value of the unit root test; |
details |
A list containing the detailed outcomes of the performed test, such as selected lags, individual estimates and p-values. |
specifications |
The specifications used in the test. |
Error: Multiple time series not allowed. Switch to a multivariate method such as boot_ur, or change argument data to a univariate time series.
The function is a simple wrapper around boot_ur
to facilitate use for single time series. It does not support multiple time series, as boot_ur
is specifically suited for that.
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.
Chang, Y. and Park, J. (2003). A sieve bootstrap for the test of a unit root. Journal of Time Series Analysis, 24(4), 379-400.
Cavaliere, G. and Taylor, A.M.R (2009). Heteroskedastic time series with a unit root. Econometric Theory, 25, 1228–1276.
Cavaliere, G., Phillips, P.C.B., Smeekes, S., and Taylor, A.M.R. (2015). Lag length selection for unit root tests in the presence of nonstationary volatility. Econometric Reviews, 34(4), 512-536.
Elliott, G., Rothenberg, T.J., and Stock, J.H. (1996). Efficient tests for an autoregressive unit root. Econometrica, 64(4), 813-836.
Friedrich, M., Smeekes, S. and Urbain, J.-P. (2020). Autoregressive wild bootstrap inference for nonparametric trends. Journal of Econometrics, 214(1), 81-109.
Ng, S. and Perron, P. (2001). Lag Length Selection and the Construction of Unit Root Tests with Good Size and Power. Econometrica, 69(6), 1519-1554,
Palm, F.C., Smeekes, S. and Urbain, J.-P. (2008). Bootstrap unit root tests: Comparison and extensions. Journal of Time Series Analysis, 29(1), 371-401.
Paparoditis, E. and Politis, D.N. (2003). Residual-based block bootstrap for unit root testing. Econometrica, 71(3), 813-855.
Perron, P. and Qu, Z. (2008). A simple modification to improve the finite sample properties of Ng and Perron's unit root tests. Economic Letters, 94(1), 12-19.
Rho, Y. and Shao, X. (2019). Bootstrap-assisted unit root testing with piecewise locally stationary errors. Econometric Theory, 35(1), 142-166.
Smeekes, S. (2013). Detrending bootstrap unit root tests. Econometric Reviews, 32(8), 869-891.
Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105(489), 218-235.
Shao, X. (2011). A bootstrap-assisted spectral test of white noise under unknown dependence. Journal of Econometrics, 162, 213-224.
Smeekes, S. and Taylor, A.M.R. (2012). Bootstrap union tests for unit roots in the presence of nonstationary volatility. Econometric Theory, 28(2), 422-456.
Smeekes, S. and Urbain, J.-P. (2014a). A multivariate invariance principle for modified wild bootstrap methods with an application to unit root testing. GSBE Research Memorandum No. RM/14/008, Maastricht University
# boot_adf on GDP_BE GDP_BE_adf <- boot_adf(MacroTS[, 1], B = 199, deterministics = "trend", detrend = "OLS", do_parallel = FALSE, show_progress = FALSE) print(GDP_BE_adf)
# boot_adf on GDP_BE GDP_BE_adf <- boot_adf(MacroTS[, 1], B = 199, deterministics = "trend", detrend = "OLS", do_parallel = FALSE, show_progress = FALSE) print(GDP_BE_adf)
Controls for multiple testing by controlling the false discovery rate (FDR), see Moon and Perron (2012) and Romano, Shaikh and Wolf (2008).
boot_fdr(data, data_name = NULL, bootstrap = "AWB", B = 1999, block_length = NULL, ar_AWB = NULL, FDR_level = 0.05, union = TRUE, deterministics = NULL, detrend = NULL, min_lag = 0, max_lag = NULL, criterion = "MAIC", criterion_scale = TRUE, show_progress = TRUE, do_parallel = TRUE, cores = NULL)
boot_fdr(data, data_name = NULL, bootstrap = "AWB", B = 1999, block_length = NULL, ar_AWB = NULL, FDR_level = 0.05, union = TRUE, deterministics = NULL, detrend = NULL, min_lag = 0, max_lag = NULL, criterion = "MAIC", criterion_scale = TRUE, show_progress = TRUE, do_parallel = TRUE, cores = NULL)
data |
A |
data_name |
Optional name for the data, to be used in the output. The default uses the name of the 'data' argument. |
bootstrap |
String for bootstrap method to be used. Options are
|
B |
Number of bootstrap replications. Default is 1999. |
block_length |
Desired 'block length' in the bootstrap. For the MBB, BWB and DWB bootstrap, this is a genuine block length. For the AWB bootstrap, the block length is transformed into an autoregressive parameter via the formula |
ar_AWB |
Autoregressive parameter used in the AWB bootstrap method ( |
FDR_level |
Desired False Discovery Rate level of the unit root tests. Default is 0.05. |
union |
Logical indicator whether or not to use bootstrap union tests ( |
deterministics |
String indicating the deterministic specification. Only relevant if
If |
detrend |
String indicating the type of detrending to be performed. Only relevant if |
min_lag |
Minimum lag length in the augmented Dickey-Fuller regression. Default is 0. |
max_lag |
Maximum lag length in the augmented Dickey-Fuller regression. Default uses the sample size-based rule |
criterion |
String for information criterion used to select the lag length in the augmented Dickey-Fuller regression. Options are: |
criterion_scale |
Logical indicator whether or not to use the rescaled information criteria of Cavaliere et al. (2015) ( |
show_progress |
Logical indicator whether a bootstrap progress update should be printed to the console. Default is FALSE. |
do_parallel |
Logical indicator whether bootstrap loop should be executed in parallel. Default is TRUE. |
cores |
The number of cores to be used in the parallel loops. Default is to use all but one. |
The false discovery rate FDR is defined as the expected proportion of false rejections relative to the total number of rejections.
See boot_ur
for details on the bootstrap algorithm and lag selection.
An object of class "bootUR"
, "mult_htest"
with the following components:
method |
The name of the hypothesis test method; |
data.name |
The name of the data on which the method is performed; |
null.value |
The value of the (gamma) parameter of the lagged dependent variable in the ADF regression under the null hypothesis. Under the null, the series has a unit root. Testing the null of a unit root then boils down to testing the significance of the gamma parameter; |
alternative |
A character string specifying the direction of the alternative hypothesis relative to the null value. The alternative postulates that the series is stationary; |
estimate |
The estimated values of the (gamma) parameter of the lagged dependent variable in the ADF regressions. Note that for the union test ( |
statistic |
The value of the test statistic of the unit root tests; |
p.value |
A vector with |
rejections |
A vector with logical indicators for each time series whether the null hypothesis of a unit root is rejected ( |
details |
A list containing the detailed outcomes of the performed tests, such as selected lags, individual estimates and p-values. In addtion, the slot |
series.names |
The names of the series that the tests are performed on; |
specifications |
The specifications used in the test(s). |
Error: Resampling-based bootstraps MBB and SB cannot handle missing values.
If the time series in data
have different starting and end points (and thus some series contain NA
values at the beginning and/or end of the sample, the resampling-based moving block bootstrap (MBB) and sieve bootstrap (SB) cannot be used, as they create holes (internal missings) in the bootstrap samples. Switch to another bootstrap method or truncate your sample to eliminate NA
values.
Warning: SB and SWB bootstrap only recommended for boot_ur; see help for details.
Although the sieve bootstrap methods "SB"
and "SWB"
can be used, Smeekes and Urbain (2014b) show that these are not suited to capture general forms of dependence across units, and using them for joint or multiple testing is not valid. This warning thereofre serves to recommend the user to consider a different bootstrap method.
Warning: Deterministic specification in argument deterministics is ignored, as union test is applied.
The union test calculates the union of all four combinations of deterministic components (intercept or intercept and trend) and detrending methods (OLS or QD). Setting deterministic components manually therefore has no effect.
Warning: Detrending method in argument detrend is ignored, as union test is applied.
The union test calculates the union of all four combinations of deterministic components (intercept or intercept and trend) and detrending methods (OLS or QD). Setting detrending methods manually therefore has no effect.
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.
Chang, Y. and Park, J. (2003). A sieve bootstrap for the test of a unit root. Journal of Time Series Analysis, 24(4), 379-400.
Cavaliere, G. and Taylor, A.M.R (2009). Heteroskedastic time series with a unit root. Econometric Theory, 25, 1228–1276.
Cavaliere, G., Phillips, P.C.B., Smeekes, S., and Taylor, A.M.R. (2015). Lag length selection for unit root tests in the presence of nonstationary volatility. Econometric Reviews, 34(4), 512-536.
Elliott, G., Rothenberg, T.J., and Stock, J.H. (1996). Efficient tests for an autoregressive unit root. Econometrica, 64(4), 813-836.
Friedrich, M., Smeekes, S. and Urbain, J.-P. (2020). Autoregressive wild bootstrap inference for nonparametric trends. Journal of Econometrics, 214(1), 81-109.
Moon, H.R. and Perron, B. (2012). Beyond panel unit root tests: Using multiple testing to determine the non stationarity properties of individual series in a panel. Journal of Econometrics, 169(1), 29-33.
Ng, S. and Perron, P. (2001). Lag Length Selection and the Construction of Unit Root Tests with Good Size and Power. Econometrica, 69(6), 1519-1554,
Palm, F.C., Smeekes, S. and Urbain, J.-P. (2008). Bootstrap unit root tests: Comparison and extensions. Journal of Time Series Analysis, 29(1), 371-401.
Palm, F. C., Smeekes, S., and Urbain, J.-.P. (2011). Cross-sectional dependence robust block bootstrap panel unit root tests. Journal of Econometrics, 163(1), 85-104.
Paparoditis, E. and Politis, D.N. (2003). Residual-based block bootstrap for unit root testing. Econometrica, 71(3), 813-855.
Perron, P. and Qu, Z. (2008). A simple modification to improve the finite sample properties of Ng and Perron's unit root tests. Economic Letters, 94(1), 12-19.
Rho, Y. and Shao, X. (2019). Bootstrap-assisted unit root testing with piecewise locally stationary errors. Econometric Theory, 35(1), 142-166.
Romano, J.P., Shaikh, A.M., and Wolf, M. (2008). Control of the false discovery rate under dependence using the bootstrap and subsampling. Test, 17(3), 417.
Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105(489), 218-235.
Shao, X. (2011). A bootstrap-assisted spectral test of white noise under unknown dependence. Journal of Econometrics, 162, 213-224.
Smeekes, S. (2013). Detrending bootstrap unit root tests. Econometric Reviews, 32(8), 869-891.
Smeekes, S. and Taylor, A.M.R. (2012). Bootstrap union tests for unit roots in the presence of nonstationary volatility. Econometric Theory, 28(2), 422-456.
Smeekes, S. and Urbain, J.-P. (2014a). A multivariate invariance principle for modified wild bootstrap methods with an application to unit root testing. GSBE Research Memorandum No. RM/14/008, Maastricht University
Smeekes, S. and Urbain, J.-P. (2014b). On the applicability of the sieve bootstrap in time series panels. Oxford Bulletin of Economics and Statistics, 76(1), 139-151.
# boot_fdr on GDP_BE and GDP_DE two_series_boot_fdr <- boot_fdr(MacroTS[, 1:2], bootstrap = "MBB", B = 199, do_parallel = FALSE, show_progress = FALSE) print(two_series_boot_fdr)
# boot_fdr on GDP_BE and GDP_DE two_series_boot_fdr <- boot_fdr(MacroTS[, 1:2], bootstrap = "MBB", B = 199, do_parallel = FALSE, show_progress = FALSE) print(two_series_boot_fdr)
Performs a test on a multivariate (panel) time series by testing the null hypothesis that all series have a unit root. The test is based on averaging the individual test statistics, also called the Group-Mean (GM) test in Palm, Smeekes and Urbain (2011).
boot_panel(data, data_name = NULL, bootstrap = "AWB", B = 1999, block_length = NULL, ar_AWB = NULL, union = TRUE, union_quantile = 0.05, deterministics = NULL, detrend = NULL, min_lag = 0, max_lag = NULL, criterion = "MAIC", criterion_scale = TRUE, show_progress = TRUE, do_parallel = TRUE, cores = NULL)
boot_panel(data, data_name = NULL, bootstrap = "AWB", B = 1999, block_length = NULL, ar_AWB = NULL, union = TRUE, union_quantile = 0.05, deterministics = NULL, detrend = NULL, min_lag = 0, max_lag = NULL, criterion = "MAIC", criterion_scale = TRUE, show_progress = TRUE, do_parallel = TRUE, cores = NULL)
data |
A |
data_name |
Optional name for the data, to be used in the output. The default uses the name of the 'data' argument. |
bootstrap |
String for bootstrap method to be used. Options are
|
B |
Number of bootstrap replications. Default is 1999. |
block_length |
Desired 'block length' in the bootstrap. For the MBB, BWB and DWB bootstrap, this is a genuine block length. For the AWB bootstrap, the block length is transformed into an autoregressive parameter via the formula |
ar_AWB |
Autoregressive parameter used in the AWB bootstrap method ( |
union |
Logical indicator whether or not to use bootstrap union tests ( |
union_quantile |
The quantile of the bootstrap distribution used for scaling the individual statistics in the union. Ideally this should equal the desired significance level of the test. Default is 0.05. This parameter is overwritten when a significance level is provided in the argument |
deterministics |
String indicating the deterministic specification. Only relevant if
If |
detrend |
String indicating the type of detrending to be performed. Only relevant if |
min_lag |
Minimum lag length in the augmented Dickey-Fuller regression. Default is 0. |
max_lag |
Maximum lag length in the augmented Dickey-Fuller regression. Default uses the sample size-based rule |
criterion |
String for information criterion used to select the lag length in the augmented Dickey-Fuller regression. Options are: |
criterion_scale |
Logical indicator whether or not to use the rescaled information criteria of Cavaliere et al. (2015) ( |
show_progress |
Logical indicator whether a bootstrap progress update should be printed to the console. Default is FALSE. |
do_parallel |
Logical indicator whether bootstrap loop should be executed in parallel. Default is TRUE. |
cores |
The number of cores to be used in the parallel loops. Default is to use all but one. |
See boot_ur
for details on the bootstrap algorithm and lag selection.
An object of class "bootUR"
, "htest"
with the following components:
method |
The name of the hypothesis test method; |
data.name |
The name of the variable on which the method is performed; |
null.value |
The value of the (gamma) parameter of the lagged dependent variable in the ADF regression under the null hypothesis. Under the null, the series has a unit root. Testing the null of a unit root then boils down to testing the significance of the gamma parameter; |
alternative |
A character string specifying the direction of the alternative hypothesis relative to the null value. The alternative postulates that the series is stationary; |
estimate |
For the union test, the estimated value of the (gamma) parameter of the lagged dependent variable in the ADF regression is not defined, hence NA is given; |
statistic |
The value of the test statistic of the unit root test; |
p.value |
The p-value of the unit root test; |
details |
A list containing the detailed outcomes of the performed tests, such as selected lags, individual estimates and p-values. |
specifications |
The specifications used in the test. |
Error: Resampling-based bootstraps MBB and SB cannot handle missing values.
If the time series in data
have different starting and end points (and thus some series contain NA
values at the beginning and/or end of the sample, the resampling-based moving block bootstrap (MBB) and sieve bootstrap (SB) cannot be used, as they create holes (internal missings) in the bootstrap samples. Switch to another bootstrap method or truncate your sample to eliminate NA
values.
Warning: SB and SWB bootstrap only recommended for boot_ur; see help for details.
Although the sieve bootstrap methods "SB"
and "SWB"
can be used, Smeekes and Urbain (2014b) show that these are not suited to capture general forms of dependence across units, and using them for joint or multiple testing is not valid. This warning thereofre serves to recommend the user to consider a different bootstrap method.
Warning: Deterministic specification in argument deterministics is ignored, as union test is applied.
The union test calculates the union of all four combinations of deterministic components (intercept or intercept and trend) and detrending methods (OLS or QD). Setting deterministic components manually therefore has no effect.
Warning: Detrending method in argument detrend is ignored, as union test is applied.
The union test calculates the union of all four combinations of deterministic components (intercept or intercept and trend) and detrending methods (OLS or QD). Setting detrending methods manually therefore has no effect.
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.
Chang, Y. and Park, J. (2003). A sieve bootstrap for the test of a unit root. Journal of Time Series Analysis, 24(4), 379-400.
Cavaliere, G. and Taylor, A.M.R (2009). Heteroskedastic time series with a unit root. Econometric Theory, 25, 1228–1276.
Cavaliere, G., Phillips, P.C.B., Smeekes, S., and Taylor, A.M.R. (2015). Lag length selection for unit root tests in the presence of nonstationary volatility. Econometric Reviews, 34(4), 512-536.
Elliott, G., Rothenberg, T.J., and Stock, J.H. (1996). Efficient tests for an autoregressive unit root. Econometrica, 64(4), 813-836.
Friedrich, M., Smeekes, S. and Urbain, J.-P. (2020). Autoregressive wild bootstrap inference for nonparametric trends. Journal of Econometrics, 214(1), 81-109.
Ng, S. and Perron, P. (2001). Lag Length Selection and the Construction of Unit Root Tests with Good Size and Power. Econometrica, 69(6), 1519-1554,
Palm, F.C., Smeekes, S. and Urbain, J.-P. (2008). Bootstrap unit root tests: Comparison and extensions. Journal of Time Series Analysis, 29(1), 371-401.
Palm, F. C., Smeekes, S., and Urbain, J.-.P. (2011). Cross-sectional dependence robust block bootstrap panel unit root tests. Journal of Econometrics, 163(1), 85-104.
Paparoditis, E. and Politis, D.N. (2003). Residual-based block bootstrap for unit root testing. Econometrica, 71(3), 813-855.
Perron, P. and Qu, Z. (2008). A simple modification to improve the finite sample properties of Ng and Perron's unit root tests. Economic Letters, 94(1), 12-19.
Rho, Y. and Shao, X. (2019). Bootstrap-assisted unit root testing with piecewise locally stationary errors. Econometric Theory, 35(1), 142-166.
Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105(489), 218-235.
Shao, X. (2011). A bootstrap-assisted spectral test of white noise under unknown dependence. Journal of Econometrics, 162, 213-224.
Smeekes, S. (2013). Detrending bootstrap unit root tests. Econometric Reviews, 32(8), 869-891.
Smeekes, S. and Taylor, A.M.R. (2012). Bootstrap union tests for unit roots in the presence of nonstationary volatility. Econometric Theory, 28(2), 422-456.
Smeekes, S. and Urbain, J.-P. (2014a). A multivariate invariance principle for modified wild bootstrap methods with an application to unit root testing. GSBE Research Memorandum No. RM/14/008, Maastricht University
Smeekes, S. and Urbain, J.-P. (2014b). On the applicability of the sieve bootstrap in time series panels. Oxford Bulletin of Economics and Statistics, 76(1), 139-151.
# boot_panel on GDP_BE and GDP_DE two_series_boot_panel <- boot_panel(MacroTS[, 1:2], bootstrap = "AWB", B = 199, do_parallel = FALSE, show_progress = FALSE) print(two_series_boot_panel)
# boot_panel on GDP_BE and GDP_DE two_series_boot_panel <- boot_panel(MacroTS[, 1:2], bootstrap = "AWB", B = 199, do_parallel = FALSE, show_progress = FALSE) print(two_series_boot_panel)
Performs the Bootstrap Sequential Quantile Test (BSQT) proposed by Smeekes (2015).
boot_sqt(data, data_name = NULL, steps = 0:NCOL(data), bootstrap = "AWB", B = 1999, block_length = NULL, ar_AWB = NULL, SQT_level = 0.05, union = TRUE, deterministics = NULL, detrend = NULL, min_lag = 0, max_lag = NULL, criterion = "MAIC", criterion_scale = TRUE, show_progress = TRUE, do_parallel = TRUE, cores = NULL)
boot_sqt(data, data_name = NULL, steps = 0:NCOL(data), bootstrap = "AWB", B = 1999, block_length = NULL, ar_AWB = NULL, SQT_level = 0.05, union = TRUE, deterministics = NULL, detrend = NULL, min_lag = 0, max_lag = NULL, criterion = "MAIC", criterion_scale = TRUE, show_progress = TRUE, do_parallel = TRUE, cores = NULL)
data |
A |
data_name |
Optional name for the data, to be used in the output. The default uses the name of the 'data' argument. |
steps |
Numeric vector of quantiles or units to be tested. Default is to test each unit sequentially. |
bootstrap |
String for bootstrap method to be used. Options are
|
B |
Number of bootstrap replications. Default is 1999. |
block_length |
Desired 'block length' in the bootstrap. For the MBB, BWB and DWB bootstrap, this is a genuine block length. For the AWB bootstrap, the block length is transformed into an autoregressive parameter via the formula |
ar_AWB |
Autoregressive parameter used in the AWB bootstrap method ( |
SQT_level |
Desired significance level of the sequential tests performed. Default is 0.05. |
union |
Logical indicator whether or not to use bootstrap union tests ( |
deterministics |
String indicating the deterministic specification. Only relevant if
If |
detrend |
String indicating the type of detrending to be performed. Only relevant if |
min_lag |
Minimum lag length in the augmented Dickey-Fuller regression. Default is 0. |
max_lag |
Maximum lag length in the augmented Dickey-Fuller regression. Default uses the sample size-based rule |
criterion |
String for information criterion used to select the lag length in the augmented Dickey-Fuller regression. Options are: |
criterion_scale |
Logical indicator whether or not to use the rescaled information criteria of Cavaliere et al. (2015) ( |
show_progress |
Logical indicator whether a bootstrap progress update should be printed to the console. Default is FALSE. |
do_parallel |
Logical indicator whether bootstrap loop should be executed in parallel. Default is TRUE. |
cores |
The number of cores to be used in the parallel loops. Default is to use all but one. |
The parameter steps
can either be set as an increasing sequence of integers smaller or equal to the number of series N
, or fractions of the total number of series (quantiles). For N
time series, setting steps = 0:N
means each unit should be tested sequentially. In this case the method is equivalent to the StepM method of Romano and Wolf (2005), and therefore controls the familywise error rate. To split the series in K
equally sized groups, use steps = 0:K / K
.
By convention and in accordance with notation in Smeekes (2015), the first entry of the vector should be equal to zero, while the second entry indicates the end of the first group, and so on. If the initial 0
or final value (1
or N
) are omitted, they are automatically added by the function.
See boot_ur
for details on the bootstrap algorithm and lag selection.
An object of class "bootUR"
, "mult_htest"
with the following components:
method |
The name of the hypothesis test method; |
data.name |
The name of the data on which the method is performed; |
null.value |
The value of the (gamma) parameter of the lagged dependent variable in the ADF regression under the null hypothesis. Under the null, the series has a unit root. Testing the null of a unit root then boils down to testing the significance of the gamma parameter; |
alternative |
A character string specifying the direction of the alternative hypothesis relative to the null value. The alternative postulates that the series is stationary; |
estimate |
The estimated values of the (gamma) parameter of the lagged dependent variable in the ADF regressions. Note that for the union test ( |
statistic |
The value of the test statistic of the unit root tests; |
p.value |
A vector with |
rejections |
A vector with logical indicators for each time series whether the null hypothesis of a unit root is rejected ( |
details |
A list containing the detailed outcomes of the performed tests, such as selected lags, individual estimates and p-values. In addtion, the slot |
series.names |
The names of the series that the tests are performed on; |
specifications |
The specifications used in the tests. |
Error: Resampling-based bootstraps MBB and SB cannot handle missing values.
If the time series in data
have different starting and end points (and thus some series contain NA
values at the beginning and/or end of the sample, the resampling-based moving block bootstrap (MBB) and sieve bootstrap (SB) cannot be used, as they create holes (internal missings) in the bootstrap samples. Switch to another bootstrap method or truncate your sample to eliminate NA
values.
Error: Invalid input values for steps: must be quantiles or positive integers.
Construction of steps
does not satisfy the criteria listed under 'Details'.
Warning: SB and SWB bootstrap only recommended for boot_ur; see help for details.
Although the sieve bootstrap methods "SB"
and "SWB"
can be used, Smeekes and Urbain (2014b) show that these are not suited to capture general forms of dependence across units, and using them for joint or multiple testing is not valid. This warning thereofre serves to recommend the user to consider a different bootstrap method.
Warning: Deterministic specification in argument deterministics is ignored, as union test is applied.
The union test calculates the union of all four combinations of deterministic components (intercept or intercept and trend) and detrending methods (OLS or QD). Setting deterministic components manually therefore has no effect.
Warning: Detrending method in argument detrend is ignored, as union test is applied.
The union test calculates the union of all four combinations of deterministic components (intercept or intercept and trend) and detrending methods (OLS or QD). Setting detrending methods manually therefore has no effect.
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.
Chang, Y. and Park, J. (2003). A sieve bootstrap for the test of a unit root. Journal of Time Series Analysis, 24(4), 379-400.
Cavaliere, G. and Taylor, A.M.R (2009). Heteroskedastic time series with a unit root. Econometric Theory, 25, 1228–1276.
Cavaliere, G., Phillips, P.C.B., Smeekes, S., and Taylor, A.M.R. (2015). Lag length selection for unit root tests in the presence of nonstationary volatility. Econometric Reviews, 34(4), 512-536.
Elliott, G., Rothenberg, T.J., and Stock, J.H. (1996). Efficient tests for an autoregressive unit root. Econometrica, 64(4), 813-836.
Friedrich, M., Smeekes, S. and Urbain, J.-P. (2020). Autoregressive wild bootstrap inference for nonparametric trends. Journal of Econometrics, 214(1), 81-109.
Ng, S. and Perron, P. (2001). Lag Length Selection and the Construction of Unit Root Tests with Good Size and Power. Econometrica, 69(6), 1519-1554,
Palm, F.C., Smeekes, S. and Urbain, J.-P. (2008). Bootstrap unit root tests: Comparison and extensions. Journal of Time Series Analysis, 29(1), 371-401.
Palm, F. C., Smeekes, S., and Urbain, J.-.P. (2011). Cross-sectional dependence robust block bootstrap panel unit root tests. Journal of Econometrics, 163(1), 85-104.
Paparoditis, E. and Politis, D.N. (2003). Residual-based block bootstrap for unit root testing. Econometrica, 71(3), 813-855.
Perron, P. and Qu, Z. (2008). A simple modification to improve the finite sample properties of Ng and Perron's unit root tests. Economic Letters, 94(1), 12-19.
Rho, Y. and Shao, X. (2019). Bootstrap-assisted unit root testing with piecewise locally stationary errors. Econometric Theory, 35(1), 142-166.
Romano, J. P. and Wolf, M. (2005). Stepwise multiple testing as formalized data snooping. Econometrica, 73(4), 1237-1282. #' @references Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105(489), 218-235.
Shao, X. (2011). A bootstrap-assisted spectral test of white noise under unknown dependence. Journal of Econometrics, 162, 213-224.
Smeekes, S. (2013). Detrending bootstrap unit root tests. Econometric Reviews, 32(8), 869-891.
Smeekes, S. (2015). Bootstrap sequential tests to determine the order of integration of individual units in a time series panel. Journal of Time Series Analysis, 36(3), 398-415.
Smeekes, S. and Taylor, A.M.R. (2012). Bootstrap union tests for unit roots in the presence of nonstationary volatility. Econometric Theory, 28(2), 422-456.
Smeekes, S. and Urbain, J.-P. (2014a). A multivariate invariance principle for modified wild bootstrap methods with an application to unit root testing. GSBE Research Memorandum No. RM/14/008, Maastricht University
Smeekes, S. and Urbain, J.-P. (2014b). On the applicability of the sieve bootstrap in time series panels. Oxford Bulletin of Economics and Statistics, 76(1), 139-151.
# boot_sqt on GDP_BE and GDP_DE two_series_boot_sqt <- boot_sqt(MacroTS[, 1:2], bootstrap = "AWB", B = 199, do_parallel = FALSE, show_progress = FALSE) print(two_series_boot_sqt)
# boot_sqt on GDP_BE and GDP_DE two_series_boot_sqt <- boot_sqt(MacroTS[, 1:2], bootstrap = "AWB", B = 199, do_parallel = FALSE, show_progress = FALSE) print(two_series_boot_sqt)
Performs bootstrap unit root test based on the union of rejections of 4 tests with different number of deterministic components and different type of detrending (Harvey, Leybourne and Taylor, 2012; Smeekes and Taylor, 2012).
boot_union(data, data_name = NULL, bootstrap = "AWB", B = 1999, block_length = NULL, ar_AWB = NULL, min_lag = 0, max_lag = NULL, criterion = "MAIC", criterion_scale = TRUE, union_quantile = 0.05, show_progress = TRUE, do_parallel = TRUE, cores = NULL)
boot_union(data, data_name = NULL, bootstrap = "AWB", B = 1999, block_length = NULL, ar_AWB = NULL, min_lag = 0, max_lag = NULL, criterion = "MAIC", criterion_scale = TRUE, union_quantile = 0.05, show_progress = TRUE, do_parallel = TRUE, cores = NULL)
data |
A |
data_name |
Optional name for the data, to be used in the output. The default uses the name of the 'data' argument. |
bootstrap |
String for bootstrap method to be used. Options are
|
B |
Number of bootstrap replications. Default is 1999. |
block_length |
Desired 'block length' in the bootstrap. For the MBB, BWB and DWB bootstrap, this is a genuine block length. For the AWB bootstrap, the block length is transformed into an autoregressive parameter via the formula |
ar_AWB |
Autoregressive parameter used in the AWB bootstrap method ( |
min_lag |
Minimum lag length in the augmented Dickey-Fuller regression. Default is 0. |
max_lag |
Maximum lag length in the augmented Dickey-Fuller regression. Default uses the sample size-based rule |
criterion |
String for information criterion used to select the lag length in the augmented Dickey-Fuller regression. Options are: |
criterion_scale |
Logical indicator whether or not to use the rescaled information criteria of Cavaliere et al. (2015) ( |
union_quantile |
The quantile of the bootstrap distribution used for scaling the individual statistics in the union. Ideally this should equal the desired significance level of the test. Default is 0.05. This parameter is overwritten when a significance level is provided in the argument |
show_progress |
Logical indicator whether a bootstrap progress update should be printed to the console. Default is FALSE. |
do_parallel |
Logical indicator whether bootstrap loop should be executed in parallel. Default is TRUE. |
cores |
The number of cores to be used in the parallel loops. Default is to use all but one. |
The union is taken over the combination of tests with intercept only and intercept plus trend, coupled with OLS detrending and QD detrending, as in Harvey, Leybourne and Taylor (2012) and Smeekes an Taylor (2012). The bootstrap algorithm is always based on a residual bootstrap (under the alternative) to obtain residuals rather than a difference-based bootstrap (under the null), see e.g. Palm, Smeekes and Urbain (2008).
Lag length selection is done automatically in the ADF regressions with the specified information criterion. If one of the modified criteria of Ng and Perron (2001) is used, the correction of Perron and Qu (2008) is applied. To overwrite data-driven lag length selection with a pre-specified lag length, simply set both the minimum 'min_lag' and maximum lag length 'max_lag' for the selection algorithm equal to the desired lag length.
An object of class "bootUR"
, "htest"
with the following components:
method |
The name of the hypothesis test method; |
data.name |
The name of the variable on which the method is performed; |
null.value |
The value of the (gamma) parameter of the lagged dependent variable in the ADF regression under the null hypothesis. Under the null, the series has a unit root. Testing the null of a unit root then boils down to testing the significance of the gamma parameter; |
alternative |
A character string specifying the direction of the alternative hypothesis relative to the null value. The alternative postulates that the series is stationary; |
estimate |
For the union test, the estimated value of the (gamma) parameter of the lagged dependent variable in the ADF regression is not defined, hence NA is given; |
statistic |
The value of the test statistic of the unit root test; |
p.value |
The p-value of the unit root test; |
details |
A list containing the detailed outcomes of the performed tests, such as selected lags, individual estimates and p-values. |
specifications |
The specifications used in the test. |
Error: Multiple time series not allowed. Switch to a multivariate method such as boot_ur, or change argument data to a univariate time series.
The function is a simple wrapper around boot_ur
to facilitate use for single time series. It does not support multiple time series, as boot_ur
is specifically suited for that.
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.
Chang, Y. and Park, J. (2003). A sieve bootstrap for the test of a unit root. Journal of Time Series Analysis, 24(4), 379-400.
Cavaliere, G. and Taylor, A.M.R (2009). Heteroskedastic time series with a unit root. Econometric Theory, 25, 1228–1276.
Cavaliere, G., Phillips, P.C.B., Smeekes, S., and Taylor, A.M.R. (2015). Lag length selection for unit root tests in the presence of nonstationary volatility. Econometric Reviews, 34(4), 512-536.
Friedrich, M., Smeekes, S. and Urbain, J.-P. (2020). Autoregressive wild bootstrap inference for nonparametric trends. Journal of Econometrics, 214(1), 81-109.
Harvey, D.I., Leybourne, S.J., and Taylor, A.M.R. (2012). Testing for unit roots in the presence of uncertainty over both the trend and initial condition. Journal of Econometrics, 169(2), 188-195.
Ng, S. and Perron, P. (2001). Lag Length Selection and the Construction of Unit Root Tests with Good Size and Power. Econometrica, 69(6), 1519-1554,
Palm, F.C., Smeekes, S. and Urbain, J.-P. (2008). Bootstrap unit root tests: Comparison and extensions. Journal of Time Series Analysis, 29(1), 371-401.
Paparoditis, E. and Politis, D.N. (2003). Residual-based block bootstrap for unit root testing. Econometrica, 71(3), 813-855.
Perron, P. and Qu, Z. (2008). A simple modification to improve the finite sample properties of Ng and Perron's unit root tests. Economic Letters, 94(1), 12-19.
Rho, Y. and Shao, X. (2019). Bootstrap-assisted unit root testing with piecewise locally stationary errors. Econometric Theory, 35(1), 142-166.
Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105(489), 218-235.
Shao, X. (2011). A bootstrap-assisted spectral test of white noise under unknown dependence. Journal of Econometrics, 162, 213-224.
Smeekes, S. (2013). Detrending bootstrap unit root tests. Econometric Reviews, 32(8), 869-891.
Smeekes, S. and Taylor, A.M.R. (2012). Bootstrap union tests for unit roots in the presence of nonstationary volatility. Econometric Theory, 28(2), 422-456.
Smeekes, S. and Urbain, J.-P. (2014a). A multivariate invariance principle for modified wild bootstrap methods with an application to unit root testing. GSBE Research Memorandum No. RM/14/008, Maastricht University
# boot_union on GDP_BE GDP_BE_df <- boot_union(MacroTS[, 1], B = 199, do_parallel = FALSE, show_progress = FALSE) print(GDP_BE_df)
# boot_union on GDP_BE GDP_BE_df <- boot_union(MacroTS[, 1], B = 199, do_parallel = FALSE, show_progress = FALSE) print(GDP_BE_df)
This function performs bootstrap unit root tests on each time series individually.
boot_ur(data, data_name = NULL, bootstrap = "AWB", B = 1999, block_length = NULL, ar_AWB = NULL, level = NULL, union = TRUE, union_quantile = 0.05, deterministics = NULL, detrend = NULL, min_lag = 0, max_lag = NULL, criterion = "MAIC", criterion_scale = TRUE, show_progress = TRUE, do_parallel = TRUE, cores = NULL)
boot_ur(data, data_name = NULL, bootstrap = "AWB", B = 1999, block_length = NULL, ar_AWB = NULL, level = NULL, union = TRUE, union_quantile = 0.05, deterministics = NULL, detrend = NULL, min_lag = 0, max_lag = NULL, criterion = "MAIC", criterion_scale = TRUE, show_progress = TRUE, do_parallel = TRUE, cores = NULL)
data |
A |
data_name |
Optional name for the data, to be used in the output. The default uses the name of the 'data' argument. |
bootstrap |
String for bootstrap method to be used. Options are
|
B |
Number of bootstrap replications. Default is 1999. |
block_length |
Desired 'block length' in the bootstrap. For the MBB, BWB and DWB bootstrap, this is a genuine block length. For the AWB bootstrap, the block length is transformed into an autoregressive parameter via the formula |
ar_AWB |
Autoregressive parameter used in the AWB bootstrap method ( |
level |
The desired significance level of the test (optional). This is only used for multivariate series to be able to provide a boolean vector with rejections of the null hypothesis or not for easy post-processing. Default is |
union |
Logical indicator whether or not to use bootstrap union tests ( |
union_quantile |
The quantile of the bootstrap distribution used for scaling the individual statistics in the union. Ideally this should equal the desired significance level of the test. Default is 0.05. This parameter is overwritten when a significance level is provided in the argument |
deterministics |
String indicating the deterministic specification. Only relevant if
If |
detrend |
String indicating the type of detrending to be performed. Only relevant if |
min_lag |
Minimum lag length in the augmented Dickey-Fuller regression. Default is 0. |
max_lag |
Maximum lag length in the augmented Dickey-Fuller regression. Default uses the sample size-based rule |
criterion |
String for information criterion used to select the lag length in the augmented Dickey-Fuller regression. Options are: |
criterion_scale |
Logical indicator whether or not to use the rescaled information criteria of Cavaliere et al. (2015) ( |
show_progress |
Logical indicator whether a bootstrap progress update should be printed to the console. Default is FALSE. |
do_parallel |
Logical indicator whether bootstrap loop should be executed in parallel. Default is TRUE. |
cores |
The number of cores to be used in the parallel loops. Default is to use all but one. |
The options encompass many test proposed in the literature. detrend = "OLS"
gives the standard augmented Dickey-Fuller test, while detrend = "QD"
provides the DF-GLS test of Elliott, Rothenberg and Stock (1996). The bootstrap algorithm is always based on a residual bootstrap (under the alternative) to obtain residuals rather than a difference-based bootstrap (under the null), see e.g. Palm, Smeekes and Urbain (2008).
Lag length selection is done automatically in the ADF regression with the specified information criterion. If one of the modified criteria of Ng and Perron (2001) is used, the correction of Perron and Qu (2008) is applied. For very short time series (fewer than 50 time points) the maximum lag length is adjusted downward to avoid potential multicollinearity issues in the bootstrap. To overwrite data-driven lag length selection with a pre-specified lag length, simply set both the minimum 'min_lag' and maximum lag length 'max_lag' for the selection algorithm equal to the desired lag length.
An object of class "bootUR"
, "\*"
, where "\*"
is "mult_htest"
for multiple time series or "htest"
for single time series, with the following components:
method |
The name of the hypothesis test method; |
data.name |
The name of the data on which the method is performed; |
null.value |
The value of the (gamma) parameter of the lagged dependent variable in the ADF regression under the null hypothesis. Under the null, the series has a unit root. Testing the null of a unit root then boils down to testing the significance of the gamma parameter; |
alternative |
A character string specifying the direction of the alternative hypothesis relative to the null value. The alternative postulates that the series is stationary; |
estimate |
The estimated value(s) of the (gamma) parameter of the lagged dependent variable in the ADF regressions. Note that for the union test ( |
statistic |
The value(s) of the test statistic of the unit root test(s); |
p.value |
The p-value(s) of the unit root test(s); |
rejections |
For |
details |
A list containing the detailed outcomes of the performed tests, such as selected lags, individual estimates and p-values. |
series.names |
For |
specifications |
The specifications used in the test(s). |
The function may give the following warnings.
Warning: Missing values cause resampling bootstrap to be executed for each time series individually.
If the time series in data
have different starting and end points (and thus some series contain NA
values at the beginning and/or end of the sample, the resampling-based moving block bootstrap (MBB) and sieve bootstrap (SB) cannot be used directly, as they create holes (internal missings) in the bootstrap samples. These bootstrap methods are therefore not applied jointly as usual, but individually to each series.
Warning: Deterministic specification in argument deterministics is ignored, as union test is applied.
The union test calculates the union of all four combinations of deterministic components (intercept or intercept and trend) and detrending methods (OLS or QD). Setting deterministic components manually therefore has no effect.
Warning: Detrending method in argument detrend is ignored, as union test is applied.
The union test calculates the union of all four combinations of deterministic components (intercept or intercept and trend) and detrending methods (OLS or QD). Setting detrending methods manually therefore has no effect.
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.
Chang, Y. and Park, J. (2003). A sieve bootstrap for the test of a unit root. Journal of Time Series Analysis, 24(4), 379-400.
Cavaliere, G. and Taylor, A.M.R (2009). Heteroskedastic time series with a unit root. Econometric Theory, 25, 1228–1276.
Cavaliere, G., Phillips, P.C.B., Smeekes, S., and Taylor, A.M.R. (2015). Lag length selection for unit root tests in the presence of nonstationary volatility. Econometric Reviews, 34(4), 512-536.
Elliott, G., Rothenberg, T.J., and Stock, J.H. (1996). Efficient tests for an autoregressive unit root. Econometrica, 64(4), 813-836.
Friedrich, M., Smeekes, S. and Urbain, J.-P. (2020). Autoregressive wild bootstrap inference for nonparametric trends. Journal of Econometrics, 214(1), 81-109.
Ng, S. and Perron, P. (2001). Lag Length Selection and the Construction of Unit Root Tests with Good Size and Power. Econometrica, 69(6), 1519-1554,
Palm, F.C., Smeekes, S. and Urbain, J.-P. (2008). Bootstrap unit root tests: Comparison and extensions. Journal of Time Series Analysis, 29(1), 371-401.
Palm, F. C., Smeekes, S., and Urbain, J.-.P. (2011). Cross-sectional dependence robust block bootstrap panel unit root tests. Journal of Econometrics, 163(1), 85-104.
Paparoditis, E. and Politis, D.N. (2003). Residual-based block bootstrap for unit root testing. Econometrica, 71(3), 813-855.
Perron, P. and Qu, Z. (2008). A simple modification to improve the finite sample properties of Ng and Perron's unit root tests. Economic Letters, 94(1), 12-19.
Rho, Y. and Shao, X. (2019). Bootstrap-assisted unit root testing with piecewise locally stationary errors. Econometric Theory, 35(1), 142-166.
Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105(489), 218-235.
Shao, X. (2011). A bootstrap-assisted spectral test of white noise under unknown dependence. Journal of Econometrics, 162, 213-224.
Smeekes, S. (2013). Detrending bootstrap unit root tests. Econometric Reviews, 32(8), 869-891.
Smeekes, S. and Taylor, A.M.R. (2012). Bootstrap union tests for unit roots in the presence of nonstationary volatility. Econometric Theory, 28(2), 422-456.
Smeekes, S. and Urbain, J.-P. (2014a). A multivariate invariance principle for modified wild bootstrap methods with an application to unit root testing. GSBE Research Memorandum No. RM/14/008, Maastricht University
# boot_ur on GDP_BE and GDP_DE two_series_boot_ur <- boot_ur(MacroTS[, 1:2], bootstrap = "MBB", B = 199, do_parallel = FALSE, show_progress = FALSE) print(two_series_boot_ur)
# boot_ur on GDP_BE and GDP_DE two_series_boot_ur <- boot_ur(MacroTS[, 1:2], bootstrap = "MBB", B = 199, do_parallel = FALSE, show_progress = FALSE) print(two_series_boot_ur)
Check Missing Values in Sample
check_missing_insample_values(X)
check_missing_insample_values(X)
X |
A ( |
-dimensional vector, for each series whether missing values are present (
TRUE
) or not (FALSE
)
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.
Performs differencing of multiple time series, with possibly different orders for each time series.
diff_mult(data, d, keep_NAs = TRUE)
diff_mult(data, d, keep_NAs = TRUE)
data |
A ( |
d |
An |
keep_NAs |
Logical indicator whether or not to keep the |
The appropriately differenced data in the same format as the original data.
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.
Find Non-Missing Subsamples
find_nonmissing_subsample(X)
find_nonmissing_subsample(X)
X |
A ( |
A list with the following components
range |
(2x |
all_equal |
Logical value indicating whether all series have the same non-missing indices. |
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.
Macroeconomic data from Eurostat on GDP, consumption, inflation and unemployment for Belgium, Germany, France, the Netherlands and the United Kingdom.
MacroTS
MacroTS
A time series object containing 20 macroeconomic seasonally adjusted time series, quarterly observed from 1992-2019 for Belgium (BE), Germany (DE), France (FR), the Netherlands (NL) and the United Kingdom (UK).
GDP_BE
Gross domestic product at market prices (index, 2015=100) for Belgium.
GDP_DE
Gross domestic product at market prices (index, 2015=100) for Germany.
GDP_FR
Gross domestic product at market prices (index, 2015=100) for France.
GDP_NL
Gross domestic product at market prices (index, 2015=100) for the Netherlands.
GDP_UK
Gross domestic product at market prices (index, 2015=100) for the United Kingdom.
CONS_BE
Final consumption expenditure (index, 2015=100) for Belgium.
CONS_DE
Final consumption expenditure (index, 2015=100) for Germany.
CONS_FR
Final consumption expenditure (index, 2015=100) for France.
CONS_NL
Final consumption expenditure (index, 2015=100) for the Netherlands.
CONS_UK
Final consumption expenditure (index, 2015=100) for the United Kingdom.
HICP_BE
Harmonised Indices of Consumer Prices (annual rate of change, 2015=100) for Belgium.
HICP_DE
Harmonised Indices of Consumer Prices (annual rate of change, 2015=100) for Germany.
HICP_FR
Harmonised Indices of Consumer Prices (annual rate of change, 2015=100) for France.
HICP_N
Harmonised Indices of Consumer Prices (annual rate of change, 2015=100) for the Netherlands.
HICP_UK
Harmonised Indices of Consumer Prices (annual rate of change, 2015=100) for the United Kingdom.
UR_BE
Unemployment rate (percentage of the active population) for Belgium.
UR_DE
Unemployment rate (percentage of the active population) for Germany.
UR_FR
Unemployment rate (percentage of the active population) for France.
UR_NL
Unemployment rate (percentage of the active population) for the Netherlands.
UR_UK
Unemployment rate (percentage of the active population) for the United Kingdom.
Unemployment rates are seasonally but not calendar adjusted, all other series are both seasonally and calendar adjusted.
Quarterly inflation rates are sampled from Eurostat's monthly series with annual rates of change as the final month of the respective quarter.
The unemployment rate for France excludes overseas territories ('France continental' in the Eurostat database).
https://ec.europa.eu/eurostat/data/database
Determines the order of integration for each time series in a dataset via a sequence of unit root tests, and differences the data accordingly to eliminate stochastic trends.
order_integration(data, max_order = 2, method = "boot_ur", level = 0.05, plot_orders = FALSE, data_name = NULL, ...)
order_integration(data, max_order = 2, method = "boot_ur", level = 0.05, plot_orders = FALSE, data_name = NULL, ...)
data |
A ( |
max_order |
The maximum order of integration of the time series. Default is 2. |
method |
The unit root tests to be used in the procedure. For multiple time series the options are "boot_ur", "boot_sqt" and "boot_fdr", with "boot_ur" the default. For single time series the options are "adf", boot_adf", "boot_union" and "boot_ur", with the latter the default. |
level |
Desired significance level of the unit root test. Default is 0.05. |
plot_orders |
Logical indicator whether the resulting orders of integration should be plotted. Default is |
data_name |
Optional name for the data, to be used in the output. The default uses the name of the 'data' argument. |
... |
Optional arguments passed to the chosen unit root test function. |
The function follows the approach laid out in Smeekes and Wijler (2020), where all series is differenced times, where
is the specified maximum order, and these differenced series are tested for unit roots. The series for which the unit root null is not rejected, are classified as
and removed from consideration. The remaining series are integrated, and tested for unit roots again, leading to a classification of
series if the null is not rejected. This is continued until a non-rejection is observed for all time series, or the series are integrated back to their original level. The series for which the null hypothesis is rejected in the final stage are classified as
.
Care must be taken when using boot_sqt
when the argument steps
is given as a sequence of integers. As at each step series are removed, one may end up with fewer series to test than indicated in steps
. While integers larger than the number of series will automatically be removed - along with a warning - by the test, it is recommend to set steps
in the form of quantiles.
Plotting the orders of integration requires the ggplot2
package to be installed; plot will be skipped and a warning is given if not. For plots the function plot_order_integration
is called. The user may prefer to set plot_orders = FALSE
and call this function directly using the returned value of order_int
in order to have more control over plot settings and save the plot object.
An object of class "bootUR", "order_integration"
with the following components
order_int |
A vector with the found orders of integration of each time series. |
diff_data |
The appropriately differenced data according to |
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.
Smeekes, S. and Wijler, E. (2020). Unit roots and cointegration. In P. Fuleky (Ed.) Macroeconomic Forecasting in the Era of Big Data, Chapter 17, pp. 541-584. Advanced Studies in Theoretical and Applied Econometrics, vol. 52. Springer.
# Use "boot_ur" to determine the order of GDP_BE and GDP_DE orders_tseries <- order_integration(MacroTS[, 1:2], method = "boot_ur", B = 199, do_parallel = FALSE, show_progress = FALSE)
# Use "boot_ur" to determine the order of GDP_BE and GDP_DE orders_tseries <- order_integration(MacroTS[, 1:2], method = "boot_ur", B = 199, do_parallel = FALSE, show_progress = FALSE)
Plots missing values of different types for a time series dataset.
plot_missing_values(y, show_names = FALSE, show_legend = TRUE, axis_text_size = NULL, legend_size = NULL, cols = NULL)
plot_missing_values(y, show_names = FALSE, show_legend = TRUE, axis_text_size = NULL, legend_size = NULL, cols = NULL)
y |
A ( |
show_names |
Show the time series' names on the plot ( |
show_legend |
Logical indicator whether a legend should be displayed. Default is |
axis_text_size |
Size of the text on the axis. Default takes |
legend_size |
Size of the text in the legend if |
cols |
Vector with colours for displaying the different types of data. If the default is overwritten, four colours must be supplied. |
The function distinguish four types of data: observed data (non-missing) and three missing types. Type "Balanced NA"
indicates where entire rows are missing (NA
). These do not cause unbalancedness as the missing rows can simply be deleted. Type "Unbalanced NA"
are missing values on the beginning or end of the sample, which cause unbalancedness. These affect some (but not all) bootstrap methods, see e.g.~boot_fdr
. Type "Internal NA"
are missing values inside the sample, which need to be removed before the bootstrap unit root tests can be used.
This function requires the package ggplot2
to be installed. If the package is not found, plotting is aborted.
A ggplot2
object containing the missing values plot.
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.
Plots a vector with orders of integration of time series.
plot_order_integration(orders, show_names = TRUE, show_legend = TRUE, names_size = NULL, legend_size = NULL, cols = NULL)
plot_order_integration(orders, show_names = TRUE, show_legend = TRUE, names_size = NULL, legend_size = NULL, cols = NULL)
orders |
A |
show_names |
Show the time series' names on the plot ( |
show_legend |
Logical indicator whether a legend should be displayed. Default is |
names_size |
Size of the time series' names if |
legend_size |
Size of the text in the legend if |
cols |
Vector with colours for displaying the orders of integration. At least as many colours as orders of integration need to be supplied. Default supplies 4 colours for displaying up to |
This function requires the package ggplot2
to be installed. If the package is not found, plotting is aborted.
A ggplot2
object containing the plot of the orders of integration.
Smeekes, S. and Wilms, I. (2023). bootUR: An R Package for Bootstrap Unit Root Tests. Journal of Statistical Software, 106(12), 1-39.