`CausalityToolsBase.ApproximateIntersection`

— Type`ApproximateIntersection`

A type indicating that simplex intersections should be computed exactly.

`CausalityToolsBase.BinningHeuristic`

— Type`BinningHeuristic`

Abstract type for binning heuristics.

`CausalityToolsBase.BinningScheme`

— Type`BinningScheme`

The supertype of all binning schemes in the CausalityTools ecosystem.

`CausalityToolsBase.CausalityEstimator`

— TypeCausalityEstimator

An abstract type that is the supertype of all causality estimators in the `CausalityTools`

ecosystem.

The naming convention for abstract subtypes is `SomeMethodEstimator`

. Examples of abstract estimator type hierarchies could be:

`TransferEntropyEstimator <: CausalityEstimator`

`CrossMappingEstimator <: CausalityEstimator`

Specific estimator types are named according to the algorithm. Examples of complete type hierarchies for different estimators could be:

`VisitationFrequency <: TransferEntropyEstimator <: CausalityEstimator`

.`TransferOperatorGrid <: TransferEntropyEstimator <: CausalityEstimator`

.`SimpleCrossMap <: CrossMappingEstimator <: CausalityEstimator`

.`ConvergentCrossMap <: CrossMappingEstimator <: CausalityEstimator`

.`JointDistanceDistribution <: JointDistanceDistributionEstimator <: CausalityEstimator`

.

Each estimator type, also the abstract ones, have a corresponding parameter type where `Estimator`

is replaced by `Test`

, for example:

`VisitationFrequencyTest <: TransferEntropyTest <: CausalityTest`

.`TransferOperatorGridTest <: TransferEntropyTest <: CausalityTest`

.

`CausalityToolsBase.CausalityTest`

— Type`CausalityTest`

An abstract type that is the supertype of all causality tests in the `CausalityTools`

ecosystem.

The naming convention for abstract subtypes is `SomeMethodTest`

. Examples of the type hierarchy of abstract test types could be:

`TransferEntropyTest <: CausalityTest`

`CrossMappingTest <: CausalityTest`

Subtypes of those abstract types are named according to the specific algorithm. Examples of complete type hierachies for specific causality test types could be:

`VisitationFrequencyTest <: TransferEntropyTest <: CausalityTest`

.`TransferOperatorGridTest <: TransferEntropyTest <: CausalityTest`

.`CrossMappingTest <: DistanceBasedTest <: CausalityTest`

.

`CausalityToolsBase.ExactIntersection`

— Type`ExactIntersection`

A type indicating that simplex intersections should be computed exactly.

`CausalityToolsBase.OnPoints`

— Type`OnPoints`

A grid type indicating that the grid should be represented by a set of points.

`CausalityToolsBase.OptimiseDelay`

— Type`OptimiseDelay(method_delay = "ac_zero", maxdelay_frac = 0.1; kwargs...) -> OptimiseDelay`

Indicates that the delay parameter for an embedding should be optimised using some estimation procedure.

Passing an instance of `OptimiseDelay`

to certain functions triggers delay estimation based on the length of the time series, which is not necessarily known beforehand. Here, the maximum lag is expressed as a fraction of the time series length.

**Fields**

: The delay estimation method. Uses`method_delay::String = "ac_zero"`

`DynamicalSystems.estimate_delay`

under the hood. See its documentation for more info.: The maximum number of delays for which to check, expressed as a fraction of the time series length.`maxdelay_frac::Number = 0.1`

: Arguments to the various methods. Empty by default. Keywords`kwargs::NamedTuple`

`nbins`

and`binwidth`

are propagated into`DynamicalSystems.mutualinformation`

if`method = mi_min`

.

**Example**

```
opt_scheme = OptimiseDelay(method_delay = "mi_min", kwargs = (nbins = 10, ))
ts = sin.(diff(diff(rand(5000))))
optimal_delay(ts, opt_scheme)
```

`CausalityToolsBase.OptimiseDim`

— Type```
OptimiseDim(method_delay::String = "ac_zero", maxdelay_frac::Number = 0.1,
method_dim::String = "f1nn", maxdim::Int = 6) -> OptimiseDim
```

Indicates that the dimension for an embedding should be optimised using some estimation procedure.

To estimate the dimension, the delay lag must also be specified. Therefore, passing an instance of `OptimiseDim`

