Network comparison¶
- class idtxl.network_comparison.NetworkComparison[source]
Set up network comparison between two experimental conditions.
The class provides methods for the comparison of networks inferred from data recorded under two experimental conditions A and B. Four statistical tests are implemented:
units of observation/ comparison type
stats_type
example
replications/ within a subject
dependent
base line (A) vs. task (B)
independent
detect house (A) vs. face (B)
sets of data/ between subjects
dependent
patients (A) vs. matched controls (B)
independent
male (A) vs. female (B) participants
Depending on the units of observations, one of two statistics methods can be used: compare_within() and compare_between(). The stats_type is passed as an analysis setting, see the documentation of the two methods for details.
Note that for network inference methods that use an embedding, i.e., a collection of variables in the source, the joint information in all variables about the target is used as a test statistic.
- calculate_link_te(data, target, sources='all')[source]
Calculate the information transfer for whole links into a target.
Calculate the information transfer for whole links as the joint information transfer from all variables selected for a single source process into the target. The information transfer is calculated conditional on the target’s past and, for multivariate TE, conditional on selected variables from further sources in the network.
If sources is set to ‘all’, a list of information transfer values is returned. If sources is set to a single source index, the information transfer from this source to the target is returned.
- Args:
- dataData instance
raw data for analysis
- targetint
index of target process
- sourceslist of ints | ‘all’ [optional]
return estimates for links from selected or all sources into the target (default=’all’)
- Returns:
- numpy array
information transfer estimate for each link
- compare_between(settings, network_set_a, network_set_b, data_set_a, data_set_b)[source]
Compare networks inferred under two conditions between subjects.
Compare two sets of networks inferred from two sets of data recorded under different experimental conditions within multiple subjects, i.e., data have been recorded from subjects assigned to one of two experimental conditions (units of observations are subjects).
- Args:
- settingsdict
parameters for estimation and statistical testing, see documentation of compare_within() for details
- network_set_anumpy array of dicts
results from network inference for multiple subjects observed under condition a
- network_set_bnumpy array of dicts
results from network inference for multiple subjects observed under condition b
- data_anumpy array of Data objects
set of data from which network_set_a was inferred
- data_bnumpy array of Data objects
set of data from which network_set_b was inferred
- Returns
- ResultsNetworkComparison object
results of network inference, see documentation of ResultsNetworkComparison()
- compare_links_within(settings, link_a, link_b, network, data)[source]
Compare two links within the same network.
Compare two links within the same network. Check if information transfer is different from information transfer in a second link.
Note that both links have to be part of the inferred network, i.e., there has to be significant effective connectivity for both links.
- Args:
- settingsdict
parameters for estimation and statistical testing
stats_type : str - ‘dependent’ or ‘independent’ for dependent or independent units of observation
cmi_estimator : str - estimator to be used for CMI calculation (for estimator settings see the documentation in the estimators_* modules)
tail_comp : str [optional] - test tail, ‘one’ for one-sided test A > B, ‘two’ for two-sided test (default=’two’)
n_perm_comp : int [optional] - number of permutations (default=500)
alpha_comp : float - critical alpha level for statistical significance (default=0.05)
permute_in_time : bool [optional] - if True, create surrogates by shuffling data over time. See Data.permute_samples() for settings for further options for surrogate creation
verbose : bool [optional] - toggle console output (default=True)
- link_aarray type
first link, array type with two entries [source target]
- link_barray type
second link, array type with two entries [source target]
- networkdict
results from network inference
- dataData object
data from which network was inferred
- Returns
- ResultsNetworkComparison object
results of network inference, see documentation of ResultsNetworkComparison()
- compare_within(settings, network_a, network_b, data_a, data_b)[source]
Compare networks inferred under two conditions within one subject.
Compare two networks inferred from data recorded under two different experimental conditions within one subject (units of observations are replications of one experimental condition within one subject).
- Args:
- settingsdict
parameters for estimation and statistical testing
stats_type : str - ‘dependent’ or ‘independent’ for dependent or independent units of observation
cmi_estimator : str - estimator to be used for CMI calculation (for estimator settings see the documentation in the estimators_* modules)
tail_comp : str [optional] - test tail, ‘one’ for one-sided test A > B, ‘two’ for two-sided test (default=’two’)
n_perm_comp : int [optional] - number of permutations (default=500)
alpha_comp : float - critical alpha level for statistical significance (default=0.05)
permute_in_time : bool [optional] - if True, create surrogates by shuffling data over time. See Data.permute_samples() for settings for further options for surrogate creation
verbose : bool [optional] - toggle console output (default=True)
- network_adict
results from network inference, condition a
- network_bdict
results from network inference, condition b
- data_aData object
data from which network_a was inferred
- data_bData object
data from which network_b was inferred
- Returns
- ResultsNetworkComparison object
results of network inference, see documentation of ResultsNetworkComparison()