surrogates_ews: Surrogates Early Warning Signals

View source: R/surrogates_ews.R

surrogates_ewsR Documentation

Surrogates Early Warning Signals

Description

surrogates_ews is used to estimate distributions of trends in statistical moments from different surrogate timeseries generated after fitting an ARMA(p,q) model on the data. The trends are estimated by the nonparametric Kendall tau correlation coefficient and can be compared to the trends estimated in the original timeseries to produce probabilities of false positives.

Usage

surrogates_ews(
  timeseries,
  indicator = c("ar1", "sd", "acf1", "sk", "kurt", "cv", "returnrate", "densratio"),
  winsize = 50,
  detrending = c("no", "gaussian", "loess", "linear", "first-diff"),
  bandwidth = NULL,
  span = NULL,
  degree = NULL,
  boots = 100,
  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.

indicator

is the statistic (leading indicator) selected for which the surrogate timeseries are produced. Currently, the indicators supported are: ar1 autoregressive coefficient of a first order AR model, sd standard deviation, acf1 autocorrelation at first lag, sk skewness, kurt kurtosis, cv coeffcient of variation, returnrate, and densratio density ratio of the power spectrum at low frequencies over high frequencies.

winsize

is the size of the rolling window expressed as percentage of the timeseries length (must be numeric between 0 and 100). Default valuise 50%.

detrending

the timeseries can be detrended/filtered prior to analysis. There are three options: gaussian filtering, loess fitting, linear detrending and first-differencing. Default is no detrending.

bandwidth

is the bandwidth used for the Gaussian kernel when gaussian filtering is selected. It is expressed as percentage of the timeseries length (must be numeric between 0 and 100). Alternatively it can be given by the bandwidth selector bw.nrd0 (Default).

span

parameter that controls the degree of smoothing (numeric between 0 and 100, Default 25). see more on loessstats

degree

the degree of polynomial to be used for when loess fitting is applied, normally 1 or 2 (Default). see more on loessstats

boots

the number of surrogate data. Default is 100.

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

In addition, surrogates_ews returns a plot with the distribution of the surrogate Kendall tau estimates and the Kendall tau estimate of the original series. Vertical lines indicate the 5% and 95% significance levels.

Value

surrogates_ews returns a matrix that contains: Kendall tau estimate original the trends of the original timeseries; Kendall tau p-value original the p-values of the trends of the original timeseries; Kendall tau estimate surrogates the trends of the surrogate timeseries; Kendall tau p-value surrogates the associated p-values of the trends of the surrogate timeseries; significance p the p-value for the original Kendall tau rank correlation estimate compared to the surrogates;

Author(s)

Vasilis Dakos vasilis.dakos@gmail.com

References

Dakos, V., et al (2008). 'Slowing down as an early warning signal for abrupt climate change.' Proceedings of the National Academy of Sciences 105(38): 14308-14312

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

Examples

data(foldbif) 
output <- surrogates_ews(foldbif,indicator='sd',winsize=50,detrending='gaussian', bandwidth=10,
             boots=200, logtransform=FALSE,interpolate=FALSE)

earlywarnings documentation built on Oct. 11, 2022, 1:05 a.m.