to certain functions triggers delay estimation based on the length of the time series, which is not necessarily known beforehand. Then, after the delay has been estimated, the dimension is estimated.

**Fields**

: The dimension estimation method.`method_dim::String = "f1nn"`

: The maximum dimension to check for. Dimensions`maxdim::Int = 6`

`1:maxdim`

will be checked.: Keyword arguments to the dimension estimation method. Empty by default.`kwargs_dim::NamedTuple`

: The delay estimation method.`method_delay::String = "ac_zero"`

: The maximum number of delays for which to check, expressed as a fraction of the time series length.`maxdelay_frac::Number = 0.1`

: Keyword arguments to the delay estimation method. Empty by default. Keywords`kwargs_delay::NamedTuple`

`nbins`

and`binwidth`

are propagated into`DynamicalSystems.mutualinformation`

if`method = mi_min`

. See also`optimal_delay`

.

**Example**

```
opt_scheme = OptimiseDim(method_dim = "f1nn", method_delay = "ac_zero")
ts = sin.(diff(diff(rand(5000))))
optimal_dimension(ts, opt_scheme)
```

`CausalityToolsBase.RectangularBinning`

— Type`RectangularBinning(ϵ) <: RectangularBinningScheme`

Instructions for creating a rectangular box partition using the binning scheme `ϵ`

.

**Types of rectangular binning schemes**

**Data-dictated ranges along each axis**

`ϵ::Int`

divides each axis into`ϵ`

equal-length intervals, extending the upper bound 1/100th of a bin size to ensure all points are covered.`ϵ::Float64`

divides each axis into intervals of fixed size`ϵ`

.`ϵ::Vector{Int}`

divides the i-th axis into`ϵᵢ`

equal-length intervals, extending the upper bound 1/100th of a bin size to ensure all points are covered.`ϵ::Vector{Float64}`

divides the i-th axis into intervals of size`ϵ[i]`

.

In these cases, the rectangular partition is constructed by locating the minima along each coordinate axis, then constructing equal-length intervals until the data maxima are covered.

**Custom ranges along each axis**

Rectangular binnings may also be specified on arbitrary min-max ranges.

`ϵ::Tuple{Vector{Tuple{Float64,Float64}},Int64}`

creates intervals along each axis from ranges indicated by a vector of`(min, max)`

tuples, then divides each axis into the same integer number of equal-length intervals.

It's probably easier to use the following constructors

`RectangularBinning(RectangularBinning(minmaxes::Vararg{<:AbstractRange{T}, N}; n_intervals::Int = 10))`

takes a vector of tuples indiciating the (min, max) along each axis and`n_intervals`

that indicates how many equal-length intervals those ranges should be split into.`RectangularBinning(minmaxes::Vector{<:AbstractRange{T}}, n_intervals::Int)`

does the same, but the arguments are provided as ranges.

**Examples**

Minimal and maximal positions of the grid determined by the data points:

`RectangularBinning(10)`

: find the minima along each coordinate axis of the points, then split the (extended) range into`10`

equal-length intervals.`RectangularBinning([10, 5])`

: find the minima along each coordinate axis of the points, then split the (extended) range along the first coordinate axis into`10`

equal-length intervals and the range along the second coordinate axis into`5`

equal-length intervals.`RectangularBinning(0.5)`

: find the minima along each coordinate axis of the points, then split the axis ranges into equal-length intervals of size`0.5`

`RectangularBinning([0.3, 0.1])`

: find the minima along each coordinate axis of the points, then split the range along the first coordinate axis into equal-length intervals of size`0.3`

and the range along the second axis into equal-length intervals of size`0.1`

.

Explitly specifying data ranges (not guaranteed to cover data points):

`RectangularBinning(-5:5, 2:2, n_intervals = 5)`

: split the ranges`-5:5`

and`2:2`

into`n_intervals`

equal-length intervals.

`CausalityToolsBase.RectangularBinningScheme`

— Type`RectangularBinningScheme <: BinningScheme`

The supertype of all rectangular binning schemes in the CausalityTools ecosystem.

`CausalityToolsBase.RefinedTriangulationBinningMaxRadius`

— Type`RefinedTriangulationBinningMaxRadius`

