[FieldTrip] clusterstat on multiple frequencies

jan-mathijs schoffelen jan.schoffelen at donders.ru.nl
Tue Dec 13 17:22:42 CET 2011


Hi Zita,

OK. I now understand the point. ft_clusterplot throws an error because it does not know how to collapse across frequencies. If the clusters have spectral extent (as well as spatial extent) it's a non-trivial question what are the channels to be plotted, because different channels can contribute different time and frequency points to the significant cluster. The time points are dealt with because ft_clusterplot shows the cluster evolving over time; the frequencies are not dealt with. FieldTrip does not make the choice of which channels to highlight for you (should all frequencies be significant for a given time point, or only one, or just a few?) and thus throws an error. However, if you have a priori reasons to expect your effect to occur in a particular frequency range (as you seem to do, because of your specification of the cfg before calling ft_freqstatistics), you can also specify cfg.avgoverfreq to 'yes', yielding a single observation per channel (and by construction the clustering only occurs over channels), making the plotting trivial. 

I hope this helps.

BW,

JM



On Dec 12, 2011, at 12:22 PM, Zita Eva Patai wrote:

> Dear Jan-Mathijs,
> 
> Sorry I was so vague, i thought maybe it was a common problem...
> 
> OK, so i was running a clusterstat with the following input ( main point, i want to look at the difference between conditions over a set of frequencies)
> ***
> load blk1_tf_avg
> load blk3_tf_avg
> 
> cfg = [];
> cfg.latency          = [1.0 1.5 ];
> cfg.frequency        = [4 8];
> cfg.method           = 'montecarlo';
> cfg.statistic        = 'depsamplesT';
> cfg.correctm         = 'cluster';
> cfg.clusteralpha     = 0.05;
> cfg.clusterstatistic = 'maxsum';
> cfg.minnbchan        = 2;
> cfg.tail             = 0;
> cfg.clustertail      = 0;
> cfg.alpha            = 0.025;
> cfg.numrandomization = 1000;
> cfg.feedback = 'yes';
> cfg.neighbours       = ft_neighbourselection(cfg, blk1_tf_avg); 
> subj = 15;
> design = zeros(2,2*subj);
> for i = 1:subj
>   design(1,i) = i;
> end
> for i = 1:subj
>   design(1,subj+i) = i;
> end
> design(2,1:subj)        = 1;
> design(2,subj+1:2*subj) = 2;
> 
>  
> cfg.design   = design;
> cfg.uvar     = 1;
> cfg.ivar     = 2;
>  
> [stat] = ft_freqstatistics(cfg, blk3_tf_avg, blk1_tf_avg);
>  
> save stat_tf_theta_1000_1500_bkey3vsbkey1 stat
> 
> 
> ***
> 
> The error comes during the plotting phase when it says that i should not have multiple frequencies, as the data should be averaged across frequencies. And it does save my file (stat_theta....) but and i can see the pos/neg clusters in the data structure...but i can't plot with :
> 
> cfg = [];
> cfg.highlightsymbolseries = ['*','*','.','.','.'];
> cfg.layout = '/Applications/fieldtrip/template/neuromag306mag.lay';
> cfg.contournum = 0;
> cfg.markersymbol = '.';
> cfg.alpha = 0.05;
> cfg.zparam = 'stat';
> ft_clusterplot(cfg,stat);
>  
> 
> I have also tried plotting with the script from the tutorial 
> 
> pos_cluster_pvals = [stat.posclusters(:).prob];
> pos_signif_clust = find(pos_cluster_pvals < stat.cfg.alpha);
> pos = ismember(stat.posclusterslabelmat, pos_signif_clust);
>  
> neg_cluster_pvals = [stat.negclusters(:).prob];
> neg_signif_clust = find(neg_cluster_pvals < stat.cfg.alpha);
> neg = ismember(stat.negclusterslabelmat, neg_signif_clust);
> 
> for k = 1:20;
> 
> etc.
> but this makes the plot really weird looking...and i am not sure how i can only plot the data from the frequencies i would like to display (in this case 4-8Hz). I know how to make the subtraction image (between my two conditions), but not how to specify the frequency range that i want displayed...
> 
> If this is too complicated, is there a way to average over a set of frequencies in the data, and then just input files into the permutation test that are already collapsed across the frequency range i am interested in?
> 
> 
> Thank  you!
> z
> 
> 
> On Mon, Dec 12, 2011 at 7:59 AM, jan-mathijs schoffelen <jan.schoffelen at donders.ru.nl> wrote:
> Hi Zita,
> 
> Could you provide some more information please? What plotting function are you using? What does the stat-structure look like etc.? With sufficient additional information we can try and reproduce the problem, and if it's a bug fix it. If it's not a bug, we may give you some hints to fool the system...
> 
> BW,
> 
> Jan-Mathijs
> 
> On Dec 11, 2011, at 8:28 PM, Zita Eva Patai wrote:
> 
>> Dear FT-ers,
>> 
>> I have tried to run a permutation test on time-frequency data, and would have like to see a statistical evealuation over a set of frequencies (ex: 4-8Hz)
>> 
>> It seems that the test itself runs, but it crashes when i try to plot the data, saying that 'stat' must not contain multiple frequencies.
>> 
>> I was wondering if there was a way to evaluate the difference between two conditions over a set range of frequencies?
>> 
>> Thank you!
>> zita
>> 
>> 
>> -- 
>> 
>> Zita Patai
>> DPhil Candidate, Experimental Psychology
>> University of Oxford
>> bcl.psy.ox.ac.uk/people/zita-eva-patai/
>> eva.patai at psy.ox.ac.uk
>> 
>> 
>> _______________________________________________
>> 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.nl
> Telephone: +31-24-3614793
> 
> 
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> 
> 
> 
> -- 
> 
> Zita Patai
> DPhil Candidate, Experimental Psychology
> University of Oxford
> bcl.psy.ox.ac.uk/people/zita-eva-patai/
> eva.patai at psy.ox.ac.uk
> 
> 
> _______________________________________________
> 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.nl
Telephone: +31-24-3614793

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20111213/f3a59c9a/attachment.html>


More information about the fieldtrip mailing list