Simulate timeseries data that can be used to evaluate transfer entropy (TE) estimation methods.
te_datasim is an installable python package. Clone the repository, navigate to the cloned directory, and then use pip install . to install. Dependencies are numpy and scipy only.
The Simulator class represents the data generating process. The data generating process has two or more random variables [which each may be 1D or multi-D]. The causal relationships between the variables have fixed direction, but controllable strength. The strength of this interaction is measured by transfer entropy.
The Simulator class has three methods, corresponding to the three major steps in the workflow.
-
initialise an instance of a given simulator sub-class. This specifies the numeric parameters for the generative process, and the strength of the causal interactions.
-
generate data using the
.simulate(time=, seed=)method, which returns a tuple of numpy arrays, each corresponding to an observed time series for a given system variable. These arrays are each of size [time$\times$ vardim]. -
(optional) get a reference analytically computed TE, using the
.get_analytic_transfer_entropy(source=, dest=)method
Use your transfer entropy estimator of choice on the generated dataset, and compare the results to the analytic reference.
BVLinearGaussianSimulator implements a simple stochastic coupled system from https://doi.org/10.1063/5.0053519 To use, import via from te_datasim.lineargaussian import BVLinearGaussianSimulator.
- Causal graph:
- Equations:
- Strenth of causal interaction (TE) is controlled mainly by the
$\lambda$ parameter.
MVLinearGaussianSimulator implements n_dim independent channels of the bivariate linear Gaussian system, allowing for the simulation of vector valued time series data. Transfer entropy scales linearly with n_dim.
The data can also be concatenated with a further n_redundant_dim of i.i.d. noise, which, should leave the true TE unchanged.
to use, import via from te_datasim.lineargaussian import MVLinearGaussianSimulator
BVJointProcessSimulator implements a simple stochastic joint process system from https://doi.org/10.48550/arXiv.1912.07277 To use, import via from te_datasim.jointprocess import BVJointProcessSimulator.
- Causal graph:
- Equations:
- Strength if causal interaction (TE) is controlled mainly by the
$\lambda$ parameter.
MVJointProcessSimulator implements n_dim independent channels of the bivariate linear Gaussian system, allowing for the simulation of vector valued time series data. Transfer entropy scales linearly with n_dim.
The data can also be concatenated with a further n_redundant_dim of i.i.d. noise, which, should leave the true TE unchanged.
to use, import via from te_datasim.jointprocess import MVJointProcessSimulator.
NeuralSimulator implements a simulation of a neural system as described by the article "Network modelling methods for FMRI" by Smith et al (2011). The causal diagram is:
so called binary input_signals (across a suitable number of independent channels) are generated using a stochastic switching process with mean durations for the two states being exponentially distributed.
neural_activity across a specified number of neural regions is then generated in response to these input signals using a discrete time linear differential equation of the form:
Where
A bold_signal (corresponding to an fMRI readout for a given neural area) is simulated based on the time series of neural activity using a complex nonlinear differential equation system.
Finally, binned spike_counts are also generated using a non-homogenous poisson process with rates scaled by the neural activity.
Closed form solutions for the TEs of this system are generally not known precisely, however, the causal diagram should at least specify which TE values should be positive, and which should be 0.
To use, import via from te_datasim.neural import NeuralSimulator