A binning scheme for a triangulated simplex partition where some simplices have been refined (subdivided by a shape-preserving simplex subdivision algorithm).

The maximum radius bound is applied by first doing an initial triangulation, the splitting simplices whose radius is large until all simplices have radii less than the resulting radius bound.

**Fields**

: The maximum radius expressed as a fraction of the`max_radius_frac::Float64`

radius of the largest simplex of the initial triangulation.

`CausalityToolsBase.RefinedTriangulationBinningSplitFactor`

— Type`RefinedTriangulationBinningSplitFactor`

A binning scheme for a triangulated simplex partition where some simplices have been refined (subdivided by a shape-preserving simplex subdivision algorithm).

The split factor bound controls how many times each simplex of the initial triangulation is to be split.

**Fields**

: The number of times each simplex is split.`simplex_split_factor::Int`

`CausalityToolsBase.RefinedTriangulationBinningSplitQuantile`

— Type`RefinedTriangulationBinningSplitQuantile`

A binning scheme for a triangulated simplex partition where some simplices have been refined (subdivided by a shape-preserving simplex subdivision algorithm).

The split fraction bound controls how many times each simplex of the initial triangulation is to be split.

**Fields**

: All simplices with radius larger than the`split_quantile::Float64`

`split_quantile`

-th quantile of the radii of the simplices in initial triangulation are split with a splitting factor of`simplex_split_factor`

.: The number of times each simplex is split.`simplex_split_factor::Int`

`CausalityToolsBase.SimplexIntersectionType`

— Type`SimplexIntersectionType`

An abstract type for different types of simplex intersections.

`CausalityToolsBase.TriangulationBinning`

— Type`TriangulationBinning <: TriangulationBinningScheme`

Instructions for creating a triangulated partition.

`CausalityToolsBase.TriangulationBinningScheme`

— Type`TriangulationBinningScheme <: BinningScheme`

The supertype of all triangulation binning schemes in the CausalityTools ecosystem.

`CausalityToolsBase.encode`

— Function`encode(point, reference_point, edgelengths)`

Encode a point into its integer bin labels relative to some `reference_point`

(always counting from lowest to highest magnitudes), given a set of box `edgelengths`

(one for each axis). The first bin on the positive side of the reference point is indexed with 0, and the first bin on the negative side of the reference point is indexed with -1.

**Example**

```
using CausalityToolsBase
refpoint = [0, 0, 0]
steps = [0.2, 0.2, 0.3]
encode(rand(3), refpoint, steps)
```

`CausalityToolsBase.generate_gridpoints`

— Function```
generate_gridpoints(points, binning_scheme::RectangularBinning,
grid::GridType = OnGrid())
```

Return a set of points forming a rectangular grid covering a hyperrectangular box specified by the `binning_scheme`

and `grid`

type. Provided a suitable binning scheme is given, this grid will provide a covering of `points`

. See the documentation for `RectangularBinning`

for more details.

**Arguments**

: A vector of points or a`points`

`Dataset`

instance.: A`binning_scheme`

`RectangularBinning`

instance. See docs for`RectangularBinning`

for more details.: A`grid`

`GridType`

instance. The grid follows the same convention as in Interpolations.jl. Valid choices are`OnGrid()`

(uses the bin origins as the grid points), and`OnCell()`

, which adds an additional interval along each axis, shifts the grid half a bin outside the extrema along each axis and retursn the centers of the resulting grid cells.

**Examples**

For example,

```
using CausalityToolsBase, DelayEmbeddings
pts = Dataset([rand(3) for i = 1:100])
generate_gridpoints(pts, RectangularBinning(10), OnGrid())
```

generates a rectangular grid covering the range of `pts`

constructed by subdividing each coordinate axis into 10 equal-length intervals. Next,

```
using CausalityToolsBase, DelayEmbeddings
pts = Dataset([rand(3) for i = 1:100])
generate_gridpoints(pts, RectangularBinning(10), OnCell())
```

will do the same, but adds another interval (11 in total), shifts the entire hypercube so that the minima and maxima along each axis lie half a bin outside the original extrema, then returns the centers of the grid cells.

`CausalityToolsBase.generate_gridpoints`

— Function```
generate_gridpoints(axisminima, stepsizes, n_intervals_eachaxis,
grid::GridType = OnGrid())
```

