calc_te function

Calculates the Transfer Entropy for two time series

Calculates the Transfer Entropy for two time series

calc_te( x, y, lx = 1, ly = 1, q = 0.1, entropy = "Shannon", shuffles = 100, type = "quantiles", quantiles = c(5, 95), bins = NULL, limits = NULL, burn = 50, seed = NULL, na.rm = TRUE )

Arguments

  • x: a vector of numeric values, ordered by time. Also allowed are xts, zoo, or ts objects.
  • y: a vector of numeric values, ordered by time. Also allowed are xts, zoo, or ts objects.
  • lx: Markov order of x, i.e. the number of lagged values affecting the current value of x. Default is lx = 1.
  • ly: Markov order of y, i.e. the number of lagged values affecting the current value of y. Default is ly = 1.
  • q: a weighting parameter used to estimate Renyi transfer entropy, parameter is between 0 and 1. For q = 1, Renyi transfer entropy converges to Shannon transfer entropy. Default is q = 0.1.
  • entropy: specifies the transfer entropy measure that is estimated, either 'Shannon' or 'Renyi'. The first character can be used to specify the type of transfer entropy as well. Default is entropy = 'Shannon'.
  • shuffles: the number of shuffles used to calculate the effective transfer entropy. Default is shuffles = 100.
  • type: specifies the type of discretization applied to the observed time series:'quantiles', 'bins' or 'limits'. Default is type = 'quantiles'.
  • quantiles: specifies the quantiles of the empirical distribution of the respective time series used for discretization. Default is quantiles = c(5,95).
  • bins: specifies the number of bins with equal width used for discretization. Default is bins = NULL.
  • limits: specifies the limits on values used for discretization. Default is limits = NULL.
  • burn: the number of observations that are dropped from the beginning of the bootstrapped Markov chain. Default is burn = 50.
  • seed: a seed that seeds the PRNG (will internally just call set.seed), default is seed = NULL.
  • na.rm: if missing values should be removed (will remove the values at the same point in the other series as well). Default is TRUE.

Returns

a single numerical value for the transfer entropy

Examples

# construct two time-series set.seed(1234567890) n <- 1000 x <- rep(0, n + 1) y <- rep(0, n + 1) for (i in seq(n)) { x[i + 1] <- 0.2 * x[i] + rnorm(1, 0, 2) y[i + 1] <- x[i] + rnorm(1, 0, 2) } x <- x[-1] y <- y[-1] # calculate the X->Y transfer entropy value calc_te(x, y) # calculate the Y->X transfer entropy value calc_te(y, x) # Compare the results calc_te(x, y, seed = 123) calc_te(y, x, seed = 123) transfer_entropy(x, y, nboot = 0, seed = 123)

See Also

calc_ete andtransfer_entropy