FieldTrip support

Thomas Sauvigny tsauvigny at GOOGLEMAIL.COM
Wed Aug 25 11:26:03 CEST 2010

Dear fieldtrip users!



May I ask for your support because of a problem concerning my within-subject
permutation test (EEG-Data)?


The goal is to compare  two grandaverages with two different conditions,
each grandaverage consisting of 4 datasets from 4 subjects, each dataset
about 40-50 single trials.

I did the preprocessing, timelock and grandaverage: 4 datasets (called x1, 

x4) for the first condition with the following command:


cfg = [];

cfg.keeptrials = 'yes';

timelock1 = timelockanalysis(cfg, x1);

timelock2 = timelockanalysis(cfg, x2);

timelock3 = timelockanalysis(cfg, x3);

timelock4 = timelockanalysis(cfg, x4); = 'all'

cfg.latency = 'all'

cfg.keepindividual = 'yes'  

cfg.normalizevar = 'N-1'


da_test1= timelockgrandaverage (cfg, timelock1, timelock2, timelock3,

save da_test1


Same way for the second condition: da_test2

Now I start the permutation test (file attached). As result there are no
significant clusters highlighted (although there are  quite large
differences in the ERP-plot). I think because there is a mistake concerning
the number of single-trials which fieldtrip takes as the basis for the
statistic test.


Because the output in the command window shows:


selected 30 channels

selected 2501 time bins

selected 1 frequency bins

total number of measurements     = 8

total number of variables        = 2

number of independent variables  = 1

number of unit variables         = 1

number of within-cell variables = 0

number of control variables      = 0

using a permutation resampling approach

repeated measurement in variable 1 over 4 levels

number of repeated measurements in each level is 2 2 2 2 

computing a parmetric threshold for clustering

computing statistic

estimated time per randomization is 0 seconds

computing statistic 1 from 100

found 7 positive clusters in observed data

found 11 negative clusters in observed data

stat = 


                   prob: [30x2501 double]

            posclusters: [1x7 struct]

    posclusterslabelmat: [30x2501 double]

        posdistribution: [1x100 double]

            negclusters: [1x11 struct]

    negclusterslabelmat: [30x2501 double]

        negdistribution: [1x100 double]

                   mask: [30x2501 logical]

                   stat: [30x2501 double]

                    ref: [30x2501 double]

                 dimord: 'chan_time'

                  label: {30x1 cell}

                   time: [1x2501 double]

                    cfg: [1x1 struct]



cfg = 


    xlim: [0 0.1000]

    zlim: 'maxmin'


the input is timelock data with 30 channels and 4000 timebins

applying preprocessing options

averaging trials

averaging trial 1 of 4

averaging trial 2 of 4

averaging trial 3 of 4

averaging trial 4 of 4

reading layout from file easycap32ch-avg.lay


So, could this be the mistake that fieldtrip guesses “4” to be the number of
all trials (perhaps because 4  datasets in each grandaverage??) And how can
I solve this problem? Is there a way to account for the single-trial number
when using the permutation test?


Thank you very much for your help!!


Kind regards 


Thomas Sauvigny

Tübingen University


The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also and
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: da_test_statistic.m
URL: <>

More information about the fieldtrip mailing list