Return a set of points forming a grid over the hyperrectangular box spanned by

`(axisminima, axisminima .+ (n_intervals_eachaxis .* stepsizes)`

if`grid = OnGrid()`

, and`(axisminima, axisminima .+ ((n_intervals_eachaxis .+ 1) .* stepsizes)`

if`grid = OnCell()`

,

where the minima along each coordinate axis (`axisminima`

), the `stepsizes`

along each axis, and the set of intervals (`n_intervals_per_axis`

) indicating how many equal-length intervals each axis should be divided into.

If `grid = OnGrid()`

, then the bin origins are taken as the grid points. If `grid = OnCell()`

, then one additional interval is added and the grid is shifted half a bin outside the extrema along each axis, so that the grid points lie at the center of the grid cells.

`CausalityToolsBase.get_edgelengths`

— Function`get_edgelengths(pts, binning_scheme::RectangularBinning) -> Vector{Float}`

Return the box edge length along each axis resulting from discretizing `pts`

on a rectangular grid specified by `binning_scheme`

.

**Example**

```
using DynamicalSystems, CausalityToolsBase
pts = Dataset([rand(5) for i = 1:1000])
get_edgelengths(pts, RectangularBinning(0.6))
get_edgelengths(pts, RectangularBinning([0.5, 0.3, 0.3, 0.4, 0.4]))
get_edgelengths(pts, RectangularBinning(8))
get_edgelengths(pts, RectangularBinning([10, 8, 5, 4, 22]))
```

`CausalityToolsBase.get_maxima`

— Function`get_maxima(pts) -> SVector`

Return the maxima along each axis of the dataset `pts`

.

`CausalityToolsBase.get_minima`

— Function`get_minima(pts) -> SVector`

Return the minima along each axis of the dataset `pts`

.

`CausalityToolsBase.get_minima_and_edgelengths`

— Method```
get_minima_and_edgelengths(points,
binning_scheme::RectangularBinning) -> (Vector{Float}, Vector{Float})
```

Find the minima along each axis of the embedding, and computes appropriate edge lengths given a rectangular `binning_scheme`

, which provide instructions on how to grid the space. Assumes the input is a vector of points.

See documentation for `RectangularBinning`

for details on the binning scheme.

**Example**

```
using DynamicalSystems, CausalityToolsBase
pts = Dataset([rand(4) for i = 1:1000])
get_minima_and_edgelengths(pts, RectangularBinning(0.6))
get_minima_and_edgelengths(pts, RectangularBinning([0.5, 0.3, 0.4, 0.4]))
get_minima_and_edgelengths(pts, RectangularBinning(10))
get_minima_and_edgelengths(pts, RectangularBinning([10, 8, 5, 4]))
```

`CausalityToolsBase.get_minmaxes`

— Function`get_minmaxes(pts) -> Tuple{Vector{Float}, Vector{Float}}`

Return a vector of tuples containing axis-wise (minimum, maximum) values.

`CausalityToolsBase.joint_visits`

— Method`joint_visits(points, binning_scheme::RectangularBinning)`

Determine which bins are visited by `points`

given the rectangular binning scheme `ϵ`

. Bins are referenced relative to the axis minimum.

**Example**

```
using DynamicalSystems, CausalityToolsBase
pts = Dataset([rand(5) for i = 1:100]);
joint_visits(pts, RectangularBinning(0.2))
```

`CausalityToolsBase.kerneldensity`

— Method```
kerneldensity(pts, gridpts, kernel::BoxKernel;
h = silverman_rule(pts),
metric::Metric = Chebyshev(),
normalise = true) -> Vector{Float64}
```

Naive box kernel density estimator from [1].

**Arguments**

: The points for which to evaluate the density.`pts`

: A set of grid point on which to evaluate the density.`gridpts`

: A`kernel`

`Kernel`

type. Defaults to`BoxKernel`

. Can also be`GaussianKernel`

.

**Keyword arguments**

: The bandwidth. Uses Silverman's rule to compute an optimal bandwidth assuming a Gaussian density (note: we're not using a Gaussian kernel here, so might be off).`h`

: A set of grid point on which to evaluate the density.`gridpts`

: Normalise the density so that it sums to 1.`normalise`

: A instance of a valid metric from`metric`

`Distances.jl`

