# [FieldTrip] Pb with ft_freqstatistics when averaged over channels : NaNs

laetitia.lalla at inserm.fr laetitia.lalla at inserm.fr
Tue Mar 29 12:08:10 CEST 2016

```

Hello again,

I actually solved my problem... It was pretty silly...

I needed to put 1 and 2 in my design matrix instead of 0 and 1...

It's in the code here :

in ft_statfun_indepsamplesT.m

row 77

% perform some checks on the design
sel1 = find(design(cfg.ivar,:)==1);
sel2 = find(design(cfg.ivar,:)==2);

Sorry about that... But maybe it can help other people ?

Have a nice day,

Laetitia

On 29-03-2016 10:50, laetitia.lalla at inserm.fr wrote:

> Dear FieldTrip community,
>
> I have a similar problem that may be of help here.
>
> It's my first message on this mailing list so, first of all, thank you very much for this free toolbox and the help you're providing. I'm a PhD student in Marseille (France) and I'm doing LFP recordings with tetrodes or silicon probes in freely moving rats. (I apologize in advance for this very detailed - and long - email).
>
> I'm trying to compare the power in a certain frequency range between 2 conditions (Trial and Baseline). I can see a clear rising during the trial and I want to run the statistics now.
>
> Like Zita, I'd like to run a cluster permutation test on data with frequency and time information, and my signal is averaged over channels.
>
> I followed this tutorial : http://www.fieldtriptoolbox.org/tutorial/natmeg/statistics. [1]Based on this, this is what I did :
>
> 1) I cut epochs of 6s (trials), filter [0.1 250Hz] and average over channels to have an averaged signal per probe (32 channels = 4 shanks = 1 probe).
>
> 2) I do the same for the baseline.
>
> 3) I create a structure data_all which gather all the epochs, with the appropriate design matrix (0 if baseline, 1 if trial).
>
> 4) I do a Time Frequency Transform averaged over time with ft_freqanalysis, 'mtmfft', with keeptrials='yes'. It give me, for each trial, a profile Power=f(Freq) averaged during the time of the epoch. The difference in my frequency range is very clear when I plot the profiles.
>
> 5) I use ft_freqstatistics like this :
>
> cfg = [];
>
> cfg.channel = 'Str';
>
> cfg.design = data_all.designmatrix;
>
> cfg.method = 'montecarlo';
>
> cfg.numrandomization = 500;
>
> cfg.statistic = 'indepsamplesT';
>
> cfg.ivar = 1;
>
> cfg.correctm = 'cluster';
>
> cfg.neighbours = [];
>
> cfg.alpha=0.05;
>
> cfg.tail=0;
>
> cfg.correcttail='alpha';
>
> [stat]=ft_freqstatistics(cfg, FR_alltrials)
>
> And this is not working because I have only NaNs...
>
> stat =
>
> stat: [NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN]
>
> prob: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]
>
> cirange: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
>
> mask: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
>
> ref: [NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN]
>
> dimord: 'chan_freq'
>
> freq: [1x25 double]
>
> label: {'Str'}
>
> cfg: [1x1 struct]
>
> Would you have an idea to resolve my problem ? Maybe I forgot to precise a parameter somewhere ?
>
> Thank you for your help!
>
> Best regards,
>
> Laetitia
>
> On 24-03-2016 13:15, Zita Eva Patai wrote:
>
>> Dear FT-ers
>>
>> I would like to run a cluster permutation test on data where i have frequency and time information, but have averaged over channels.
>>
>> I am setting my cfg for ft_freqstatistics as usual, but asking for all times and channels (no averaging). I am also not setting the cfg.neighbours option, because there aren't any. In this case it won't run and asks for that setting. If I then set cfg.neighbour = []; then it complains it cannot find the .powspctrm of my data.
>>
>> If I do not ask for cluster correction, it runs through fine and I get a stat structure out of it, but this is uncorrected.
>>
>> Is there an easy way to fix this?
>>
>> I am using the FT inside SPM12.
>>
>> Thanks very much,
>> zita
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

Links:
------
[1] http://www.fieldtriptoolbox.org/tutorial/natmeg/statistics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160329/468cb1ac/attachment-0002.html>
```

More information about the fieldtrip mailing list