[FieldTrip] eeglab2fieldtrip --> cluster based permutation analysis help

Arnaud Delorme arnodelorme at gmail.com
Thu Feb 11 00:15:39 CET 2021


Dear Abdullah,

You can perform Fieldtrip-based cluster correction analysis within EEGLAB (from the command line, use the std_stat function). You do not need to export the data to Fieldtrip. Also, since you are probably dealing with multiple subjects (although not necessarily), the eeglab2fieldtrip function would not work. It is for single-subject data only.
You can also use the EEGLAB function statcond_fieldtrip.m (editing this function will also show you how to call Fieldtrip functions should you want to).

You might also want to try TFCE (threshold free cluster enhancement) which is similar to cluster correction but is not constrained by the arbitrary p-value threshold. This is available within LIMO.

Best wishes,

Arno

> On Feb 10, 2021, at 8:56 AM, Abdullah Mosabbir <amosabbir at research.baycrest.org> wrote:
> 
> Hello FieldTrip community,
> 
> I would like to take pre-processed eeglab data into field trip for cluster based permutation analysis of ERP. After using the eeglab2fieldtrop function, the output 'eegdata' is the following:
> 
> eegdata = 
> 
>   struct with fields:
> 
>       label: {1×76 cell}
>     fsample: 512
>        elec: [1×1 struct]
>       trial: {1×46 cell}
>        time: {1×46 cell}
>         cfg: [1×1 struct]
> 
> I average the trials together for a grand average manually to make eegdata.avg, and I delete eegdata.trials. Then I collect multiple subjects under one structure called Resp_Inc_SE1, to be compared to another group Resp_Inc_SE2. My cfg structure is the following:
> 
> cfg         = [];
> cfg.channel = Resp_Inc_SE1{1}.label';
> cfg.latency = 'all';
> 
> cfg.method           = 'montecarlo';
> cfg.statistic        = 'depsamplesT';
> cfg.correctm         = 'cluster';
> cfg.clusteralpha     = 0.05;
> cfg.clusterstatistic = 'maxsum';
> cfg.minnbchan        = 1;
> cfg.neighbours     = neighbours5;
> cfg.neighbourdist  = .6;
> cfg.tail             = 0;
> cfg.clustertail      = 0;
> cfg.alpha            = 0.025;
> cfg.numrandomization = 500;
> cfg.frequency = [0 50];
> %cfg.dim = [64 3072];
> 
> Nsubj  = 7;
> design = zeros(2, Nsubj*2);
> design(1,:) = [1:Nsubj 1:Nsubj];
> design(2,:) = [ones(1,Nsubj) ones(1,Nsubj)*2];
> 
> cfg.design = design;
> cfg.uvar   = 1;
> cfg.ivar   = 2;
> 
> I run 
> [stat] = ft_timelockstatistics(cfg, Resp_Inc_SE1{:}, Resp_Inc_SE2{:})
> 
> I get the error message:
> 
> Error using findcluster (line 53)
> invalid dimension of spatdimneighbstructmat
> 
> Error in clusterstat (line 197)
>       posclusobs = findcluster(reshape(postailobs,
>       [cfg.dim,1]),channeighbstructmat,cfg.minnbchan);
> 
> Error in ft_statistics_montecarlo (line 347)
>   [stat, cfg] = clusterstat(cfg, statrand, statobs);
> 
> Error in ft_timelockstatistics (line 184)
>     [stat, cfg] = statmethod(cfg, dat, design);
> 
> If anyone can help with this I would appreciate it. I suspect I need to configure the data structure in a way that field trip can process its functions, but without prior examples I don't know how that structure would be. Note, I created an elec file based on the 64 channel model and realigned and eventually used to create cfg.neighbours5.
> 
> I would appreciate any help, thanks.
> 
> -- 
> Abdullah Mosabbir, PhD
> Post Doctoral Researcher
> 
> cfg.design = design;
> cfg.uvar   = 1;es
> 3560 Bathurst Street
> Toronto, Ontario, M6A 2E1
> 
> P: 416-785-2500 x3561
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202




More information about the fieldtrip mailing list