that is nonnegative, symmetric and satisfies the triangle inequality. Defaults to`metric = Chebyshev()`

.

**Returns**

A density estimate for each grid point.

**References**

**Example**

```
using DynamicalSystems, CausalityToolsBase, Distributions
# Create some example points from a multivariate normal distribution
d = MvNormal(rand(Uniform(-1, 1), 2), rand(Uniform(0.1, 0.9), 2))
pts = Dataset([rand(d) for i = 1:500])
# Evaulate the density at a subset of those points given all the points
gridpts = Dataset([SVector{2, Float64}(pt) for pt in pts[1:5:end]])
# Get normalised density
kd_norm = kerneldensity(pts, gridpts, BoxKernel(), normalise = true);
kd_nonnorm = kerneldensity(pts, gridpts, BoxKernel(), normalise = false);
# Make sure the result sums to one of normalised and that it doesn't when not normalising
sum(kd_norm) ≈ 1
!(sum(kd_nonnorm) ≈ 1)
```

`CausalityToolsBase.marginal_visits`

— Method`marginal_visits(joint_visits, dims)`

Given a set of precomputed joint visited bins over some binning, return the marginal along dimensions `dims`

.

**Example**

```
using DynamicalSystems, CausalityToolsBase
pts = Dataset([rand(5) for i = 1:100]);
# First compute joint visits, then marginal visits along dimensions 1 and 4
jv = joint_visits(pts, RectangularBinning(0.2))
marginal_visits(jv, [1, 4])
```

`CausalityToolsBase.marginal_visits`

— Method`marginal_visits(points, binning_scheme::RectangularBinning, dims)`

Determine which bins are visited by `points`

given the rectangular binning scheme `ϵ`

, only along the desired dimensions `dims`

. Bins are referenced relative to the axis minimum.

**Example**

```
using DynamicalSystems, CausalityToolsBase
pts = Dataset([rand(5) for i = 1:100]);
# Marginal visits along dimension 3 and 5
marginal_visits(pts, RectangularBinning(0.3), [3, 5])
# Marginal visits along dimension 2 through 5
marginal_visits(pts, RectangularBinning(0.3), 2:5)
```

`CausalityToolsBase.optimal_delay`

— Method`optimal_delay(x, p::OptimiseDelay)`

Estimate the optimal delay reconstruction lag for `x`

using the instructions given by the `OptimiseDelay`

instance `p`

.

**Example**

```
opt_scheme = OptimiseDelay(method_delay = "ac_zero", kwargs = (nbins = 10, ))
ts = sin.(diff(diff(rand(5000))))
optimal_delay(ts, opt_scheme)
```

`CausalityToolsBase.optimal_delay`

— Method`optimal_delay(v; method = "mi_min"; τs = 1:1:floor(Int, length(v)/10); kwargs...)`

Estimate the optimal embedding lag for `v`

among the delays `τs`

.

**Keyword arguments**

: The delay estimation method. Uses`method::String = "mi_min"`

`DynamicalSystems.estimate_delay`

under the hood. See its documentation for more info.: The lags over which to estimate the embedding lag. Defaults to 10% of the length of the time series.`τs`

: Keyword arguments to the delay estimation methods. Empty by default. Keywords`kwargs::NamedTuple`

`nbins`

,`binwidth`

are propagated into`DynamicalSystems.mutualinformation`

.

**Example**

```
using CausalityToolsBase
ts = diff(rand(100))
optimal_delay(ts)
optimal_delay(ts, method = "ac_zero")
optimal_delay(ts, method = "mi_min", τs = 1:10)
```

`CausalityToolsBase.optimal_dimension`

— Function`optimal_dimension(v, τ; dims = 2:8; method = "fnn"; kwargs...)`

Estimate the optimal embedding dimension for `v`

.

**Arguments**

: The data series for which to estimate the embedding dimension.`v`

: The embedding lag.`τ`

: Dimensions to probe for the optimal dimension.`dims`

**Keyword arguments**

