Skip to content

Generalised delay reconstructions (convenience function)

te_embed for regular TE and conditional TE

# TransferEntropy.te_embedFunction.

te_embed(source::AbstractArray{T, 1}, target::AbstractArray{T, 1},
    k = 1, l = 1, m = 1, n = 0, η = 1, τ = 1)

Create an appropriate custom delay reconstruction from source and target for the purpose of computing transfer entropy from source to target.

Delay reconstruction

Denote the source time series by s(t) and target time series by t(t). Then the embedding vectors are on the the form

(T_{f}, T_{pp}, S_{pp}) where

T_f = (t(t + k*η), ..., t(t + 2*η), t(t + η)), T_pp = (t(t), t(t - τ), t(t - 2*τ), ..., t(t - lτ)), S_pp = (s(t), s(t - τ), s(t - 2*τ), ..., s(t - mτ))

and the total dimension of the reconstructed space is k + l + m.

Arguments

  • source: A source data series.
  • target: A target data series.
  • k: The dimension of the T_f component of the delay reconstruction.
  • l: The dimension of the T_{pp} component of the delay reconstruction.
  • m: The dimension of the S_{pp} component of the delay reconstruction.

Keyword arguments

  • η: The prediction lag that goes into the T_f component of the delay reconstruction.
  • τ: The embedding lag that goes into the T_{pp} and S_{pp} components of the delay reconstruction.

Examples

x, y, z = rand(100), rand(100), rand(100)

# Get embedding points and instructions for computing marginals.

# TE(x -> y)
# ==================
pts, vars = te_embed(x, y) # default k = l = m = 1
pts, vars = te_embed(x, y, 1, 1, 1) # specify k, l and m

pts, vars = te_embed(x, y, η = 2) # specify prediction lag
pts, vars = te_embed(x, y, τ = 2) # specify embedding lag

# Compute TE 
# ======================
transferentropy(pts, vars, RectangularBinning(5), VisitationFrequency())
te_embed(source, target, cond, k = 1, l = 1, m = 1, n = 1; η = 1, τ = 1)

Create an appropriate custom delay reconstruction from source, target and cond for the purpose of computing transfer entropy from source to target conditioned on cond.

Delay reconstruction

Denote the entries in the source time series by s(t), the entries of the target time series by t(t) and the entries of the conditional time series by c(t). Then the embedding vectors are on the the form

(T_{f}, T_{pp}, S_{pp}, C_{pp}) where

T_f = (t(t + k*η), ..., t(t + 2*η), t(t + η)), T_pp = (t(t), t(t - τ), t(t - 2*τ), ..., t(t - lτ)), S_pp = (s(t), s(t - τ), s(t - 2*τ), ..., s(t - mτ)), C_pp = (c(t), c(t - τ), c(t - 2*τ), ..., c(t - mτ))

and the total dimension of the reconstructed space is k + l + m + n.

Arguments

  • source: A source data series.
  • target: A target data series.
  • cond: A data series on which to condition.
  • k: The dimension of the T_f component of the delay reconstruction.
  • l: The dimension of the T_{pp} component of the delay reconstruction.
  • m: The dimension of the S_{pp} component of the delay reconstruction.
  • n: The dimension of the C_{pp} component of the delay reconstruction.

Keyword arguments

  • η: The prediction lag that goes into the T_f component of the delay reconstruction.
  • τ: The embedding lag that goes into the T_{pp}, S_{pp} and C_{pp} components of the delay reconstruction.

Examples

x, y, z = rand(100), rand(100), rand(100)

# Get embedding points and instructions for computing marginals.


# Conditional TE(x -> y | z)
# ==========================
pts, vars = te_embed(x, y, z) # default k = l = m = n = 1
pts, vars = te_embed(x, y, z, η = 2, τ = 3) # specify prediction and embedding lag
pts, vars = te_embed(x, y, z, 2, 1, 2, 1) # specify k = 2, l = 1, m = 2, n = 1
pts, vars = te_embed(x, y, z, 1, 2, 2, 1, η = 2, τ = 3) # specify k = 1, l = 2, m = 2, n = 1

# Compute TE 
# ======================
transferentropy(pts, vars, RectangularBinning(5), VisitationFrequency())