frites.workflow.WfConnComod#

class frites.workflow.WfConnComod(inference='rfx', estimator=None, kernel=None, verbose=None)[source]#

Workflow of instantaneous pairwise comodulations and statistics.

This class allows to define a workflow for computing the instantaneous pairwise connectivity using mutual information and then to evaluate the significance with non-parametric statistics (either within-subjects or between subjects). Note that the MI is computed at each time point and across trials.

Parameters
inference{“ffx”, “rfx”}

Statistical inferences that is desired. Use either :

  • ‘ffx’ : fixed-effect to make inferences only for the population that have been used

  • ‘rfx’ : random-effect to generalize inferences to a random population.

By default, the workflow uses group level inference (‘rfx’)

estimatorMIEstimator | python:None

Estimator of mutual-information. If None, the Gaussian-Copula is used instead. Note that here, since the mutual information is computed between two time-series coming from two brain regions, the estimator should has a mi_type=’cc’

kernelnumpy:array_like | python:None

Kernel for smoothing true and permuted MI. For example, use np.hanning(3) for a 3 time points smoothing or np.ones((3)) for a moving average

See also

conn_get_pairs
conn_reshape_undirected

References

Friston et al., 1996, 1999 [8][9]

Attributes
mi

List of length (n_roi) of true mutual information.

mi_p

List of length (n_roi) of permuted mutual information.

tvalues

T-values array of shape (n_times, n_roi) when group level analysis is selected.

wf_stats

Get the workflow of statistics.

Methods

clean()

Clean computations.

fit(dataset[, mcp, n_perm, cluster_th, ...])

Run the workflow on a dataset.

clean()[source]#

Clean computations.

fit(dataset, mcp='cluster', n_perm=1000, cluster_th=None, cluster_alpha=0.05, n_jobs=- 1, random_state=None, **kw_stats)[source]#

Run the workflow on a dataset.

In order to run the worflow, you must first provide a dataset instance (see frites.dataset.DatasetEphy)

Warning

When performing statistics at the cluster-level, we only test the cluster size. This means that in your results, you can only discuss about the presence of a significant cluster without being precise about its spatio-temporal properties (see [17])

Parameters
datasetfrites.dataset.DatasetEphy

A dataset instance

mcp{‘cluster’, ‘maxstat’, ‘fdr’, ‘bonferroni’, ‘nostat’, python:None}

Method to use for correcting p-values for the multiple comparison problem. Use either :

  • ‘cluster’ : cluster-based statistics [default]

  • ‘maxstat’ : test-wise maximum statistics correction

  • ‘fdr’ : test-wise FDR correction

  • ‘bonferroni’ : test-wise Bonferroni correction

  • ‘noperm’ / None : no permutations are computed

n_permpython:int | 1000

Number of permutations to perform in order to estimate the random distribution of mi that can be obtained by chance

cluster_thpython:str, python:float | python:None

The threshold to use for forming clusters. Use either :

  • a float that is going to act as a threshold

  • None and the threshold is automatically going to be inferred using the distribution of permutations

  • ‘tfce’ : for Threshold Free Cluster Enhancement

cluster_alphapython:float | 0.05

Control the percentile to use for forming the clusters. By default the 95th percentile of the permutations is used.

n_jobspython:int | -1

Number of jobs to use for parallel computing (use -1 to use all jobs)

random_statepython:int | python:None

Fix the random state of the machine (use it for reproducibility). If None, a random state is randomly assigned.

kw_statspython:dict | {}

Additional arguments to pass to the selected statistical method selected using the stat_method input parameter

Returns
mi, pvaluesnumpy:array_like

DataArray of mean mutual information and p-values both of shapes (n_times, n_pairs)

References

Maris and Oostenveld, 2007 [13]

Examples using fit:

Estimate comodulations between brain areas

Estimate comodulations between brain areas
property mi#

List of length (n_roi) of true mutual information. Each element of this list has a shape of (n_subjects, n_times) if inference is ‘rfx’ (1, n_times) if inference is ‘ffx’.

property mi_p#

List of length (n_roi) of permuted mutual information. Each element of this list has a shape of (n_perm, n_subjects, n_times) if inference is ‘rfx’ (n_perm, 1, n_times) if inference is ‘ffx’.

property tvalues#

T-values array of shape (n_times, n_roi) when group level analysis is selected.

property wf_stats#

Get the workflow of statistics.

Examples using frites.workflow.WfConnComod#

Estimate comodulations between brain areas

Estimate comodulations between brain areas