: Either "fnn" (Kennel's false nearest neighbors method), "afnn" (Cao's average false nearest neighbors method) or "f1nn" (Krakovská's false first nearest neighbors method). See the source code for`method`

`DelayEmbeddings.estimate_dimension`

for more details.: Tolerance`rtol`

`rtol`

in Kennel's algorithms. See`DelayEmbeddings.fnn`

source code for more details.: Tolerance`atol`

`rtol`

in Kennel's algorithms. See`DelayEmbeddings.fnn`

source code for more details.

**Example**

```
using CausalityToolsBase
ts = diff(rand(1000))
optimal_dimension(ts)
optimal_dimension(ts, dims = 3:5)
optimal_dimension(ts, method = "afnn")
optimal_dimension(ts, method = "fnn")
optimal_dimension(ts, method = "f1nn")
```

`CausalityToolsBase.optimal_dimension`

— Method```
optimal_dimension(v; dims = 2:8,
method_dimension = "fnn", method_delay = "ac_zero")
```

Estimate the optimal embedding dimension for `v`

by first estimating the optimal lag, then using that lag to estimate the dimension.

**Arguments**

: The data series for which to estimate the embedding dimension.`v`

: The dimensions to try.`dims`

: The method for determining the optimal lag.`method_delay`

`CausalityToolsBase.optimal_dimension`

— Method`optimal_dimension(x, p::OptimiseDim)`

Estimate the optimal reconstruction dimension for `x`

using the instructions given by the `OptimiseDim`

instance `p`

.

**Example**

```
opt_scheme = OptimiseDim(method_dim = "f1nn", method_delay = "mi_min", kwargs_delay = (nbins = 10, )))
ts = sin.(diff(diff(rand(5000))))
optimal_dimension(ts, opt_scheme)
```

`CausalityToolsBase.silverman_rule`

— Method`silverman_rule(pts)`

Find the approximately optimal bandwidth for a kernel density estimate, assuming the density is Gaussian (Silverman, 1996).

`ChaosTools.non0hist`

— Method`non0hist(points, binning_scheme::RectangularBinning, dims)`

Determine which bins are visited by `points`

given the rectangular `binning_scheme`

, considering only the marginal along dimensions `dims`

. Bins are referenced relative to the axis minima.

Returns the unordered histogram (visitation frequency) over the array of bin visits.

This method extends `ChaosTools.non0hist`

.

**Example**

```
using DelayEmbeddings
pts = Dataset([rand(5) for i = 1:100]);
# Histograms directly from points given a rectangular binning scheme
h1 = non0hist(pts, RectangularBinning(0.2), 1:3)
h2 = non0hist(pts, RectangularBinning(0.2), [1, 2])
# Test that we're actually getting normalised histograms
sum(h1) ≈ 1.0, sum(h2) ≈ 1.0
```

`ChaosTools.non0hist`

— Method`non0hist(bin_visits)`

Return the unordered histogram (vistitation frequency) over the array of `bin_visits`

, which is a vector containing bin encodings (each point encoded by an integer vector).

This method extends `ChaosTools.non0hist`

.

**Example**

```
using DynamicalSystems, CausalityToolsBase
pts = Dataset([rand(5) for i = 1:100]);
# Histograms from precomputed joint/marginal visitations
jv = joint_visits(pts, RectangularBinning(10))
mv = marginal_visits(pts, RectangularBinning(10), 1:3)
h1 = non0hist(jv)
h2 = non0hist(mv)
# Test that we're actually getting a normalised histograms
sum(h1) ≈ 1.0, sum(h2) ≈ 1.0
```

`CausalityToolsBase.AbstractParameterOptimisation`

— Type`AbstractParameterOptimisation`

Abstract type for parameter optimisation types.

`CausalityToolsBase.evaluate_kernel`

— Function` evaluate_kernel(kerneltype::Kernel, args...)`

Evaluate the kernel function of type `kerneltype`

with the provided `args`

.

**Example**

`evaluate_kernel(GaussianKernel(), d, σ`

evaluates the Gaussian

kernel for the distance `d`

and average marginal standard deviation `σ`

.

`CausalityToolsBase.evaluate_kernel`

— Method`evaluate_kernel(BoxKernel(), idxs_pts_within_range)`

Evaluate the the Box kernel by counting the number of points that fall within the range of a query point (the points falling inside a radius of `h`

has been precomputed).

`CausalityToolsBase.scaling`

— Function`scaling(kernel::Kernel, n_pts, h, dim)`

Return the scaling factor for `kernel`

for a given number of points `n_pts`

, bandwidth `h`

in dimension `dim`

.