Transfer Entropy#
Transfer Entropy (TE) measures the amount of directed transfer of information between two random processes.
import delaynet as dn
# Calculate transfer entropy
result = dn.connectivity(
ts1, ts2, metric="transfer_entropy", approach="discrete", lag_steps=5
)
or more involved with ordinal transfer entropy
import delaynet as dn
# Calculate transfer entropy
result = dn.connectivity(
ts1,
ts2,
metric="transfer_entropy",
approach='ordinal',
lag_steps=5,
embedding_dim=3
)
Parameters:
approach: The approach to use for estimating transfer entropy. For available approaches, find the string ininfomeasure.transfer_entropy().lag_steps: Time lags to consider. An integer will consider lags [1, …, lag_steps]. Passing a list will consider the specified values as lags.hypothesis_type: Type of hypothesis test to use (‘permutation_test’ or ‘bootstrap’). Default is ‘permutation_test’.n_tests: Number of iterations or resamples to perform within the hypothesis test. Default is 20.Additional keyword arguments are passed directly to the transfer entropy estimator.
- connectivities.transfer_entropy(ts2, approach: str = '', lag_steps: int | list = None, hypothesis_type: str = 'permutation_test', n_tests: int = 20, **te_kwargs)
Transfer Entropy (TE) connectivity metric [ButhAZ25, Sch00].
- Parameters:
ts1 (numpy.ndarray) – First time series.
ts2 (numpy.ndarray) – Second time series.
approach (str) – Approach to use. See
infomeasure.transfer_entropy()for available approaches.lag_steps (int | list) – Time lags to consider. Can be a single integer or a list of integers. An integer will consider lags [1, …, lag_steps]. A list will consider the specified values as lags.
hypothesis_type (str) – Type of hypothesis test to use. Either ‘permutation_test’ or ‘bootstrap’. Default is ‘permutation_test’.
n_tests (int) – Number of iterations or resamples to perform within the hypothesis test.
te_kwargs – Additional keyword arguments for the transfer entropy estimator.
- Returns:
Best p-value and corresponding lag.
- Return type: