[FieldTrip] Coherence of single trials

Aaron T aaron__t at hotmail.com
Tue Nov 27 19:24:30 CET 2012


On a moderately related note, using a cfg setup that is very similar to Monika's  I am encountering dimord errors with ft_connectivityplot I don't understand.  

cfg = [];
cfg.channel    = {'all'};  
cfg.channelcmb = {refchan 'all'}; 
v= ft_frequencyanalysis 

cfg = [];cfg.channel =  {refchan 'all'}; w = ft_connectivityanalysis (cfg, v);
cfg = []cfg.parameter =  'cohspctrm';cfg.zlim = [0 1]z = ft_connectivityplot (cfg, w);


When using .channelcmb in this way I encounter a dimord error:  "must be chan_chan_freq or chancmb_freq").   
The issue seems to be related to use of ft_frequencyanalysis; v receives an rpttap_chan_freq dimord (as I believe it should), but when subsequently using the .coh method with ft_connectivityanalysis variable w receives a dimord of chan_freq (and even if manually changed thereafter, is subsequently returned to this value by ft_checkdata calls).
Is there an alternative way to use .channelcmb to set up channel pairs for analysis in ft_frequencyanalysis for subsequent use with connectivityanalysis and plot? 
Thanks for any suggestions.
Aaron













Date: Tue, 27 Nov 2012 07:56:05 -0500
From: sherrykhan78 at gmail.com
To: fieldtrip at science.ru.nl
Subject: Re: [FieldTrip] Coherence of single trials

Dear Monika,

As Jan-Mathijs correctly mention Coherence is measure across trials, for single trial coherence value is one, the method I mention above also can not escape from this mathematical truth, the associated bias with the method is almost 0.9.

Sheraz


On Tue, Nov 27, 2012 at 6:49 AM, jan-mathijs schoffelen <jan.schoffelen at donders.ru.nl> wrote:

Dear Monika,
It may have escaped your attention while digging to the previous posts, but the question has been raised (and answered ;-) ) before. Just for the very very last time I will make the following statement:

Single trial coherence estimates cannot be computed!

Perhaps the font size and color will make it memorable ;-). This is due to the simple fact that coherence is defined across observations. If you have just a single observation, due to the mathematics involved, the coherence value will be 1.
Since you want to do group analysis, I think you really should compute the coherence per condition, where each condition should consist of a sufficient number of trials. Assuming that the time domain data is organised such that you have all trials (irrespective of the condition) in a single structure, do something like this.

for each subject  cfg = [];  cfg.output = 'fourier';  cfg.method = 'mtmfft'/'mtmconvol'  cfg.keeptrials = 'yes';  ...
  freq = ft_freqanalysis(cfg, data);
  cfg = [];  cfg.channelcmb = {something here}  cfg.trials = [indices of trials belonging to condition 1];  coh1 = ft_connectivityanalysis(cfg, freq); % compute coherence across the trials for condition 1
  cfg.trials = [indices of trials belonging to condition 2];  coh2 = ft_connectivityanalysis(cfg, freq); % compute coherence across the trials for condition 2end


Good luck,
Jan-Mathijs

On Nov 27, 2012, at 12:25 PM, Monika Mellem wrote:
Thank you Sheraz and Jan-Mathijs for your help!  

Sheraz, if you do have the code to keep single-trial coherence estimates, I would much appreciate it if you could pass it along (monikamellem at gmail.com).  

And Jan-Mathijs, okay, the necessary statistics make sense, and I will z-transform the data too.  But as far as you know, is there no implementation already in Fieldtrip to keep the single-trial coherence estimates?  I assumed setting cfg.keeptrials = 'yes' would do this, but is there something else I'm missing as this doesn't seem to work?  I would prefer to try what Fieldtrip has implemented first before integrating Sheraz's code into my version of Fieldtrip.



Thank you very much!
Monika


