Title: | Test and Detection of Explosive Behaviors for Time Series |
---|---|
Description: | Provides the Augmented Dickey-Fuller test and its variations to check the existence of bubbles (explosive behavior) for time series, based on the article by Peter C. B. Phillips, Shuping Shi and Jun Yu (2015a) <doi:10.1111/iere.12131>. Some functions may take a while depending on the size of the data used, or the number of Monte Carlo replications applied. |
Authors: | Pedro Araujo <[email protected]> Gustavo Lacerda <[email protected]> Peter C.B. Phillips <[email protected]> Shu-Ping Shi <[email protected]> |
Maintainer: | Pedro Araujo <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.2.0 |
Built: | 2025-02-18 06:12:15 UTC |
Source: | https://github.com/cran/MultipleBubbles |
Calculate the Augmented Dickey-Fuller Statistic with a fixed lag order .
ADF_FL(y, adflag = 0, mflag = 1)
ADF_FL(y, adflag = 0, mflag = 1)
y |
the time series to be used. |
adflag |
is the lag order. |
mflag |
1 for ADF with constant and whithout trend, 2 for ADF with constant and trend and 3 for ADF without constant and trend. |
Phillips, P.C. & Shi, S. & Yu, J. (2015a). "Testing for Multiple Bubbles: Historical Episodes of Exuberance and Collapse in the S&P 500". SSRN Electronic Journal.
y <- rnorm(10) ADF_FL(y, adflag = 1, mflag = 2)
y <- rnorm(10) ADF_FL(y, adflag = 1, mflag = 2)
Calculate the Augmented Dickey-Fuller Statistic with lag order selected by AIC or BIC.
ADF_IC(y, adflag, mflag, IC)
ADF_IC(y, adflag, mflag, IC)
y |
the time series to be used. |
adflag |
the maximum lag order. |
mflag |
1 for ADF with constant and whithout trend, 2 for ADF with constant and trend and 3 for ADF without constant and trend. |
IC |
1 for AIC and 2 for BIC. |
Phillips, P.C. & Shi, S. & Yu, J. (2013). "Testing for Multiple Bubbles: Historical Episodes of Exuberance and Collapse in the S&P 500". SSRN Electronic Journal.
y <- rnorm(10) ADF_IC(y, adflag = 1, mflag = 2, IC = 1) ADF_IC(y, adflag = 1, mflag = 2, IC = 2)
y <- rnorm(10) ADF_IC(y, adflag = 1, mflag = 2, IC = 1) ADF_IC(y, adflag = 1, mflag = 2, IC = 2)
In this program, we calculate critical value sequences for the backward ADF statistic sequence for a matrix generated from a standard Normal distribution.
badf(m, t, adflag = 0, mflag = 1)
badf(m, t, adflag = 0, mflag = 1)
m |
Number of Monte Carlo replications. Must be bigger than 2. |
t |
Sample size. Must be bigger than 2. |
adflag |
Number of lags to be included in the ADF Test. Default equals 0. |
mflag |
1 for ADF with constant and whithout trend, 2 for ADF with constant and trend and 3 for ADF without constant and trend. |
Phillips, P.C. & Shi, S. & Yu, J. (2015a). "Testing for Multiple Bubbles: Historical Episodes of Exuberance and Collapse in the S&P 500". SSRN Electronic Journal.
foo <- badf(m = 100, t = 50, adflag = 1, mflag = 1) plot(foo$quantiles[2,], type = 'l')
foo <- badf(m = 100, t = 50, adflag = 1, mflag = 1) plot(foo$quantiles[2,], type = 'l')
Calculate critical value sequences for the backward sup ADF statistic sequence using Monte Carlo simulations for a sample generated from a Normal distribution.
bsadf(m, t, adflag = 0, mflag = 1)
bsadf(m, t, adflag = 0, mflag = 1)
m |
Number of Monte Carlo Simulations |
t |
Sample size. |
adflag |
is the lag order. |
mflag |
1 for ADF with constant and whithout trend, 2 for ADF with constant and trend and 3 for ADF without constant and trend.#' @keywords AugmentedDickey-FullerTest backwardSADF MonteCarlo. |
Phillips, P.C. & Shi, S. & Yu, J. (2015a). "Testing for Multiple Bubbles: Historical Episodes of Exuberance and Collapse in the S&P 500". SSRN Electronic Journal.
foo <- bsadf(m = 20, t = 50, adflag = 1, mflag = 2) plot(foo$quantiles[2,], type = 'l')
foo <- bsadf(m = 20, t = 50, adflag = 1, mflag = 2) plot(foo$quantiles[2,], type = 'l')
Generate a random walk with drift 1/n.
DGP(n, niter)
DGP(n, niter)
n |
sample size. Number of rows in the generated matrix. |
niter |
number of columns in the generated matrix. |
DGP(n = 100, niter = 10)
DGP(n = 100, niter = 10)
Calculate critical value sequences for the generalized sup ADF statistic sequence using Monte Carlo simulations for a sample generated from a Normal distribution.
gsadf(m, t, adflag = 0, mflag = 1, swindow0 = floor(r0 * t))
gsadf(m, t, adflag = 0, mflag = 1, swindow0 = floor(r0 * t))
m |
Number of Monte Carlo Simulations. Default equals 2000. Must be bigger than 2. |
t |
Sample size. Default equals 100. Must be bigger than 2. |
adflag |
Number of lags to be included in the ADF Test. Default equals 0. |
mflag |
1 for ADF with constant and whithout trend, 2 for ADF with constant and trend and 3 for ADF without constant and trend. |
swindow0 |
Minimum window size. |
Phillips, P.C. & Shi, S. & Yu, J. (2015a). "Testing for Multiple Bubbles: Historical Episodes of Exuberance and Collapse in the S&P 500". SSRN Electronic Journal.
foo <- gsadf(m = 20, t = 50) quant <- rep(foo$quantiles[2], 100) plot(quant, type = 'l')
foo <- gsadf(m = 20, t = 50) quant <- rep(foo$quantiles[2], 100) plot(quant, type = 'l')
Calculate critical value sequences for the sup ADF statistic sequence using Monte Carlo simulations for a sample generated from a Normal distribution.
sadf(m, t)
sadf(m, t)
m |
Number of Monte Carlo Simulations. Default equals 2000. Must be bigger than 2. |
t |
Sample size. Default equals 100. Must be bigger than 2. |
Phillips, P.C. & Shi, S. & Yu, J. (2015a). "Testing for Multiple Bubbles: Historical Episodes of Exuberance and Collapse in the S&P 500". SSRN Electronic Journal.
foo <- sadf(m = 20, t = 50) quant <- rep(foo$quantiles[2], 100) plot(quant, type = 'l')
foo <- sadf(m = 20, t = 50) quant <- rep(foo$quantiles[2], 100) plot(quant, type = 'l')
Calculate the sup ADF and the generalized sup ADF statistics using the backward ADF statistic sequence and the backward SADF statistic sequence, respectively.
sadf_gsadf(y, adflag, mflag, IC, parallel = FALSE)
sadf_gsadf(y, adflag, mflag, IC, parallel = FALSE)
y |
the time series. |
adflag |
the lag order for the ADF test. |
mflag |
1 for ADF with constant and whithout trend, 2 for ADF with constant and trend and 3 for ADF without constant and trend. |
IC |
1 for AIC and 2 for BIC. |
parallel |
If TRUE, uses parallel computing for the loop. If the data is large it could be faster, but usually it is slower for small data. |
Phillips, P.C. & Shi, S. & Yu, J. (2015a). "Testing for Multiple Bubbles: Historical Episodes of Exuberance and Collapse in the S&P 500". SSRN Electronic Journal.
the S&P 500 price dividend ratio from January 1871 to December 2010.
A vector with the S&P 500 price dividend ratio.
Phillips, P.C. & Shi, S. & Yu, J. (2015a). "Testing for Multiple Bubbles: Historical Episodes of Exuberance and Collapse in the S&P 500". SSRN Electronic Journal.