# [FieldTrip] extracting individual trial phase connectivity

Julian Keil julian.keil at gmail.com
Mon Sep 22 11:09:29 CEST 2014

```Dear Hweeling,

sorry to have been so unclear.
Unfortunately, you'll have to leave the prepared field trip code a bit to compute the phase deviance.
What you'll want to do is:

1. Compute the Phase for all channels and trials:
Do a mtmfft with ft_freqanalysis and take the angle
2. For each trial, compute the phase difference between all channels:
3. For each combination, compute the mean over trials:
Use the circa_mean function from the above mentioned toolbox
4. For each combination, compute the deviance from the mean
Again, circa_dist is your friend here.

Again, PLV or Coherence don't work on the single trial level, thus ft_connectivityanalysis will not work for you.

Good Luck,

Julian

Am 22.09.2014 um 10:32 schrieb Hwee Ling Lee:

> Dear Roey, Julian and Tobias,
>
> Thanks for the feedback.
>
> Given your suggestions, I now intend to try to calculate the deviation of single trials from the mean phase difference (PLV). Pardon my ignorance, however, I still experience some problems with calculating plv for single trials.
>
> Using this code to extract PLV:
>
>     cfg                 = [];
>     cfg.trials          = 'all';
>     cfg.keeptrials      = 'yes';
>     cfg.channel         = {'all'};
>     cfg.removemean      = 'yes';
>     cfg.method           = 'plv';
>     cfg.channelcmb       = {cfg.channel, cfg.channel};
>     HLF_pre_c200plv      = ft_connectivityanalysis(cfg, HLF_pre_c200);
>
> Although I've specified to keep individual trials, ft_connectivityanalysis still show averaged PLV across trials for the output. Could anyone of you, or someone else, kindly highlight my mistake in my calculation?
>
> Thank you very much!
>
> Best wishes,
> Hweeling
>
>
>
> On 18 September 2014 16:39, Tobias Staudigl <tobias.staudigl at uni-konstanz.de> wrote:
> Dear Hweeling,
>
> I agree with Roey that coherence/PLV cannot be calculated for individual trials.
> However, you could try to use the deviation (in each single trial) from the mean phase as an approximation.
>
> Good luck!
> Tobias
>
>
>
> Am 18.09.2014 15:32, schrieb Roey Schurr:
>> Dear Hweeling,
>>
>> Unfortunately I am not yet familiar with the PPC measure, but I guess that being a pairwise phase consistancy measure, it is defined over a set of trials, and can not be calculated for any individual trial (like coherence, or PLV)?
>>
>> Just quickly reading through "The pairwise phase consistency: A bias-free measure of rhythmic neuronal synchronization" (Vinck et al., 2010), this seems to be the case.
>>
>> Hope this helps,
>> roey
>>
>> On Thu, Sep 18, 2014 at 3:30 PM, Hwee Ling Lee <hweeling.lee at gmail.com> wrote:
>> Dear all,
>>
>> I've got a question regarding extracting pairwise phase consistency of individual trials for each subject.
>>
>> Using the connectivity analyses tutorial as a reference, I extracted the PPC using the fourier information from the mtmfft (dpss taper).
>>
>> Here's an example of my code:
>>
>>     cfg                 = [];
>>     cfg.output          = 'fourier';
>>     cfg.channel         = {'all'};
>>     cfg.method          = 'mtmfft';
>>     cfg.keeptrials      = 'yes';
>>     cfg.tapsmofrq       = 5;
>>
>>     % find the index for the c200 condition
>>     pre_c200_idx = find(data8.trialinfo == 200);
>>
>>     cfg.trials          = pre_c200_idx;
>>     cfg.foilim          = [0 100]; % either the full range of frequencies (data2.hdr.Fs/2) or up to 100 Hz
>>     cfg.taper           = 'dpss';
>>     HLF_pre_c200        = ft_freqanalysis(cfg, data8);
>>
>> The PPC is extracted using this code:
>>
>>     cfg                 = [];
>>     cfg.trials          = 'all';
>>     cfg.keeptrials      = 'yes';
>>     cfg.channel         = {'all'};
>>     cfg.removemean      = 'yes';
>>
>>     cfg.method           = 'wppc';
>>     cfg.channelcmb       = {cfg.channel, cfg.channel};
>>
>>     HLF_pre_c200wppc      = ft_connectivityanalysis(cfg, HLF_pre_c200);
>>
>> Although I've specified to keep individual trials, my output is still a 'chan_freq' dimord variable. It does not contain any individual trial PPC information. Is there a way to extract the connectivity for individual trials?
>>
>> Thanks.
>>
>> Cheers,
>> Hweeling
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> --
> Dr. Tobias Staudigl
> Fachbereich Psychologie - ZPR
> Postfach ZPR
> 78457 Konstanz
> ZPR, Haus 12
> Tel.: +49 (0)7531 / 88 - 5703
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
> --
> =================================================
> Dr. rer. nat. Lee, Hwee Ling
> Postdoc
> German Center for Neurodegenerative Diseases (DZNE) Bonn
>
> Email 1: hwee-ling.lee<at>dzne.de
> Email 2: hweeling.lee<at>gmail.com
>
>
> Ernst-Robert-Curtius Strasse 12, 53117, Bonn, Germany
> =================================================
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140922/685ba17a/attachment-0002.html>
```