radf_wb_cv performs the Phillips & Shi (2020) wild bootstrap re-sampling
scheme, which is asymptotically robust to non-stationary volatility, to
generate critical values for the recursive unit root tests. radf_wb_distr2
computes the distribution.
A univariate or multivariate numeric time series object, a numeric vector or matrix, or a data.frame. The object should not have any NA values.
A positive integer. The minimum window size (default = \((0.01 + 1.8/\sqrt(T))T\), where T denotes the sample size).
A positive integer. Number of bootstraps (default = 500L).
A positive integer. Number of lags when type is "fixed" or number of max lags when type is either "aic" or "bic".
Character. "fixed" for fixed lag, "aic" or "bic" for automatic lag selection according to the criterion.
A positive integer. The simulated sample size.
An object specifying if and how the random number generator (rng)
should be initialized. Either NULL or an integer will be used in a call to
set.seed before simulation. If set, the value is saved as "seed" attribute
of the returned value. The default, NULL, will not change rng state, and
return .Random.seed as the "seed" attribute. Results are different between
the parallel and non-parallel option, even if they have the same seed.
For radf_wb_cv2 a list that contains the critical values for the ADF,
BADF, BSADF and GSADF tests. For radf_wb_distr a list that
contains the ADF, SADF and GSADF distributions.
Phillips, P. C., & Shi, S. (2020). Real time monitoring of asset markets: Bubbles and crises. In Handbook of Statistics (Vol. 42, pp. 61-80). Elsevier.
Phillips, P. C. B., Shi, S., & Yu, J. (2015). Testing for Multiple Bubbles: Historical Episodes of Exuberance and Collapse in the S&P 500. International Economic Review, 56(4), 1043-1078.
radf_mc_cv for Monte Carlo critical values and
radf_sb_cv for sieve bootstrap critical values.
# \donttest{
# Default minimum window
wb <- radf_wb_cv2(sim_data)
tidy(wb)
#> # A tibble: 15 × 5
#>    id    sig       adf  sadf gsadf
#>    <fct> <fct>   <dbl> <dbl> <dbl>
#>  1 psy1  90    -0.470   1.21  1.98
#>  2 psy2  90    -0.304   1.48  2.55
#>  3 evans 90    -0.263   1.74  2.95
#>  4 div   90    -0.448   1.05  1.99
#>  5 blan  90    -0.369   1.45  2.55
#>  6 psy1  95    -0.0798  1.55  2.42
#>  7 psy2  95     0.0615  2.03  2.98
#>  8 evans 95     0.0871  2.23  3.78
#>  9 div   95    -0.108   1.43  2.34
#> 10 blan  95    -0.0404  1.93  3.03
#> 11 psy1  99     0.538   2.37  3.25
#> 12 psy2  99     0.666   3.09  3.67
#> 13 evans 99     0.758   4.14  5.79
#> 14 div   99     0.458   1.97  3.18
#> 15 blan  99     0.508   3.77  4.63
# Change the minimum window and the number of bootstraps
wb2 <- radf_wb_cv2(sim_data, nboot = 600, minw = 20)
tidy(wb2)
#> # A tibble: 15 × 5
#>    id    sig       adf  sadf gsadf
#>    <fct> <fct>   <dbl> <dbl> <dbl>
#>  1 psy1  90    -0.233   1.26  2.05
#>  2 psy2  90    -0.429   1.30  2.42
#>  3 evans 90    -0.459   1.52  2.83
#>  4 div   90    -0.494   1.09  1.89
#>  5 blan  90    -0.363   1.25  2.38
#>  6 psy1  95     0.0202  1.67  2.47
#>  7 psy2  95    -0.150   1.75  2.96
#>  8 evans 95    -0.193   2.03  3.33
#>  9 div   95    -0.0832  1.35  2.39
#> 10 blan  95    -0.0386  1.66  2.91
#> 11 psy1  99     0.711   2.29  3.49
#> 12 psy2  99     0.350   3.28  4.03
#> 13 evans 99     0.511   3.28  5.28
#> 14 div   99     0.620   2.13  3.31
#> 15 blan  99     0.475   2.91  4.41
# Simulate distribution
wdist <- radf_wb_distr(sim_data)
autoplot(wdist)
# }