[FieldTrip] ft_freqstatistics on grandaveraged TFR data

Murphy, Kelly (Research Student) murphyk5 at aston.ac.uk
Tue Jan 10 15:36:48 CET 2017

Many thanks for your reply Jan-Mathijs,

Indeed for both structures, '.dimord' reads 'chan_freq_time'.  I can now get ft_freqstatistics to run sensibly but only when I add code so design(2,:)  to show 18 and 28 (i.e. group 1 n=8, group 2 n=8).  However, when I try to run ft_clusterplot I get the following error message, when stat.stat has the same chan_freq_time dimensions as ft_freqanalysis and ft_freqstatistics outputs (204x48x76).  This leads me to believe you are correct in pointing out that I have made a mistake in formatting my variables along the line:

"Error using ft_clusterplot (line 144)
this only works if either frequency or time is a singleton dimension"

Your help so far has been very valuable; but I am still unsure as to where I have gone wrong.

Thank you


PhD candidate
Department of Psychology
Aston University
Birmingham B4 7ET
United Kingdom

From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Schoffelen, J.M. (Jan Mathijs) [jan.schoffelen at donders.ru.nl]
Sent: 10 January 2017 13:40
To: FieldTrip discussion list
Subject: Re: [FieldTrip] ft_freqstatistics on grandaveraged TFR data

Hi Kelly,
It could be that you made a small mistake in formatting the input data to ft_freqstatistics (T_LLL and T_LLH). You may want to check whether these data structures have a ‘dimord’ which reads ‘rpt_chan_freq(_time)' or ‘subj_chan_freq(_time)’.


Senior Researcher, VIDI-fellow
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands

On 09 Jan 2017, at 22:44, Murphy, Kelly (Research Student) <murphyk5 at aston.ac.uk<mailto:murphyk5 at aston.ac.uk>> wrote:

Hello Fieldtrippers,

I am trying to use a monte carlo permutation test using ft_freqstatistics on grandaveraged data over 8 participants for two independent conditions but I am struggling to create the correct design matrix using the following code:

cfg = [];   cfg.method = 'montecarlo';    cfg.computestat = 'yes';  cfg.statistic = 'indepsamplesT'; cfg.numrandomization = 500;   cfg.correctm = 'fdr';  cfg.computecritval = 'yes'; cfg.alpha = 0.025; cfg.tail = 0; cfg.clustertail = 0;   cfg.clusterstatistic = 'maxsum';    cfg.minnbchan = 2;
design = zeros(1,size(T_LLL.powspctrm,1) + size(T_LLH.powspctrm,1));
design(1,1:size(T_LLL.powspctrm,1)) = 1;
design(1,(size(T_LLL.powspctrm,1)+1):(size(T_LLL.powspctrm,1)+size(T_LLH.powspctrm,1))) = 2;
cfg.design           = design;
cfg.ivar             = 1;
[stat] = ft_freqstatistics(cfg, T_LLL, T_LLH);

I am left with the following error message:
"Error using ft_freqstatistics (line 174)
the length of the design matrix (1) does not match the number of observations
in the data (2)"

I am struggling to see what errors I am making and I have tried my best to adhere to the guidelines outlined on the Fieldtrip tutorials, so if anyone with a keen eye can offer any help it would be most appreciated!

Many thanks


PhD candidate
Department of Psychology
Aston University
Birmingham B4 7ET
United Kingdom

fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170110/4278a84a/attachment-0002.html>

More information about the fieldtrip mailing list