Version: | 0.2.0 |
Date: | 2018-07-30 |
Title: | Test and Detection of Explosive Behaviors for Time Series |
Author: | Pedro Araujo <pharaujo1094@gmail.com> Gustavo Lacerda <gustavolacerdas@gmail.com> Peter C.B. Phillips <peter.phillips@yale.edu> Shu-Ping Shi <shuping.shi@mq.edu.au> |
Maintainer: | Pedro Araujo <pharaujo1094@gmail.com> |
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. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Imports: | MASS (≥ 7.3), foreach (≥ 1.4.4), stats |
LazyData: | TRUE |
RoxygenNote: | 6.1.0 |
NeedsCompilation: | no |
Packaged: | 2018-07-30 20:12:17 UTC; pedro |
Repository: | CRAN |
Date/Publication: | 2018-07-30 20:20:03 UTC |
Augmented Dickey-Fuller Statistic
Description
Calculate the Augmented Dickey-Fuller Statistic with a fixed lag order .
Usage
ADF_FL(y, adflag = 0, mflag = 1)
Arguments
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. |
References
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.
Examples
y <- rnorm(10)
ADF_FL(y, adflag = 1, mflag = 2)
Augmented Dickey-Fuller Statistic by AIC or BIC
Description
Calculate the Augmented Dickey-Fuller Statistic with lag order selected by AIC or BIC.
Usage
ADF_IC(y, adflag, mflag, IC)
Arguments
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. |
References
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.
Examples
y <- rnorm(10)
ADF_IC(y, adflag = 1, mflag = 2, IC = 1)
ADF_IC(y, adflag = 1, mflag = 2, IC = 2)
Random walk.
Description
Generate a random walk with drift 1/n.
Usage
DGP(n, niter)
Arguments
n |
sample size. Number of rows in the generated matrix. |
niter |
number of columns in the generated matrix. |
Examples
DGP(n = 100, niter = 10)
Backward Augmented Dickey-Fuller Sequence.
Description
In this program, we calculate critical value sequences for the backward ADF statistic sequence for a matrix generated from a standard Normal distribution.
Usage
badf(m, t, adflag = 0, mflag = 1)
Arguments
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. |
References
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.
Examples
foo <- badf(m = 100, t = 50, adflag = 1, mflag = 1)
plot(foo$quantiles[2,], type = 'l')
Critical values for backward SADF statistic sequence.
Description
Calculate critical value sequences for the backward sup ADF statistic sequence using Monte Carlo simulations for a sample generated from a Normal distribution.
Usage
bsadf(m, t, adflag = 0, mflag = 1)
Arguments
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. |
References
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.
Examples
foo <- bsadf(m = 20, t = 50, adflag = 1, mflag = 2)
plot(foo$quantiles[2,], type = 'l')
Critical values for generalized sup ADF statistic sequence.
Description
Calculate critical value sequences for the generalized sup ADF statistic sequence using Monte Carlo simulations for a sample generated from a Normal distribution.
Usage
gsadf(m, t, adflag = 0, mflag = 1, swindow0 = floor(r0 * t))
Arguments
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. |
References
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.
Examples
foo <- gsadf(m = 20, t = 50)
quant <- rep(foo$quantiles[2], 100)
plot(quant, type = 'l')
Critical values for sup ADF statistic sequence.
Description
Calculate critical value sequences for the sup ADF statistic sequence using Monte Carlo simulations for a sample generated from a Normal distribution.
Usage
sadf(m, t)
Arguments
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. |
References
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.
Examples
foo <- sadf(m = 20, t = 50)
quant <- rep(foo$quantiles[2], 100)
plot(quant, type = 'l')
Sup ADF and generalized sup ADF statistics for a time series.
Description
Calculate the sup ADF and the generalized sup ADF statistics using the backward ADF statistic sequence and the backward SADF statistic sequence, respectively.
Usage
sadf_gsadf(y, adflag, mflag, IC, parallel = FALSE)
Arguments
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. |
References
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.
S&P 500 data.
Description
the S&P 500 price dividend ratio from January 1871 to December 2010.
Format
A vector with the S&P 500 price dividend ratio.
References
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.