potential_univariate: Potential Analysis for Univariate Data

View source: R/potential_analysis.R

potential_univariateR Documentation

Potential Analysis for Univariate Data

Description

One-dimensional potential estimation for univariate timeseries.

Usage

potential_univariate(
  x,
  std = 1,
  bw = "nrd",
  weights = c(),
  grid.size = NULL,
  peak.threshold = 1,
  bw.adjust = 1,
  density.smoothing = 0,
  min.density = 1
)

Arguments

x

Univariate data (vector) for which the potentials shall be estimated

std

Standard deviation of the noise (defaults to 1; this will set scaled potentials)

bw

kernel bandwidth estimation method

weights

optional weights in ksdensity (used by potential_slidingaverages).

grid.size

Grid size for potential estimation. of density kernel height dnorm(0, sd=bandwidth)/N

peak.threshold

Mode detection threshold

bw.adjust

The real bandwidth will be bw.adjust*bw; defaults to 1

density.smoothing

Add a small constant density across the whole observation range to regularize density estimation (and to avoid zero probabilities within the observation range). This parameter adds uniform density across the observation range, scaled by density.smoothing.

min.density

minimum accepted density for a maximum; as a multiple of kernel height

Value

potential_univariate returns a list with the following elements:

  • xi the grid of points on which the potential is estimated

  • pot The estimated potential: -log(f)*std^2/2, where f is the density.

  • density Density estimate corresponding to the potential.

  • min.inds indices of the grid points at which the density has minimum values; (-potentials; neglecting local optima)

  • max.inds indices the grid points at which the density has maximum values; (-potentials; neglecting local optima)

  • bw bandwidth of kernel used

  • min.points grid point values at which the density has minimum values; (-potentials; neglecting local optima)

  • max.points grid point values at which the density has maximum values; (-potentials; neglecting local optima)

Author(s)

Based on Matlab code from Egbert van Nes modified by Leo Lahti. Extended from the initial version in the earlywarnings R package.

References

  • Livina et al. (2010). Potential analysis reveals changing number of climate states during the last 60 kyr. Climate of the Past, 6, 77-82.

  • Lahti et al. (2014). Tipping elements of the human intestinal ecosystem. Nature Communications 5:4344.

Examples

# res <- potential_univariate(x)

microbiome/microbiome documentation built on Aug. 22, 2023, 7:12 a.m.