clusterrandanalysis on scalar values + problem with topoplotER

Marco Buiatti marco.buiatti at GMAIL.COM
Thu Oct 19 12:13:18 CEST 2006


Dear Robert,

I followed your advice again, and made a (hopefully correct!) design
matrix  (I agree it clarifies what I am really computing). Now
timelockstatistics starts to compute the statistics on the correct
number of permutations, but as you can see from the results below, I
still had some problems that I do not understand. This time I took
three subjects instead of two, but the result does not depend on the
subject's number. I also checked that I did not pick up any two
identical datasets, and that ERPs are pretty standard (I expect no
difference on N1, and difference on P300).

Thank you in advance for your help,

Marco

% loading data from eeglab datasets
EEG50PW_s2 = pop_loadset( '02_ev_ep_soa50PW.set','F:\joachim\');
EEG50W_s2 = pop_loadset( '02_ev_ep_soa50W.set','F:\joachim\');
EEG50PW_s4 = pop_loadset( '04_ev_ep_soa50PW.set','F:\joachim\');
EEG50W_s4 = pop_loadset( '04_ev_ep_soa50W.set','F:\joachim\');
EEG50PW_s5 = pop_loadset( '05_ev_ep_soa50PW.set','F:\joachim\');
EEG50W_s5 = pop_loadset( '05_ev_ep_soa50W.set','F:\joachim\');

% Transform to FieldTrip format
data50PW{1} = eeglab2fieldtrip( EEG50PW_s2, 'timelockanalysis' );
data50W{1} = eeglab2fieldtrip( EEG50W_s2, 'timelockanalysis' );
data50W{2} = eeglab2fieldtrip( EEG50W_s4, 'timelockanalysis' );
data50PW{2} = eeglab2fieldtrip( EEG50PW_s4, 'timelockanalysis' );
data50W{3} = eeglab2fieldtrip( EEG50W_s5, 'timelockanalysis' );
data50PW{3} = eeglab2fieldtrip( EEG50PW_s5, 'timelockanalysis' );

% Loading channel names and positions
data = eeglab2fieldtrip(EEG50PW_s2,'chanloc');
for i=1:3
    data50W{i}.elec=data.elec;
    data50PW{i}.elec=data.elec;
end;

>> data50PW

data50PW =

    [1x1 struct]    [1x1 struct]    [1x1 struct]

>> data50PW{1}

ans =

      label: {129x1 cell}
    fsample: 250
       elec: [1x1 struct]
        avg: [129x523 single]
        var: [129x523 single]
       time: [1x523 double]
     dimord: 'chan_time'
        cfg: [1x1 struct]

% designing design matrix
cfg = []
cfg.design = [1 1 1 2 2 2; 1 2 3 1 2 3];
cfg.ivar = 1; % row with the independent variable (condition) in the design
cfg.uvar = 2; % row with the unit of observation (subject) in the design matrix

% Setting cfg for timelockstatistics
cfg.statistic='depsamplesT';
cfg.numrandomization = 'all';
cfg.alpha=0.05;
cfg.clusterstatistics='maxsum';
cfg.clusterthreshold = 'parametric';
cfg.clusteralpha = 0.05;
cfg.neighbourdist=4;
cfg.neighbours = neighbourselection(cfg,data50PW{1});
cfg.latency=[0 0.5];
cfg.method = 'montecarlo';
cfg.correctm = 'cluster';
cfg =

     []

Using the electrode configuration from the dataset.
there are on average 128.0 neighbours per channel

stat = timelockstatistics(cfg,data50W{:},data50PW{:});
selected 129 channels
selected 126 time bins
selected 1 frequency bins
using "statistics_montecarlo" for the statistical testing
using "statfun_depsamplesT" for the single-sample statistics
constructing randomized design
total number of measurements     = 6
total number of variables        = 2
number of independent variables  = 1
number of unit variables         = 1
number of control variables      = 0
number of within-block variables = 0
repeated measurement in variable 2 over 3 levels
number of repeated measurements in each level is 2 2 2
creating all possible permutations (8)
computing a parmetric threshold for clustering
computing statistic
Warning: Divide by zero.
> In fieldtrip-20061016\private\statfun_depsamplesT at 106
  In statistics_montecarlo at 249
  In fieldtrip-20061016\private\statistics_wrapper at 233
  In timelockstatistics at 50
estimated time per randomization is 0 seconds
computing statistic 1 from 8
Warning: Divide by zero.
> In fieldtrip-20061016\private\statfun_depsamplesT at 106
  In statistics_montecarlo at 278
  In fieldtrip-20061016\private\statistics_wrapper at 233
  In timelockstatistics at 50
computing statistic 2 from 8
Warning: Divide by zero.
> In fieldtrip-20061016\private\statfun_depsamplesT at 106
  In statistics_montecarlo at 278
  In fieldtrip-20061016\private\statistics_wrapper at 233
  In timelockstatistics at 50

... same output up to statistic 8 and then

??? Attempted to access (2); index out of bounds because numel()=1.

Error in ==> fieldtrip-20061016\private\clusterstat at 65
    postailcritval = cfg.clustercritval(2);

Error in ==> statistics_montecarlo at 305
  stat = clusterstat(cfg, statrand, statobs);

Error in ==> fieldtrip-20061016\private\statistics_wrapper at 233
  [stat, cfg] = statmethod(cfg, dat, cfg.design);

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

On 10/16/06, Robert Oostenveld <r.oostenveld at fcdonders.ru.nl> wrote:
> Hi Marco
>
> Your script looks ok.
>
> On 13 Oct 2006, at 19:03, Marco Buiatti wrote:
> > ??? Undefined variable "data" or class "data.biol".
> >
> > Error in ==> fieldtrip-20061012/private/prepare_design at 92
> >  nrepl=size(data.biol,1);
> >
> > Error in ==> fieldtrip-20061012/private/statistics_wrapper at 212
> >  [cfg] = prepare_design(cfg);
> >
> > Error in ==> timelockstatistics at 50
> > [stat] = statistics_wrapper(cfg, varargin{:});
>
> Yep, that is a known problem (sorry about that). The function
> prepare_design is not working properly. I suggest to make a design
> matrix in cfg.design by hand (similar to, but not completely the same
> as in SPM). It is not difficult, and it will also make you more clear
> how it works. Please have a look at
> https://listserv.surfnet.nl/scripts/wa.exe?
> A2=ind0607&L=FIELDTRIP&P=R3192&I=-3&X=77C04E25A87526C2B4
> or if that URL does not work, then search the fieldtrip discussion
> list archive for the string "cfg.design".
>
> best regards,
> Robert
>
> PS note that you can also use timelockstatistics on the
> 'componentanalysis' part of the EEGLAB data, in that case you cannot
> use channel clustering, but you still can use timepoint clustering
> (so cfg.neighbours  should be []). You shoudl only do that if the ICA
> components in the different EEG datasets are spatially the same (or
> sufficiently similar, e.g. after clustering over subjects in the new
> EEGLAB).
>


--
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 gmail.com    Web: www.unicog.org
***************************************************************



More information about the fieldtrip mailing list