Last data update: 2014.03.03

R: Correlation sum, correlation dimension and generalized...
corrDimR Documentation

Correlation sum, correlation dimension and generalized correlation dimension (order q >1).

Description

Functions for estimating the correlation sum and the correlation dimension of a dynamical system from 1-dimensional time series using Takens' vectors.

Usage

corrDim(time.series, min.embedding.dim = 2, max.embedding.dim = 5,
  time.lag = 1, min.radius, max.radius, corr.order = 2,
  n.points.radius = 5, theiler.window = 100, do.plot = TRUE,
  number.boxes = NULL, ...)

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

## S3 method for class 'corrDim'
corrMatrix(x)

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

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

## S3 method for class 'corrDim'
print(x, ...)

## S3 method for class 'corrDim'
plot(x, main = "Correlation Sum C(r)", xlab = NULL,
  ylab = "C(r)", type = "b", log = "xy", ylim = NULL, col = NULL,
  pch = NULL, localScalingExp = T, add.legend = T, cex.legend = 1, ...)

## S3 method for class 'corrDim'
plotLocalScalingExp(x, main = "Correlation Dimension C(r)",
  xlab = NULL, ylab = "Local scaling exponents", type = "b", log = "x",
  ylim = NULL, col = NULL, pch = NULL, add.legend = T, ...)

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

Arguments

time.series

The original time series from which the correlation sum will be estimated.

min.embedding.dim

Integer denoting the minimum dimension in which we shall embed the time.series (see buildTakens).

max.embedding.dim

Integer denoting the maximum dimension in which we shall embed the time.series (see buildTakens).Thus, we shall estimate the correlation dimension between min.embedding.dim and max.embedding.dim.

time.lag

Integer denoting the number of time steps that will be use to construct the Takens' vectors (see buildTakens).

min.radius

Minimum distance used to compute the correlation sum C(r).

max.radius

Maximum distance used to compute the correlation sum C(r).

corr.order

Order of the generalized correlation Dimension q. It must be greater than 1 (corr.order>1). Default, corr.order=2.

n.points.radius

The number of different radius where we shall estimate. C(r). Thus, we will estimate C(r) in n.points.radius between min.radius and max.radius.

theiler.window

Integer denoting the Theiler window: Two Takens' vectors must be separated by more than theiler.window time steps in order to be considered neighbours. By using a Theiler window, we exclude temporally correlated vectors from our estimations.

do.plot

Logical value. If TRUE (default value), a plot of the correlation sum is shown.

number.boxes

Number of boxes that will be used in the box assisted algorithm (see neighbourSearch). If the user does not specify it, the function uses a proper number of boxes.

...

Additional plotting parameters.

x

A corrDim 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).

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.

ylim

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

col

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

pch

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

localScalingExp

add a plot of the local scaling exponents of the correlation sum.

add.legend

add a legend to the plot?

cex.legend

Magnification value for the legend.

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 correlation dimension.

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.

lty

The line type of the correlation sums.

lwd

The line width of the correlation sums.

Details

The correlation dimension is the most common measure of the fractal dimensionality of a geometrical object embedded in a phase space. In order to estimate the correlation dimension, the correlation sum is defined over the points from the phase space:

C(r) = {number of points(xi,xj) verifying distance(xi,xj)<r}/N^2

However, this estimator is biased when the pairs in the sum are not statistically independent. For example, Taken's vectors that are close in time, are usually close in the phase space due to the non-zero autocorrelation of the original time series. This is solved by using the so-called Theiler window: two Takens' vectors must be separated by, at least, the time steps specified with this window in order to be considered neighbours. By using a Theiler window, we exclude temporally correlated vectors from our estimations.

The correlation dimension is estimated using the slope obtained by performing a linear regression of log10(C(r)) Vs. log10(r). Since this dimension is supposed to be an invariant of the system, it should not depend on the dimension of the Taken's vectors used to estimate it. Thus, the user should plot log10(C(r)) Vs. log10(r) for several embedding dimensions when looking for the correlation dimension and, if for some range log10(C(r)) shows a similar linear behaviour in different embedding dimensions (i.e. parallel slopes), these slopes are an estimate of the correlation dimension. The estimate routine allows the user to get always an estimate of the correlation dimension, but the user must check that there is a linear region in the correlation sum over different dimensions. If such a region does not exist, the estimation should be discarded.

Note that the correlation sum C(r) may be interpreted as: C(r) = <p(r)>, that is: the mean probability of finding a neighbour in a ball of radius r surrounding a point in the phase space. Thus, it is possible to define a generalization of the correlation dimension by writing:

Cq(r) = <p(r)^(q-1)>.

Note that the correlation sum

C(r) = C2(r).

It is possible to determine generalized dimensions Dq using the slope obtained by performing a linear regression of log10(Cq(r));Vs.;(q-1)log10(r). The case q=1 leads to the information dimension, that is treated separately in this package (infDim). The considerations discussed for the correlation dimension estimate are also valid for these generalized dimensions.

Value

A corrDim object that consist of a list with four components named radius, embedding.dims, order and corr.matrix. radius is a vector containing the different radius where we have evaluated C(r). embedding.dims is a vector containing all the embedding dimensions in which we have estimated C(r). order stores the order of the generalized correlation dimension that has been used. Finally, corr.matrix stores all the correlation sums that have been computed. Each row stores the correlation sum for a concrete embedding dimension whereas each colum stores the correlation sum for a specific radius.

The nlOrder function returns the order of the correlation sum.

The corrMatrix function returns the correlations matrix storing the correlation sums that have been computed for all the embedding dimensions.

The radius function returns the radius on which the correlation sum function has been evaluated.

The embeddingDims function returns the embedding dimensions on which the correlation sum function has been evaluated.

The plot function plots the correlation sum. It is possible to plot the the correlation sum Vs the radius and also the local scaling exponents of the correlation sum Vs radius.

The plotLocalScalingExp function plots the local scaling exponents of the correlation sum.

The estimate function estimates the correlation dimension of the corr.dim object by averaging the slopes of the embedding dimensions specified in the use.embeddings parameter. The slopes are determined by performing a linear regression over the radius' range specified in regression.range.If do.plot is TRUE, a graphic of the regression over the data is shown.

Author(s)

Constantino A. Garcia

References

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

Examples

## Not run: 
x=lorenz(sigma=10, rho = 28, beta =8/3, start = c(-10, -11, 47),
time =  seq(0, 70, by = 0.01), do.plot = FALSE)$x
cd=corrDim(time.series=x,min.embedding.dim=3,max.embedding.dim=6,
           time.lag=10,min.radius=1e-3,max.radius=50,
           n.points.radius=100,theiler.window=100,
           number.boxes=100,do.plot=F)

plot(cd,type="l")
plotLocalScalingExp(cd,cex=0.5,xlim=c(1e-1,5))
cd.est = estimate(cd,regression.range=c(0.2,2))
cat("expected: 2.05  --- estimate: ",cd.est,"\n")

## End(Not run)

Results