[FieldTrip] a question regarding the code for PPC computation

Shen-Mou Hsu explena at gmail.com
Fri Jul 7 05:21:58 CEST 2017

Dear FT users,

I am writing to request how pairwise phase consistency (PPC) is
 implemented in Fieldtrip.

I trace the code and find that the following lines are relevant for PPC

input    = input./abs(input);  % normalize the crosspectrum
outsum   = nansum(input);      % compute the sum; this is 1 x size(2:end)
 c        = (outsum.*conj(outsum) - n)./(n*(n-1)); % do the pairwise thing
in a handy way

However, when I try to verify the results by performing the equations
indicated by Vinck et. al. (2010), the outcomes are totally different from
those performed using ft_connectivity_ppc.

My code is as follows and many thanks for any help.

nTrial = size(input,1);

ppc_all = [];
for j = 1:(nTrial-1)
    for k = (j+1):nTrial
        ppc_temp = input(j,1,:,:).*conj(input(k,1,:,:));
        ppc_all = [ppc_all;ppc_temp];

PPC = squeeze(abs(nansum(ppc_all,1)*2/(nTrial*(nTrial-1))));

Shen-Mou Hsu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170707/dd92897b/attachment-0001.html>

More information about the fieldtrip mailing list