# [FieldTrip] ft_connectivityanalysis and PLV formula

Manuel Mercier manuel.mercier at einstein.yu.edu
Mon Jul 8 15:32:02 CEST 2013

```Dear Fieldtrip Community
I am still stuck with the implementation of PLV. To be sure that I understand properly the principle of Phase Locking Value, I wrote a code to compute it. That code (see below) gave me the same results as ft_connectivityanalysis.
plv = squeeze(abs(mean(exp(1i*(angle(data.fourierspctrm(:,electrodes_1,:,:)) -angle(data.fourierspctrm(:,electrode_2,:,:)))),1)));
(data.fourierspctrm being produced by ft_freqanalysis).

However, I then realized that the subtraction between the two angles should be done in the complex plane as in:
plv = squeeze(abs(mean(exp(1i*(angle(exp(1i*(angle(data.fourierspctrm(:,electrodes_1,:,:)))) - exp(1i*(angle(data.fourierspctrm(:,electrode_2,:,:))))))),1)));

I doubt that PLV computed through FT is wrong, but then I am circumspect since the first formula is somewhat no correct and give the same results a as ft_connectivityanalysis.
I went to FT code and got confused by the way ft_connectivity_corr use the cross spectrum to compute PLV.
I would greatly appreciate if someone could tell me where I am missing/misunderstanding something.

Manuel

________________________________

Manuel Mercier, PhD
Research Fellow

Cognitive Neurophysiology Laboratory,
Children’s Evaluation and Rehabilitation Center (CERC),
Departments of Pediatrics and Neuroscience
Albert Einstein College of Medicine,
1225 Morris Park Avenue
Bronx , NY 10461

phone: +1 (718) 862 1859
fax: +1 (718) 862 1807
________________________________
From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Manuel Mercier [manuel.mercier at einstein.yu.edu]
Sent: Friday, June 28, 2013 4:43 PM
To: fieldtrip at science.ru.nl
Subject: [FieldTrip] PLV formula

Dear Fieldtripers
Sometime ago I wrote for myself a function that was computing PLV and some related non parametric statistics.
(Phase Locking Value as define as the mean across trials of the phase angle difference recorded at two loci ; based on Lachaux et al., 1999, HBM).
I implemented PLV in matlab using the following formula:
plv = squeeze(abs(mean(exp(1i*(angle(data.fourierspctrm(:,cmb(1),:,:)) ...
-angle(data.fourierspctrm(:,cmb(2),:,:)))),1)));
with cmb(1) and cmb(2) being the indices of the electrodes of interest (between which PLV is computed).
I compared my results with the ft_connectivityanalysis function from Fieldtrip and the results were exactly the same.
So far so good.

But I recently went back to my code, and I was a little bit confused.
Since I was dealing with angles, I though that the best way to do the subtraction should be done in the complex plane
Like:
plv = squeeze(abs(mean(exp(1i*(angle(exp(1i*(angle(data.fourierspctrm(:,cmb(1),:,:)))) ...
- exp(1i*(angle(data.fourierspctrm(:,cmb(2),:,:))))))),1)));
(for instance if the two angles: pi/2 and -pi/2 the direct subtraction will give pi,
whereas in the complex plan it will be pi/2 - with the norm x2).

The result I got with this code is obviously different from the previous one, and what I got from Fieldtrip.
I went back to the archive of the mailing list but didn't find a clear answer to my point. Does anyone can enlighten me ?
Thanks !

Manuel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130708/44e77785/attachment-0001.html>
```