[FieldTrip] Question on group statistics for coherence differences

David Pedrosa david.pedrosa at ndcn.ox.ac.uk
Thu Jun 4 12:33:05 CEST 2015

Dear List,

I adressed a similar issue before (http://mailman.science.ru.nl/pipermail/fieldtrip/2015-May/009237.html), which I would like to extend with some more information and the used code. I am interested in computing a permutation test for coherence between two conditions based on cluster statistics. The conditions are rest and activation. However I do not manage to get the source statistics to work, as it gives me an error stating:

Error using ft_selectdata>getselection_pos (line 1123)
not yet implemented

Error in ft_selectdata (line 263)
if haspos,     [selpos,     cfg] = getselection_pos    (cfg, varargin{:}, cfg.tolerance, cfg.select); end

Error in ft_sourcestatistics (line 119)
[varargin{:}] = ft_selectdata(tmpcfg, varargin{:});

I assume my design for the stats is not correct, but I'm not sure what this error is actually telling me and I would appreciate any help.
Thanks in advance.

%% computing cross-spectral density matrices
cfg = [];
cfg.method    = 'mtmfft';
cfg.output    = 'fourier';
cfg.taper     = 'dpss';
cfg.tapsmofrq = 0.5*(abs(diff([3 8])));
cfg.frequency    = 5.5;
cfg.keeptrials = 'yes';
cfg.channel         = {'EEG', 'EMG'};
cfg.channelcmb      = {'EEG' 'EEG'; 'EMG' 'EEG'};
freqRest = ft_freqanalysis(cfg, data_rest);
freqAct = ft_freqanalysis(cfg, data_act);

%% computation of common filter
dataAll = ft_appenddata([], data_rest, data_act);
freqAll = ft_freqanalysis(cfg, dataAll);

%% Leadfield matrix generation
cfg                 = [];
cfg.elec            = sens;
cfg.vol             = vol;    % vol from individual MRI (computed before)
cfg.reducerank      = 3;
cfg.channel         = {'EEG'};
cfg.grid.resolution = 5;   % use a 3-D grid with a 5 mm resolution
cfg.grid.unit       = 'mm';
cfg.normalize       = 'yes';
[grid] = ft_prepare_leadfield(cfg);

%% Source analysis with DICS beamformer
cfg              = [];
cfg.frequency    = 5.5;
cfg.grid        = grid;
cfg.method       = 'dics';
cfg.refchan      = 'EMG';
cfg.channel         = {'EEG' 'EMG'};
cfg.tapsmofrq = 0.5*(abs(diff([3 8])));
cfg.vol          = vol;
cfg.dics.projectnoise = 'yes';
cfg.dics.lambda       = '5%';
cfg.dics.keepfilter   = 'yes';
cfg.dics.realfilter   = 'no';
sourceAll = ft_sourceanalysis(cfg, freqAll);
cfg.grid.filter = sourceAll.avg.filter; % common flter as computed before

sourceAct = ft_sourceanalysis(cfg, freqAct);
sourceRest = ft_sourceanalysis(cfg, freqRest);
sourceRest.time = data_rest.time;
sourceAct.time = data_act.time;

% At this point, data is concatenated into two structures, where each cell includes data of one subject for both rest (=baseline, sourceRest_all) and activation (sourceAct_all).

%%  Group statistics
cfg = [];
cfg.channel     = 'all';
cfg.avgovertime = 'yes';
cfg.parameter   = 'avg.coh';
cfg.method      = 'montecarlo';
cfg.statistic   = 'ft_statfun_depsamplesT';
cfg.alpha       = 0.05;
cfg.correctm    = 'cluster';
cfg.numrandomization = 1000;

cfg.design(1,1:2*nsubj)  = [ones(1,nsubj) 2*ones(1,nsubj)];
cfg.design(2,1:2*nsubj)  = [1:nsubj 1:nsubj];
cfg.ivar                = 1; % the 1st row in cfg.design contains the independent variable
cfg.uvar                = 2; % the 2nd row in cfg.design contains the subject number

stat = ft_sourcestatistics(cfg,sourceAct_all{:},sourceRest_all{:});

Dr. David Pedrosa

Clinical Research Fellow
Medical Research Council Brain Network Dynamics Unit at the University of Oxford
Nuffield Department of Clinical Neurosciences
University of Oxford
Level 6, West Wing
John Radcliffe Hospital, OX3 9DU
Tel: +44 (0)1865 572490
E-Mail: david.pedrosa at ndcn.ox.ac.uk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150604/189b13b2/attachment-0001.html>

More information about the fieldtrip mailing list