derive_temporalnetwork

derive_temporalnetwork(data, params)[source]

Derives connectivity from the data.

A lot of data is inherently built with edges

(e.g. communication between two individuals).

However other networks are derived from the covariance of time series

(e.g. brain networks between two regions).

Covariance based metrics deriving time-resolved networks can be done in multiple ways.

There are other methods apart from covariance based.

Derive a weight vector for each time point and then the corrrelation coefficient

for each time point.

Paramters

dataarray

Time series data to perform connectivity derivation on. (Default dimensions are: (time as rows, nodes as columns). Change params{‘dimord’} if you want it the other way (see below).

paramsdict

Parameters for each method (see below).

Necessary paramters

methodstr

method: “distance”,”slidingwindow”, “taperedslidingwindow”,

“jackknife”, “multiplytemporalderivative”. Alternatively, method can be a weight matrix of size time x time.

Different methods have method specific paramaters (see below)

Params for all methods (optional)

postpro : “no” (default). Other alternatives are: “fisher”, “boxcox”, “standardize”

and any combination seperated by a + (e,g, “fisher+boxcox”).

See postpro_pipeline for more information.

dimordstr

Dimension order: ‘node,time’ (default) or ‘time,node’. People like to represent their data differently and this is an easy way to be sure that you are inputing the data in the correct way.

analysis_idstr or int

add to identify specfic analysis. Generated report will be placed in ‘./report/’ + analysis_id + ‘/derivation_report.html

reportbool

False by default. If true, A report is saved in ./report/[analysis_id]/derivation_report.html if “yes”

report_pathstr

String where the report is saved. Default is ./report/[analysis_id]/derivation_report.html

Methods specific parameters

method == “distance”

Distance metric calculates 1/Distance metric weights, and scales between 0 and 1. W[t,t] is excluded from the scaling and then set to 1.

params[‘distance’]: str

Distance metric (e.g. ‘euclidean’). See teneto.utils.get_distance_function for more info

When method == “slidingwindow”

params[‘windowsize’]int

Size of window.

When method == “taperedslidingwindow”

params[‘windowsize’]int

Size of window.

params[‘distribution’]str

Scipy distribution (e.g. ‘norm’,’expon’). Any distribution here: https://docs.scipy.org/doc/scipy/reference/stats.html

params[‘distribution_params’]dict

Dictionary of distribution parameter, excluding the data “x” to generate pdf.

The data x should be considered to be centered at 0 and have a length of window size.

(i.e. a window size of 5 entails x is [-2, -1, 0, 1, 2] a window size of 6 entails [-2.5, -1.5, 0.5, 0.5, 1.5, 2.5])

Given x params[‘distribution_params’] contains the remaining parameters.

e.g. normal distribution requires pdf(x, loc, scale) where loc=mean and scale=std.

Say we have a gaussian distribution, a window size of 21 and params[‘distribution_params’] = {‘loc’: 0, ‘scale’: 5}.

This will lead to a gaussian with its peak at in the middle of each window with a standard deviation of 5.

When method == “temporalderivative”

params[‘windowsize’]int

Size of window.

When method == “jackknife”

No parameters are necessary.

Optional parameters:

params[‘weight-var’]array, (optional)

NxN array to weight the JC estimates (standerdized-JC*W). If weightby is selected, do not standerdize in postpro.

params[‘weight-mean’]array, (optional)

NxN array to weight the JC estimates (standerdized-JC+W). If weightby is selected, do not standerdize in postpro.

When method == ‘instantaneousphasesync’

No parameters are necessary.

returns:

G – Connectivity estimates (nodes x nodes x time)

rtype:

array

READ MORE

About the general weighted pearson approach used for most methods, see: Thompson & Fransson (2019) A common framework for the problem of deriving estimates of dynamic functional brain connectivity. Neuroimage. (https://doi.org/10.1016/j.neuroimage.2017.12.057)

See also

postpro_pipeline, gen_report