[FieldTrip] Calculating single PLI value for a frequency band

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Mon Apr 4 15:01:20 CEST 2022

Hi Avi,

Fieldtrip uses ‘rpt’ as a generic indicator for a piece of data. Whether it is a ’trial’ in the traditional sense, i.e. related to a specific experimental event depends on the context.
If you have a long segment of data that is cut into 2-second snippets (e.g. by means of ft_redefinetrial) then FT calls the individual epochs a ’trial’.

If you want to have an estimate of how the PLI changes during the course of the recording, you’d need to somehow use a ‘moving window’ that selects chunks of ’trials’ selectively for a per-chunk computation of the PLI. Explicitly, for instance when you have 10 minutes of recording, chopped into 300 snippets of 2 seconds, compute the PLI in chunks of 50 trials, starting with trial 1-50, then 2-51 etc.

If you want get an estimate for the 8-13 you can either average the PLI across frequency bins, or titrate your spectral transformation such that your estimate at ~10 captures the 7-13 frequency band. This can be achieved by appropriately specifying the options for multitapering. For multitapering there is ample documentation on the fieldtrip website.

Best wishes,


On 4 Apr 2022, at 12:27, Avijit Chowdhury via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear Jan-Mathijs,

Thank you for your reply.

I am analysing resting state data so I don't have any "trials" as such, but that I would like to calculate PLI values for successive 2 sec segments in my data.

What does cfg.keeptrials = 'yes' accomplish in this case? My idea was that since this calculates the cross-spectral density at the trial level, the subsequent PLI is also calculated at the trial level.

Coming back to my initial question, how do I get the PLI across a certain frequency band (example: 8-13 hz, Alpha band) for each 2 sec segments? Currently with my script I am getting a PLI value with the dimensions : repetition * channel * channel * frequencies (in steps of 1 hz).


On Mon, Apr 4, 2022, 3:49 AM Schoffelen, J.M. (Jan Mathijs) via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:
Hi Avi,

PLI, like any other connectivity metric needs to be computed across some unit-of-observation in order for it to make sense.
In FieldTrip, the  UOs for connectivity analysis are always considered to be the trial dimension.

In other words, no there is no way to compute a PLI for an individual trial (although you could get a ‘proxy’ for the single trial PLI by computing a so-called pseudo value, which from the top of my head (but please look this up to be sure) is computed as: N*PLI(all) - (N-1)*PLI(loo), where PLI(avg) is the PLI computed across all repetitions, and PLI(loo) is the PLI computed using a leave-one-out strategy. You may also have a look at this paper: https://pubmed.ncbi.nlm.nih.gov/25917516/<https://urldefense.com/v3/__https://pubmed.ncbi.nlm.nih.gov/25917516/__;!!HJOPV4FYYWzcc1jazlU!5CMvX7RGdI5GxnlGFVrRspti_kuhd2yXmnZOlooH-gvNO6VeXwkMaOK9BP0k8Nbdyns4u4Pi000NyqGfBHTEY32LGS3Sy_176Rk_RQ$> or this one: https://pubmed.ncbi.nlm.nih.gov/17569862/<https://urldefense.com/v3/__https://pubmed.ncbi.nlm.nih.gov/17569862/__;!!HJOPV4FYYWzcc1jazlU!5CMvX7RGdI5GxnlGFVrRspti_kuhd2yXmnZOlooH-gvNO6VeXwkMaOK9BP0k8Nbdyns4u4Pi000NyqGfBHTEY32LGS3Sy_0KwV44wQ$>

Best wishes,

On 3 Apr 2022, at 06:42, Avijit Chowdhury via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear all,

I am novice to EEG analysis and I am trying to calculate Phase Lag Index for my resting state data.

I have redefined the data as 2 sec trials and then run ft_frequencyanalysis with “powandcsd” as cfg.output:

cfg = [];
cfg.length = 2;
data_trials = ft_redefinetrial(cfg, data);

cfg              = [];
cfg.method = 'mtmfft';
cfg.taper = 'hanning';
cfg.foilim = [8 13]; % I want to look only at alpha band
cfg.keeptrials = 'yes';
cfg.pad='nextpow2' ;
freq = ft_freqanalysis(cfg, data_trials);
 cfg = [];
cfg.method    = 'wpli';
PLI= ft_connectivityanalysis(cfg, freq);

With the above script, I get an output of PLI with the dimension of trials x channel x channel x frequency.

Is there a way I can get one PLI index for each trial, for each channel combination, across the frequency band I specified. Essentially, how can I get PLI values with dimensions: trials x channel x channel

I am very new to this so any help is appreciated. Also, If I am trying to filter my results to only the alpha band (8-13hz), is what I am doing the correct way to achieve this?

Thank you,

fieldtrip mailing list

fieldtrip mailing list
fieldtrip mailing list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220404/736c388d/attachment.htm>

More information about the fieldtrip mailing list