<div dir="ltr"><div>Dear community,</div><div><br></div><div>Currently I am working on source analysis from EEG data. I have some trouble using ft_sourcestatistics do a between-trials analysis (single subject).</div><div>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 <a href="http://www.fieldtriptoolbox.org/example/source_statistics">http://www.fieldtriptoolbox.org/example/source_statistics</a> .</div><div><br></div><div>For almost week I am trying find a solution, inculding testing ft_sourcestatistics with different combinations of data:</div><div>1) source 1 : no ft_sourcedescriptives and no ft_sourceinterpolate used</div><div>2) source 2 : used ft_sourcedescriptives and no ft_sourceinterpolate used</div><div>3) source 3 : used ft_sourcedescriptives and used ft_sourceinterpolate</div><div><br></div><div>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.</div><div>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.</div><div><br></div><div>Any help would be appreciated.</div><div><br></div><div>Michał Komorowski</div><div><br></div><div><br></div><div>Statistics code:</div><div><br></div><div>cfg = [];</div><div>%cfg.dim         = source.dim; % there is no such field in the data</div><div>cfg.method      = 'montecarlo';</div><div>cfg.statistic   = 'ft_statfun_depsamplesT';</div><div>cfg.parameter   = 'pow';</div><div>cfg.correctm    = 'cluster';</div><div>cfg.numrandomization = 100;</div><div>cfg.alpha       = 0.05;</div><div>cfg.correcttail = 'alpha'; % <a href="http://www.fieldtriptoolbox.org/faq/why_should_i_use_the_cfg.correcttail_option_when_using_statistics_montecarlo">http://www.fieldtriptoolbox.org/faq/why_should_i_use_the_cfg.correcttail_option_when_using_statistics_montecarlo</a></div><div>cfg.tail        = 0; % two sided test</div><div>cfg.design(1,:) = design; % condition code</div><div>cfg.design(2,:) = [1:length(find(design==1)) 1:length(find(design==2))]; % trial indices</div><div>cfg.uvar        = 2;  % unit of observation variable: trials</div><div>cfg.ivar        = 1;  % independent variable: condition code</div><div>% I think design matrix is ok according to: <a href="http://www.fieldtriptoolbox.org/walkthrough#paired_comparison">http://www.fieldtriptoolbox.org/walkthrough#paired_comparison</a>)</div><div><br></div><div>stat = ft_sourcestatistics(cfg, source);</div><div><br></div><div><br></div><div><br></div><div><br></div><div>Data structures and error messages </div><div><br></div><div>Case 1) no ft_sourcedescriptives and no ft_sourceinterpolate used</div><div><br></div><div>source = </div><div><br></div><div>         freq: 10</div><div>    cumtapcnt: [21x1 double]</div><div>       inside: [231420x1 logical]</div><div>          pos: [231420x3 double]</div><div>       method: 'rawtrial'</div><div>        trial: [1x21 struct]</div><div>           df: 21</div><div>          cfg: [1x1 struct]</div><div><br></div><div>the call to "ft_selectdata" took 1 seconds</div><div>using "ft_statistics_montecarlo" for the statistical testing</div><div>using connectivity of voxels in 3-D volume</div><div>using "ft_statfun_depsamplesT" for the single-sample statistics</div><div>constructing randomized design</div><div>total number of measurements     = 21</div><div>total number of variables        = 2</div><div>number of independent variables  = 1</div><div>number of unit variables         = 1</div><div>number of within-cell variables  = 0</div><div>number of control variables      = 0</div><div>using a permutation resampling approach</div><div>repeated measurement in variable 2 over 11 levels</div><div>number of repeated measurements in each level is 2 2 2 2 2 2 2 2 2 2 1 </div><div>computing a parametric threshold for clustering</div><div>Error using ft_statfun_depsamplesT (line 84)</div><div>Invalid specification of the design array.</div><div>Error using ft_statistics_montecarlo (line 242)</div><div>could not determine the parametric critical value for clustering</div><div><br></div><div>Error in ft_sourcestatistics (line 205)</div><div>  [stat, cfg] = statmethod(cfg, dat, design);</div><div> </div><div>>> cfg.design</div><div><br></div><div>ans =</div><div><br></div><div>     1     1     1     1     1     1     1     1     1     1     1     2     2     2     2     2     2     2     2     2     2</div><div>     1     2     3     4     5     6     7     8     9    10    11     1     2     3     4     5     6     7     8     9    10</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span> </div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span> </div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span> </div><div>Case 2) used ft_sourcedescriptives and no ft_sourceinterpolate used</div><div><br></div><div>source_app = </div><div><br></div><div>         freq: 10</div><div>    cumtapcnt: [21x1 double]</div><div>       inside: [231420x1 logical]</div><div>          pos: [231420x3 double]</div><div>       method: 'rawtrial'</div><div>        trial: [1x21 struct]</div><div>           df: 21</div><div>          cfg: [1x1 struct]</div><div><br></div><div>the call to "ft_selectdata" took 0 seconds</div><div>using "ft_statistics_montecarlo" for the statistical testing</div><div>using connectivity of voxels in 3-D volume</div><div>using "ft_statfun_depsamplesT" for the single-sample statistics</div><div>constructing randomized design</div><div>total number of measurements     = 21</div><div>total number of variables        = 2</div><div>number of independent variables  = 1</div><div>number of unit variables         = 1</div><div>number of within-cell variables  = 0</div><div>number of control variables      = 0</div><div>using a permutation resampling approach</div><div>repeated measurement in variable 2 over 11 levels</div><div>number of repeated measurements in each level is 2 2 2 2 2 2 2 2 2 2 1 </div><div>computing a parametric threshold for clustering</div><div>Error using ft_statfun_depsamplesT (line 84)</div><div>Invalid specification of the design array.</div><div>Error using ft_statistics_montecarlo (line 242)</div><div>could not determine the parametric critical value for clustering</div><div><br></div><div>Error in ft_sourcestatistics (line 205)</div><div>  [stat, cfg] = statmethod(cfg, dat, design);</div><div><br></div><div>  </div><div>  </div><div>Case 3) used ft_sourcedescriptives and used ft_sourceinterpolate</div><div><br></div><div>source_mri_align_ctrl = </div><div><br></div><div>         freq: 10</div><div>      anatomy: [128x128x128 double]</div><div>     coordsys: 'spm'</div><div>          dim: [128 128 128]</div><div>          pos: [2097152x3 double]</div><div>    transform: [4x4 double]</div><div>         unit: 'mm'</div><div>       inside: [128x128x128 logical]</div><div>          pow: [2097152x1 double]</div><div>          cfg: [1x1 struct]</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>  </div><div>% there is no trials so one cannot conduct between-trials statistics ...</div></div>