<div dir="ltr">hi all,<div><br></div><div>I'm trying to trick Fieldtrip into doing cluster stats on "one-dimensional" EEG data. What I mean by that is that for every subject, and every electrode, I have only one value (average density of sleep spindles). So no time dimension, just a spatial one.</div><div><br></div><div>I assumed (but I'm not sure) that Fieldtrip always requires a time dimension, so I'm essentially copying the data over to a second sample, and set 'avgovertime' to yes.</div><div><br></div><div>I have a simple between-subjects design (at least for a first pass) with 16 and 20 subjects respectively.</div><div><br></div><div>my code:</div><div><br></div><div>







<font face="arial, helvetica, sans-serif">cfg=[];<br><br><b>%I get my chanlocs from eeglab</b></font></div><div><font face="arial, helvetica, sans-serif">cfg=eeglab2fieldtrip(myeeg,'chanloc');<br>cfg.rotate=90; %because eeglab and fieldtrip have different orientations<br>cfg.layout=ft_prepare_layout(cfg);<br>cfg.label=cfg.elec.label;<br><br>cfg_neighb.method    = 'distance';<br>cfg.neighbours       = ft_prepare_neighbours(cfg_neighb,cfg.elec);<br><br>cfg.channel          = {'EEG'};<br>cfg.latency          = 'all';<br>cfg.method           = 'montecarlo';<br>cfg.statistic        = 'ft_statfun_indepsamplesT';<br>cfg.correctm         = 'cluster';<br>cfg.clusteralpha     = 0.05; <br>cfg.clusterstatistic = 'maxsum';<br>cfg.minnbchan        = 2;<br>cfg.alpha              = 0.05;<br>cfg.tail = 2;<br>cfg.numrandomization = 1000;<br>cfg.avgovertime      = 'yes';</font></div><div><br></div><div>cfg.design: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2]<br>cfg.ivar: 1</div><div><br><b>%data to compare</b><br>spindledata.dimord='subj_chan_time'; %<br>spindledata.time=[0 1]; %pretend I have two timepoints<br>spindledata.label=cfg.label;<br><br>%<b>paste data (and use repmat to make a copy for the second timepoint)</b><br>spindledata1=spindledata; spindledata2=spindledata;<br>spindledata1.avg=repmat(allData(allLabels==1,:),[1 1 2]);<br>spindledata2.avg=repmat(allData(allLabels==2,:),[1 1 2]);<br><br><br>[statT] = ft_timelockstatistics(cfg,spindledata1,spindledata2);</div><div><br></div><div>Matlab's output:</div><div><br></div><div><div>total number of measurements     = 36</div><div>total number of variables        = 1</div><div>number of independent variables  = 1</div><div>number of unit variables         = 0</div><div>number of within-cell variables  = 0</div><div>number of control variables      = 0</div><div>using a permutation resampling approach</div><div>computing a parametric threshold for clustering</div><div>Reference to non-existent field 'critval'.</div><div>Error using ft_statistics_montecarlo (line 250)</div><div>could not determine the parametric critical value for clustering</div><div><br></div><div>Error in ft_timelockstatistics (line 181)</div><div>    [stat, cfg] = statmethod(cfg, dat, design);</div><div><br></div><div>Error in spindlestats (line 149)</div><div>[statT] = ft_timelockstatistics(cfg,spindledata1,spindledata2);</div><div><br></div><div><br></div><div>When I step into the ft_timelockstatistics to figure out what's happening, I notice that the cfg.channel field holds only 32 channels (while I have 58). Similarly, right before it crashes the "dat" variable is also a 32x36 matrix while I'd expect a 58x36.</div></div><div><br></div><div>All my data are free of Nans, so that's not it.</div><div><br></div><div>It's a great mystery to me so any suggestions are welcome.</div><div><br></div><div>Roy</div></div>