sampleEntropy: Sample Entropy (also known as Kolgomorov-Sinai Entropy)

sampleEntropyR Documentation

Sample Entropy (also known as Kolgomorov-Sinai Entropy)

Description

The Sample Entropy measures the complexity of a time series. Large values of the Sample Entropy indicate high complexity whereas that smaller values characterize more regular signals.

Usage

sampleEntropy(corrDim.object, do.plot = TRUE, ...)

## S3 method for class 'sampleEntropy'
sampleEntropyFunction(x)

## S3 method for class 'sampleEntropy'
nlOrder(x)

## S3 method for class 'sampleEntropy'
radius(x)

## S3 method for class 'sampleEntropy'
embeddingDims(x)

## S3 method for class 'sampleEntropy'
plot(
  x,
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  type = "l",
  col = NULL,
  pch = NULL,
  ylim = NULL,
  log = "x",
  add.legend = T,
  ...
)

## S3 method for class 'sampleEntropy'
estimate(
  x,
  regression.range = NULL,
  do.plot = TRUE,
  use.embeddings = NULL,
  fit.col = NULL,
  fit.lty = 2,
  fit.lwd = 2,
  add.legend = T,
  ...
)

Arguments

corrDim.object

A corrDim object from which the Sample Entropy of the time series characterized by corrDim shall be estimated.

do.plot

do.plot Logical value. If TRUE (default value), a plot of the sample entropy is shown.

...

Additional plotting arguments.

x

A sampleEntropy object.

main

A title for the plot.

xlab

A title for the x axis.

ylab

A title for the y axis.

type

Type of plot (see ?plot).

col

Vector of colors for each of the dimensions of the plot.

pch

Vector of symbols for each of the dimensions of the plot

ylim

Numeric vector of length 2, giving the y coordinates range..

log

A character string which contains "x" if the x axis is to be logarithmic, "y" if the y axis is to be logarithmic and "xy" or "yx" if both axes are to be logarithmic.

add.legend

add a legend to the plot?

regression.range

Vector with 2 components denoting the range where the function will perform linear regression.

use.embeddings

A numeric vector specifying which embedding dimensions should the estimate function use to compute the sample entropy.

fit.col

A vector of colors to plot the regression lines.

fit.lty

The type of line to plot the regression lines.

fit.lwd

The width of the line for the regression lines.

Details

The sample entropy is computed using:

h_q(m,r) = log(C_q(m,r)/C_{q}(m+1,r))

where m is the embedding dimension and r is the radius of the neighbourhood. When computing the correlation dimensions we use the linear regions from the correlation sums in order to do the estimates. Similarly, the sample entropy h_q(m,r) should not change for both various m and r.

For each embedding dimension the sample entropy is estimated by averaging

h_q(m,r) = log(C_q(m,r)/C_{q}(m+1,r))

over the range specified by regression range in the estimate function.

Value

A sampleEntropy object that contains a list storing the sample entropy (sample.entropy), the embedding dimensions (embedding.dims) and radius (radius) for which the sample entropy has been computed, and the order of the sample entropy (entr.order). The sample entropy is stored as a matrix in which each row contains the computations for a given embedding dimension and each column stores the computations for a given radius.

The sampleEntropyFunction returns the sample entropy function h_q(m,r) used for the computations. The sample entropy function is represented by a matrix. Each row represents a given embedding dimension whereas that each column representes a different radius.

The nlOrder function returns the order of the sample entropy.

The radius function returns the radius on which the sample entropy function has been evaluated.

The embeddingDims function returns the embedding dimensions on which the sample entropy function has been evaluated.

The plot function shows the graphics for the sample entropy.

The estimate function returns a vector storing the sample entropy estimate for each embedding dimension.

Author(s)

Constantino A. Garcia

References

H. Kantz and T. Schreiber: Nonlinear Time series Analysis (Cambridge university press)

Examples

## Not run: 
x=henon(n.sample = 15000, n.transient = 100, a = 1.4, b = 0.3, 
        start = c(0.78,0.8165), do.plot = FALSE)$x

cd=corrDim(time.series=x,
           min.embedding.dim=2,max.embedding.dim=9,
           corr.order=2,time.lag=1,
           min.radius=0.05,max.radius=1,
           n.points.radius=100,
           theiler.window=20,
           do.plot=TRUE)

use.col = c("#999999", "#E69F00", "#56B4E9", "#009E73", 
            "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
se=sampleEntropy(cd,do.plot=TRUE,col=use.col,
                 type="l",xlim=c(0.1,1),
                 add.legend=T)
se.est = estimate(se,
                  regression.range = c(0.4,0.6),
                  use.embeddings = 6:9,col=use.col,type="b")
print(se.est)
cat("Expected K2 = ",0.325," Estimated = ",mean(se.est),"\n")

## End(Not run)

nonlinearTseries documentation built on Sept. 23, 2024, 5:10 p.m.