[FieldTrip] Source analysis/statistics single subject

Es, M.W.J. van (Mats) M.vanEs at donders.ru.nl
Wed Jul 27 17:04:15 CEST 2016


Hi FieldTrippers,

I am currently trying to do source analysis on an individual subject (using the fieldtrip tutorial as a guideline). I have baseline (*Bl) and activity (*Act) data. I constructed a common filter (using DICS) and added the filter to the cfg structure before doing sourceanalysis on the individual CSD's of the active and baseline data, respectively. Although I tried specifying cfg.keeptrials = 'yes' in every step, the output of ft_sourceanalysis is an average over trials:

sourceAct =

      freq: 11
    inside: [2004x1 logical]
       pos: [2004x3 double]
    method: 'average'
       avg: [1x1 struct]
       cfg: [1x1 struct]

This (I think) causes errors when I subsequently try to do sourcestatistics:

Error using ft_statistics_montecarlo (line 242)
could not determine the parametric critical value for clustering

Error in ft_sourcestatistics (line 205)
  [stat, cfg] = statmethod(cfg, dat, design);

Can anybody tell me what I'm doing wrong/how to do source statistics on an individual subject? You can find my code below. Thank you!
Mats


% calculate individual CSD
cfg = [];
cfg.method    = 'mtmfft';
cfg.output    = 'powandcsd';
cfg.tapsmofrq = 3;
cfg.foilim    = [11 11];
% cfg.keeptrials = 'yes';
freqAct = ft_freqanalysis(cfg, dataAct);
freqBl = ft_freqanalysis(cfg, dataBl);


% compute common filter
dataAll = ft_appenddata([], dataAct, dataBl);
cfg=[];
cfg.method = 'mtmfft';
cfg.output = 'powandcsd';
cfg.tapsmofrq = 3;
cfg. foilim = [11 11];
freqAll = ft_freqanalysis(cfg, dataAll);

cfg              = [];
cfg.method       = 'dics';
cfg.frequency    = 11;
cfg.grid         = grid; % caculated beforehand
cfg.headmodel    = headmodel; % caculated beforehand
cfg.dics.projectnoise = 'yes';
cfg.dics.lambda       = '5%';
cfg.dics.keepfilter   = 'yes';
cfg.dics.realfilter   = 'yes';
sourceAll = ft_sourceanalysis(cfg, freqAll);


% source analysis
cfg.grid.filter = sourceAll.avg.filter;
cfg.dics.fixedori = 'yes';
cfg.keeptrials = 'yes';
sourceAct  = ft_sourceanalysis(cfg, freqAct);
sourceBl = ft_sourceanalysis(cfg, freqBl);


% source statistics
cfg = [];
cfg.method      = 'montecarlo';
cfg.statistic   = 'ft_statfun_depsamplesT';
cfg.parameter   = 'avg.pow';
cfg.correctm    = 'cluster';
cfg.clusteralpha     = 0.05;
cfg.clusterstatistic = 'maxsum';
cfg.numrandomization = 1000;
cfg.alpha       = 0.05; % note that this only implies single-sided testing
cfg.tail        = 0;
cfg.clustertail      = 0;
cfg.uvar        = 1; % row of design matrix that contains unit variable (in this case: trials)
cfg.ivar        = 2; % row of design matrix that contains independent variable (the conditions)
design = [1:nTrials, 1:nTrials; ones(1, nTrials), 2*ones(1,nTrials)]';
cfg.design           = design';

stat = ft_sourcestatistics(cfg, sourceAct, sourceBl);


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


More information about the fieldtrip mailing list