# ddjnonparam_ews: Description: Drift Diffusion Jump Nonparametrics Early... In earlywarnings: Early Warning Signals Toolbox for Detecting Critical Transitions in Timeseries

## Description

`ddjnonparam_ews` is used to compute nonparametrically conditional variance, drift, diffusion and jump intensity in a timeseries. It also interpolates to obtain the evolution of the nonparametric statistics in time.

## Usage

 ```1 2``` ```ddjnonparam_ews(timeseries, bandwidth = 0.6, na = 500, logtransform = TRUE, 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. `bandwidth` is the bandwidht of the kernel regressor (must be numeric). Default is 0.6. `na` is the number of points for computing the kernel (must be numeric). Default is 500. `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 approach is based on estimating terms of a drift-diffusion-jump model as a surrogate for the unknown true data generating process: [1] dx = f(x,θ)dt + g(x,θ)dW + dJ Here x is the state variable, f() and g() are nonlinear functions, dW is a Wiener process and dJ is a jump process. Jumps are large, one-step, positive or negative shocks that are uncorrelated in time.

Arguments:

## Value

`ddjnonparam_ews` returns an object with elements:

 `avec` is the mesh for which values of the nonparametric statistics are estimated. `S2.vec` is the conditional variance of the timeseries `x` over `avec`. `TotVar.dx.vec` is the total variance of `dx` over `avec`. `Diff2.vec` is the diffusion estimated as ```total variance - jumping intensity``` vs `avec`. `LamdaZ.vec` is the jump intensity over `avec`. `Tvec1` is the timeindex. `S2.t` is the conditional variance of the timeseries `x` data over `Tvec1`. `TotVar.t` is the total variance of `dx` over `Tvec1`. `Diff2.t` is the diffusion over `Tvec1`. `Lamda.t` is the jump intensity over `Tvec1`.

In addition, `ddjnonparam_ews` returns a first plot with the original timeseries and the residuals after first-differencing. A second plot shows the nonparametric conditional variance, total variance, diffusion and jump intensity over the data, and a third plot the same nonparametric statistics over time.

## Author(s)

S. R. Carpenter, modified by V. Dakos

## References

Carpenter, S. R. and W. A. Brock (2011). 'Early warnings of unknown nonlinear shifts: a nonparametric approach.' Ecology 92(12): 2196-2201

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

`generic_ews`; `ddjnonparam_ews`; `bdstest_ews`; `sensitivity_ews`;`surrogates_ews`; `ch_ews`; `movpotential_ews`; `livpotential_ews`

## Examples

 ```1 2 3``` ```data(foldbif) output<-ddjnonparam_ews(foldbif,bandwidth=0.6,na=500, logtransform=TRUE,interpolate=FALSE) ```

### Example output

```Loading required package: ggplot2