Weighted phase lag index

There is no "weighted phase lag index" in the connectivity menu bar. There is also no .m script for WPLI in the dir "brainstorm3\toolbox\process\functions". I think it is impossible for me to save and modify an existing script for the index. There is an FieldTrip function for calculating WPLI at senser level. Is there any possible way in Brainstorm to calculate the WPLI at source level?

1 Like

@Sylvain @leahy @hossein27en @peterd @Guiomar?


WPLI is indeed not part of Brainstorm’s distribution. We encourage you to use directed phase transfer entropy as a an alternative method. If you can provide a generic Matlab function (maybe adapted from Fieldtrip’s) that can produce WPLI measures on basic time series, we could then easily add it to Brainstorm’s library.

Thank you,

Hi everyone!
I just want to suggest that maybe BS can include this connectivity metric (wPLI), I was reading about it and it seems to be the best today EEG connectivity measure, It could be so useful to compute it in BS!

Well, it just a suggestion, I know it is not and easy thing to do and I'm grateful with all the BS team for the software they free offer to us: Thank you!

Pd: Would you consider add directional (causal) Connectivity Graphs (with bows) to BS, it could be wonderful to compute an EEG connectome using BS! (yes, I know, it's just and idea)

Thanks in advance

@hossein27en @Sylvain ?

I hope BS will have in the future this measure, and the chance to display directed measures on the graph option, with arrows, :slight_smile: just saying...

Yes please!
I've always wanted to compute wPLI with Brainstorm!!!
(I guess it will be the debiased form?)
Thank in advances!!!

I opened a PR to discuss the implementation:

Can you please comment directly in there?

Merged here:

just to be sure: that feature is not available on the GUI yet, right? :slight_smile:

Yes, it is, from the PLV process:

1 Like

just one more doubt: is this wPLI version the same as fieldtrip (debiased), since wPLI sometimes has a positive bias?


" ```
'wpli', weighted phase lag index (signed one, still have to
take absolute value to get indication of strength of
interaction. Note that this measure has a positive
bias. Use wpli_debiased to avoid this.
'wpli_debiased' debiased weighted phase lag index (estimates squared wpli)

Thanks in advance

just one more doubt: is this wPLI version the same as fieldtrip (debiased), since wPLI sometimes has a positive bias?


This is a different version with respect to the one implemented in fieldtrip, as a matter of fact they only have one possible over multiple trials, here we have an implementation keeping the time information, and one which you can in principle calculate on a single trial, as the difference between the angles.

Apart from this, I find this ironic


and I would not wrap my head too much around these issues :slight_smile:


thanks a lot!!! :smiley:

No worries. If you really are into it, the implementation is not difficult, but I wouldn't know how to put it in Brainstorm for the way trials are handled/averaged.

Here the code, in case @Francois or others have an idea on how to deal with the final part, I'll be happy to assist


% initializations below for the debiased version

for itrials=1:ntrials
    phaseA = HA(iA,:) ./ abs(HA(iA,:));
    phaseB = HB(iB,:) ./ abs(HB(iB,:));
     cdd = phaseA .* conj(phaseB);
    cdi = imag(cdd);

% below here the extra part for the debiased version


After this loop, Brainstorm simply does the average, that would be

On the other hand for the debiased version, this should be done after collecting the info from all the trials

and I don't know how to do this without breaking too much stuff.

1 Like