clusterrandanalysis on scalar values + problem with topoplotER

Marco Buiatti marco.buiatti at GMAIL.COM
Fri Oct 13 19:03:36 CEST 2006

Dear Robert and Eric (and dear FieldTrippers),

thank you for your efficient response on my summer question. I
followed your advices and tried to use the function timelockstatistics
starting from the canonical comparison of ERPs within subjects but I
had some problems. Here I report my attempt to perform cluster
randomization analysis on ERPs relative to two conditions (W and PW).
For simplicity I took just 2 subjects. I report here all the steps
from loading eeglab datasets to computing cluster randomization
analysis to be sure that I am following the correct procedure. The
problem is
??? Undefined variable "data" or class "data.biol".
I used yesterday's FieldTrip version 20061012.

Can you help me with this?

Thank you in advance,


% Loading eeglab datasets
EEG50PW_s2 = pop_loadset( '02_ev_hpf0.2_lpf35_ep_soa50PW.set',
EEG50W_s2 = pop_loadset( '02_ev_hpf0.2_lpf35_ep_soa50W.set',
EEG50PW_s4 = pop_loadset( '04_ev_hpf0.2_lpf35_ep_soa50PW.set',
EEG50W_s4 = pop_loadset( '04_ev_hpf0.2_lpf35_ep_soa50W.set',

% Transform to FieldTrip format
data50PW_s2 = eeglab2fieldtrip( EEG50PW_s2, 'timelockanalysis' );
>> data50PW_s2
data50PW_s2 =
      label: {129x1 cell}
    fsample: 250
       elec: [1x1 struct]
        avg: [129x523 single]
        var: [129x523 single]
       time: [1x523 double]
     dimord: 'chan_time'
        cfg: [1x1 struct]

data50W_s2 = eeglab2fieldtrip( EEG50W_s2, 'timelockanalysis' );
data50W_s4 = eeglab2fieldtrip( EEG50W_s4, 'timelockanalysis' );
data50PW_s4 = eeglab2fieldtrip( EEG50PW_s4, 'timelockanalysis' );

% Computing grandaverage for each condition
cfg =[];
cfg.keepindividual = 'yes';
GA_50PW = timelockgrandaverage(cfg,data50PW_s2,data50PW_s4);
GA_50W = timelockgrandaverage(cfg,data50W_s2,data50W_s4)
GA_50W =
         label: {129x1 cell}
       fsample: 250
           avg: [129x523 double]
           var: [129x523 double]
          time: [1x523 double]
    individual: [2x129x523 double]
        dimord: 'subj_chan_time'
           cfg: [1x1 struct]

% Loading channel names and positions
data = eeglab2fieldtrip(EEG50PW_s2,'chanloc');

% Setting cfg for timelockstatistics
cfg.numrandomization = 500;
cfg.clusterthreshold = 'parametric';
cfg.clusteralpha = 0.05;
cfg.neighbours = neighbourselection(cfg,GA_50PW);
cfg.latency=[0 0.5];
cfg.method = 'montecarlo';
stat = timelockstatistics(cfg,GA_50W,GA_50PW);
Using the electrode configuration from the dataset.
there are on average 128.0 neighbours per channel
selected 129 channels
selected 126 time bins
selected 1 frequency bins
??? Undefined variable "data" or class "data.biol".

Error in ==> fieldtrip-20061012/private/prepare_design at 92

Error in ==> fieldtrip-20061012/private/statistics_wrapper at 212
  [cfg] = prepare_design(cfg);

Error in ==> timelockstatistics at 50
[stat] = statistics_wrapper(cfg, varargin{:});

On 8/29/06, Robert Oostenveld <r.oostenveld at> wrote:
> Dear Marco
> On 23 Aug 2006, at 14:53, Eric Maris wrote:
> >> 2) Is there a way to compute the null distribution by considering
> >> all possible reassignments of the conditions instead of the Monte
> >> Carlo approximation - in this case it would be feasible because
> >> all possible reassignments should be 2^9, right?
> > This is not possible with clusterrandanalysis. However, this is
> > possible with one of the new statistics functions in Fieldtrip that
> > will replace both clusterrandanalysis and sourcestatistics. The
> > function of interest for you is timelockstatistics, and you should
> > have a look at the help information for the lower-level function
> > statistics_montecarlo (which is called by timelockstatistics).
> > However, provided that you use more than 500 draws from the
> > permutation distribution, don't expect major changes in the output.
> We have an in-house version of fieldtrip, and an external FTP
> version. The in-house version is always slightly more advanced than
> the external version. Even though the timelockstatistics function was
> already included in recent external fieldtrip versions (the daily zip
> files) on the Donders FTP server, I just noticed that the underlying
> statistics_montecarlo function that Eric is referring to was still
> missing from the zip file. I have now also tagged that function (and
> some further subfunctions on which it depends) to be released in the
> external fieldtrip release. You should be able to use the
> timelockstatistics function with both the montecarlo and the complete
> permutation (cfg.numrandomization='all') based estimaes for the
> cluster statistics.
> I hope it works with the new function, if not then don't hesitate to
> contact us.
> Robert

Marco Buiatti - Post Doc

Cognitive Neuroimaging Unit  - INSERM U562
Service Hospitalier Frederic Joliot, CEA/DRM/DSV
4 Place du general Leclerc, 91401 Orsay cedex, France
Telephone: +33 1 69 86 77 65    Fax: +33 1 69 86 78 16
E-mail: marco.buiatti at    Web:

More information about the fieldtrip mailing list