[FieldTrip] Source statistic issue - between trials

Michał Komorowski michak at is.umk.pl
Tue Jan 24 15:21:17 CET 2017


Dear community,

Currently I am working on source analysis from EEG data. I have some
trouble using ft_sourcestatistics do a between-trials analysis (single
subject).
I am trying to compare source from trials from task type A (ctrl) to with
trials from task type B (task). Mainly I rely on
http://www.fieldtriptoolbox.org/example/source_statistics .

For almost week I am trying find a solution, inculding testing
ft_sourcestatistics with different combinations of data:
1) source 1 : no ft_sourcedescriptives and no ft_sourceinterpolate used
2) source 2 : used ft_sourcedescriptives and no ft_sourceinterpolate used
3) source 3 : used ft_sourcedescriptives and used ft_sourceinterpolate

For cases 1) and 2) I get very similar errors "Invalid specification of the
design array. Error using ft_statistics_montecarlo (line 242) could not
determine the parametric critical value for clustering" (full error
messages at the bottom). In case 3) I cannot run ft_statistics because
there are no trials anymore.
I have tried changing design matrix, search community messages for some
advice and read related articles on fieldtriptoolbox site, but I have not
find the answer.

Any help would be appreciated.

Michał Komorowski


Statistics code:

cfg = [];
%cfg.dim         = source.dim; % there is no such field in the data
cfg.method      = 'montecarlo';
cfg.statistic   = 'ft_statfun_depsamplesT';
cfg.parameter   = 'pow';
cfg.correctm    = 'cluster';
cfg.numrandomization = 100;
cfg.alpha       = 0.05;
cfg.correcttail = 'alpha'; %
http://www.fieldtriptoolbox.org/faq/why_should_i_use_the_cfg.correcttail_option_when_using_statistics_montecarlo
cfg.tail        = 0; % two sided test
cfg.design(1,:) = design; % condition code
cfg.design(2,:) = [1:length(find(design==1)) 1:length(find(design==2))]; %
trial indices
cfg.uvar        = 2;  % unit of observation variable: trials
cfg.ivar        = 1;  % independent variable: condition code
% I think design matrix is ok according to:
http://www.fieldtriptoolbox.org/walkthrough#paired_comparison)

stat = ft_sourcestatistics(cfg, source);




Data structures and error messages

Case 1) no ft_sourcedescriptives and no ft_sourceinterpolate used

source =

         freq: 10
    cumtapcnt: [21x1 double]
       inside: [231420x1 logical]
          pos: [231420x3 double]
       method: 'rawtrial'
        trial: [1x21 struct]
           df: 21
          cfg: [1x1 struct]

the call to "ft_selectdata" took 1 seconds
using "ft_statistics_montecarlo" for the statistical testing
using connectivity of voxels in 3-D volume
using "ft_statfun_depsamplesT" for the single-sample statistics
constructing randomized design
total number of measurements     = 21
total number of variables        = 2
number of independent variables  = 1
number of unit variables         = 1
number of within-cell variables  = 0
number of control variables      = 0
using a permutation resampling approach
repeated measurement in variable 2 over 11 levels
number of repeated measurements in each level is 2 2 2 2 2 2 2 2 2 2 1
computing a parametric threshold for clustering
Error using ft_statfun_depsamplesT (line 84)
Invalid specification of the design array.
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);

>> cfg.design

ans =

     1     1     1     1     1     1     1     1     1     1     1     2
  2     2     2     2     2     2     2     2     2
     1     2     3     4     5     6     7     8     9    10    11     1
  2     3     4     5     6     7     8     9    10



Case 2) used ft_sourcedescriptives and no ft_sourceinterpolate used

source_app =

         freq: 10
    cumtapcnt: [21x1 double]
       inside: [231420x1 logical]
          pos: [231420x3 double]
       method: 'rawtrial'
        trial: [1x21 struct]
           df: 21
          cfg: [1x1 struct]

the call to "ft_selectdata" took 0 seconds
using "ft_statistics_montecarlo" for the statistical testing
using connectivity of voxels in 3-D volume
using "ft_statfun_depsamplesT" for the single-sample statistics
constructing randomized design
total number of measurements     = 21
total number of variables        = 2
number of independent variables  = 1
number of unit variables         = 1
number of within-cell variables  = 0
number of control variables      = 0
using a permutation resampling approach
repeated measurement in variable 2 over 11 levels
number of repeated measurements in each level is 2 2 2 2 2 2 2 2 2 2 1
computing a parametric threshold for clustering
Error using ft_statfun_depsamplesT (line 84)
Invalid specification of the design array.
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);



Case 3) used ft_sourcedescriptives and used ft_sourceinterpolate

source_mri_align_ctrl =

         freq: 10
      anatomy: [128x128x128 double]
     coordsys: 'spm'
          dim: [128 128 128]
          pos: [2097152x3 double]
    transform: [4x4 double]
         unit: 'mm'
       inside: [128x128x128 logical]
          pow: [2097152x1 double]
          cfg: [1x1 struct]

% there is no trials so one cannot conduct between-trials statistics ...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170124/a5620c9e/attachment-0001.html>


More information about the fieldtrip mailing list