bdstest_ews: Description: BDS test Early Warning Signals

Description Usage Arguments Details Value Author(s) References See Also Examples

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

1
2
3
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 ARMA(p,q) model to be fitted on the original timeseries. If TRUE the best ARMA model based on AIC is applied. If FALSE the ARMAorder is used.

ARMAorder

is the order of the AR(p) and MA(q) process to be fitted on the original timeseries. Default is p=1 q=0.

GARCHorder

fits a GARCH model on the original timeseries where GARCHorder[1] is the GARCH part and GARCHorder[2] is the ARCH part.

embdim

is the embedding dimension (2, 3,... embdim) up to which the BDS test will be estimated (must be numeric). Default value is 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

See also bds.test{tseries} for more 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.

Arguments:

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

1
2
3
4
#
data(foldbif)
bdstest_ews(foldbif,ARMAoptim=FALSE,ARMAorder=c(1,0),embdim=3,epsilon=0.5, 
boots=200,logtransform=FALSE,interpolate=FALSE)

Example output

Loading required package: ggplot2
Loading required package: moments
Loading required package: tgp
Loading required package: tseries

earlywarnings Copyright (C) 2011-2013 Vasilis Dakos and Leo Lahti
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under the FreeBSD open source license. For more information, see http://www.early-warning-signals.org

[1] ***********************************************
[1] BDS test for   Detrended data
[1] Embedding dimension =  3                     
[1] BDS statistics for Nominal Data at each Epsilon
  0.114521
2    4.051
3    2.911
[1] P value based on standard normal
  0.114521
2    0.000
3    0.004
[1]  
[1] Bootstrap P estimates for  Detrended data            
[1] Bootstrap iterations =  200                    
[1] For embedding dimension = 2                        
[1] For epsilon =  0.115          bootstrap P = 
[1] 0
[1] For embedding dimension = 3                        
[1] For epsilon =  0.115          bootstrap P = 
[1] 0.04
[1] **********************************************************
[1] ARMA model

Call:
arima(x = Y, order = c(ARMAorder[1], 0, ARMAorder[2]), include.mean = TRUE)

Coefficients:
         ar1  intercept
      0.9207     5.8999
s.e.  0.0288     0.1905

sigma^2 estimated as 0.05045:  log likelihood = 13.94,  aic = -21.89
[1] ***********************************************
[1] BDS test for         ARMA model residuals
[1] Embedding dimension =  3                     
[1] BDS statistics for Nominal Data at each Epsilon
  0.11258
2   2.803
3   1.818
[1] P value based on standard normal
  0.11258
2   0.005
3   0.069
[1]  
[1] Bootstrap P estimates for  ARMA model residuals      
[1] Bootstrap iterations =  200                    
[1] For embedding dimension = 2                        
[1] For epsilon =  0.113          bootstrap P = 
[1] 0.035
[1] For embedding dimension = 3                        
[1] For epsilon =  0.113          bootstrap P = 
[1] 0.07
[1] **********************************************************

 ***** ESTIMATION WITH ANALYTICAL GRADIENT ***** 


     I     INITIAL X(I)        D(I)

     1     2.794277e-01     1.000e+00
     2     5.000000e-02     1.000e+00

    IT   NF      F         RELDF    PRELDF    RELDX   STPPAR   D*STEP   NPRELDF
     0    1  1.785e+03
     1    2  4.541e+02  7.46e-01  1.56e+01  9.1e-01  2.8e+04  1.0e+00  2.17e+05
     2    3  4.541e+02  2.19e-06  1.10e-06  1.8e-03  0.0e+00  3.9e-03  1.10e-06
     3    5  4.541e+02  2.15e-05  1.09e-05  1.8e-02  0.0e+00  3.9e-02  1.09e-05
     4    7  4.540e+02  1.76e-04  1.03e-04  1.8e-01  0.0e+00  3.8e-01  1.03e-04
     5    8  4.539e+02  1.59e-04  1.77e-04  3.9e-01  0.0e+00  9.1e-01  1.77e-04
     6    9  4.539e+02  2.60e-06  2.84e-06  3.4e-02  0.0e+00  1.1e-01  2.84e-06
     7   10  4.539e+02  2.36e-08  2.01e-08  3.1e-03  0.0e+00  9.6e-03  2.01e-08
     8   11  4.539e+02  8.83e-09  4.80e-09  1.3e-03  0.0e+00  4.2e-03  4.80e-09
     9   13  4.539e+02  6.91e-08  4.53e-08  1.1e-02  0.0e+00  3.4e-02  4.53e-08
    10   14  4.539e+02  1.19e-07  7.40e-08  1.9e-02  0.0e+00  6.1e-02  7.40e-08
    11   15  4.539e+02  2.63e-07  1.74e-07  4.2e-02  0.0e+00  1.4e-01  1.74e-07
    12   16  4.539e+02  3.30e-07  2.29e-07  5.1e-02  0.0e+00  1.9e-01  2.29e-07
    13   17  4.539e+02  2.26e-07  1.74e-07  3.4e-02  0.0e+00  1.4e-01  1.74e-07
    14   18  4.539e+02  5.49e-08  4.65e-08  2.6e-03  0.0e+00  1.1e-02  4.65e-08
    15   19  4.539e+02  3.54e-09  3.39e-09  2.6e-03  1.1e+00  1.1e-02  3.82e-09
    16   20  4.539e+02  7.71e-10  7.50e-10  2.9e-03  0.0e+00  1.2e-02  7.50e-10
    17   21  4.539e+02  3.01e-12  2.78e-12  1.8e-04  0.0e+00  7.7e-04  2.78e-12

 ***** RELATIVE FUNCTION CONVERGENCE *****

 FUNCTION     4.539242e+02   RELDX        1.829e-04
 FUNC. EVALS      21         GRAD. EVALS      18
 PRELDF       2.783e-12      NPRELDF      2.783e-12

     I      FINAL X(I)        D(I)          G(I)

     1    2.095843e+00     1.000e+00     1.325e-06
     2    9.392042e-01     1.000e+00     4.095e-05

[1] GARCH(0,1) model fit to detrended data

Call:
garch(x = Y, order = c(GARCHorder[1], GARCHorder[2]))

Coefficient(s):
    a0      a1  
2.0958  0.9392  

[1] ***********************************************
[1] BDS test for               GARCH(0,1) model residuals
[1] Embedding dimension =  3                     
[1] BDS statistics for Nominal Data at each Epsilon
  0.019
2 3.490
3 2.563
[1] P value based on standard normal
  0.019
2  0.00
3  0.01
[1]  
[1] Bootstrap P estimates for  GARCH(0,1) model residuals
[1] Bootstrap iterations =  200                    
[1] For embedding dimension = 2                        
[1] For epsilon =  0.019          bootstrap P = 
[1] 0.005
[1] For embedding dimension = 3                        
[1] For epsilon =  0.019          bootstrap P = 
[1] 0.055
[1] **********************************************************

earlywarnings documentation built on May 2, 2019, 9:55 a.m.