[FieldTrip] Question on group statistics for coherence differences
Schoffelen, J.M. (Jan Mathijs)
jan.schoffelen at donders.ru.nl
Thu Jun 4 13:12:15 CEST 2015
Hi David,
This rather uninformative error suggests, that the positions at which you estimated the source activity is not consistent across participants. FieldTrip’s data bookkeeping machinery checks for this, and the aim is to continue working only on those data-points (spatial locations, channels, frequency bins, time points) that all datasets have in common. This check and bookkeeping operation is performed by FieldTrip’s intermediate level function ft_selectdata, and the error you get relates to the fact that the function as of yet lacks functionality to compare and prune spatial locations (as opposed to channels, frequency bins and time points). Yet, to make a somewhat tedious and boring story short, for your purpose you probably shouldn't want to need this subselection, at least when ensuring that across participants the spatial locations are comparable for all of your ordinal dipole locations (for instance, even though the physical location expressed in 3D cartesian coordinates of a dipole location in the left motor cortex has different numbers for a subject with a large head, compared to a subject with a small head, if they are both represented in say the 100th row of your data matrix, they can be still used together).
In the code you pasted below it doesn’t seem that the grid positions for the individual subjects are directly comparable, and I suggest to look at the below link to build such a step into your own pipeline:
http://www.fieldtriptoolbox.org/example/create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_mni_space
Once you have the data represented such that equivalent dipole positions are comparable across participants, you can fool ft_sourcestatistics by replacing the sourceAct_all{x}.pos field with a set of positions that is the same for all subjects, e.g. using the positions defined on a ‘template grid’.
Best,
Jan-Mathijs
On Jun 4, 2015, at 12:33 PM, David Pedrosa <david.pedrosa at ndcn.ox.ac.uk<mailto:david.pedrosa at ndcn.ox.ac.uk>> wrote:
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;
nsubj=numel(sourceAct_all);
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<mailto:david.pedrosa at ndcn.ox.ac.uk>
http://www.mrcbndu.ox.ac.uk/
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150604/2f66beb8/attachment-0002.html>
More information about the fieldtrip
mailing list