bdstest_ews {earlywarnings} | R Documentation |
BDS test Early Warning Signals
Description
bdstest_ews
is used to estimate the BDS statistic to detect nonlinearity in the residuals of a timeseries after first-difference detrending, fitting an ARMA(p,q) model, and fitting a GARCH(0,1) model. The function is making use of bds.test
from the tseries package.
Usage
bdstest_ews(
timeseries,
ARMAoptim = TRUE,
ARMAorder = c(1, 0),
GARCHorder = c(0, 1),
embdim = 3,
epsilon = c(0.5, 0.75, 1),
boots = 1000,
logtransform = FALSE,
interpolate = FALSE
)
Arguments
timeseries |
a numeric vector of the observed univariate timeseries values or a numeric matrix where the first column represents the time index and the second the observed timeseries values. Use vectors/matrices with headings. |
ARMAoptim |
is the order of the |
ARMAorder |
is the order of the |
GARCHorder |
fits a GARCH model on the original timeseries where |
embdim |
is the embedding dimension (2, 3,... |
epsilon |
is a numeric vector that is used to scale the standard deviation of the timeseries. The BDS test is computed for each element of epsilon. Default is 0.5, 0.75 and 1. |
boots |
is the number of bootstraps performed to estimate significance p values for the BDS test. Default is 1000. |
logtransform |
logical. If TRUE data are logtransformed prior to analysis as log(X+1). Default is FALSE. |
interpolate |
logical. If TRUE linear interpolation is applied to produce a timeseries of equal length as the original. Default is FALSE (assumes there are no gaps in the timeseries). |
Details
The function requires the installation of packages tseries and quadprog that are not available under Linux and need to be manually installed under Windows.
Value
bdstest_ews
returns output on the R console that summarizes the BDS test statistic for all embedding dimensions and epsilon
values used, and for first-differenced data, ARMA(p.q) residuals, and GARCH(0,1) residuals). Also the significance p values are returned estimated both by comparing to a standard normal distribution and by bootstrapping.
In addition, bdstest_ews
returns a plot with the original timeseries, the residuals after first-differencing, and fitting the ARMA(p,q) and GARCH(0,1) models. Also the autocorrelation acf
and partial autocorrelation pacf
functions are estimated serving as guides for the choice of lags of the linear models fitted to the data.
Author(s)
S. R. Carpenter, modified by V. Dakos
References
J. B. Cromwell, W. C. Labys and M. Terraza (1994): Univariate Tests for Time Series Models, Sage, Thousand Oaks, CA, pages 32-36.
Dakos, V., et al (2012).'Methods for Detecting Early Warnings of Critical Transitions in Time Series Illustrated Using Simulated Ecological Data.' PLoS ONE 7(7): e41010. doi:10.1371/journal.pone.0041010
See Also
generic_ews
;
ddjnonparam_ews
;
bdstest_ews
;
sensitivity_ews
;
surrogates_ews
;
ch_ews
;
movpotential_ews
;
livpotential_ews
;
Examples
data(foldbif)
bdstest_ews(foldbif, ARMAoptim=FALSE, ARMAorder=c(1,0),
embdim=3, epsilon=0.5, boots=200,
logtransform=FALSE, interpolate=FALSE)