On Tue, Nov 27, 2012 at 3:14 AM, jan-mathijs schoffelen <jan.schoffelen at donders.ru.nl> wrote:


Hi Monika,
If you want to test across subjects in  a paired fashion, you can use depsamplesT. Your dependent variable then should contain for each subject and condition the coherence (which of course should be estimated across all trials belonging to that condition). Even better would be to perform a so-called Z-transformation to the data. For some inspiration you could have a look at the following paper: http://www.jneurosci.org/content/31/18/6750.long


Best,
Jan-Mathijs
On Nov 27, 2012, at 12:22 AM, Monika Mellem wrote:

Dear Fieldtrippers,

I am trying to calculate coherence estimates on individual trials of our EEG data and then want to perform a within-subjects statistical test, but so far I have not been able to figure out how to do this.  I am able to calculate coherence for our 22 subjects and then perform statistics on the grand average, so I understand the basic usage of these functions (ft_freqanalysis, ft_connectivityanalysis, ft_freqgrandaverage, ft_freqstatistics).  But now we want to do statistical testing on individual subjects.  Is it possible to keep coherence for individual trials in Fieldtrip as they seem necessary for this statistical analysis?




I am setting cfg.keeptrials = 'yes' as an input to ft_freqanalysis, and get the cross-spectra of individual trials (I also tried computing the fourier spectra but it made no difference in the following step).  However, when computing the coherence in ft_connectivityanalysis, Fieldtrip averages over the trials.  Is there a way to output coherence for individual trials instead?  Please see the full cfg structure settings below.




Also, I did look into the option of cfg.statistic = 'indepsamplesZcoh' as an input to ft_freqstatistics since previous posts suggested this was for single subject coherence statistics, but our data is paired as the same stimulus appears in the 2 conditions we are comparing.  Is there a paired test for single subject coherence testing, or should we use cfg.statistic = 'depsamplesT'?




Many thanks for any suggestions you may have!
Monika
________________Monika Mellem
PhD Candidate


Interdisciplinary Program in Neuroscience
Georgetown University

Washington, DC
msm79 at georgetown.edu
202-687-2687


***********************************************************************
cfg settings for ft_freqanalysis and ft_connectivityanalysis
***********************************************************************



cfg = [];
cfg.prestim = -0.5;  
cfg.poststim = 1.5;  
cfg.foilim = [2 30];
cfg.freqrange = 'low';
% cfg.output     = 'fourier';
cfg.output     = 'powandcsd';
cfg.method = 'mtmconvol';



cfg.keeptrials = 'yes';  
cfg.channel    = {'all'};  
cfg.channelcmb = {refchan 'all'}; 

cfgcoh=[];
cfgcoh.channelcmb = cfg.channelcmb;
cfgcoh.method = 'coh';

v = genvarname(['CRSP_' condition '_low']);



eval([v '= ft_multitaper_powcoh_EGI(cfg, data);']);  %Wrapper around ft_freqanalysis 

w = genvarname(['COH_' condition '_low']);
eval([w '= ft_connectivityanalysis(cfgcoh, ' v ');']);






_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip













Jan-Mathijs Schoffelen, MD PhD 
Donders Institute for Brain, Cognition and Behaviour, 
Centre for Cognitive Neuroimaging,
Radboud University Nijmegen, The Netherlands


Max Planck Institute for Psycholinguistics,Nijmegen, The Netherlands
J.Schoffelen at donders.ru.nlTelephone: +31-24-3614793





_______________________________________________

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







Jan-Mathijs Schoffelen, MD PhD 
Donders Institute for Brain, Cognition and Behaviour, 
Centre for Cognitive Neuroimaging,
Radboud University Nijmegen, The Netherlands

Max Planck Institute for Psycholinguistics,Nijmegen, The Netherlands
J.Schoffelen at donders.ru.nlTelephone: +31-24-3614793




_______________________________________________

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 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20121127/d1ce32d1/attachment.html>


More information about the fieldtrip mailing list