[FieldTrip] Cluster-based permutation - invalid dimension

Valentina Jelinčić valentina.jelincic at kuleuven.be
Mon Mar 7 11:43:41 CET 2022


Hi everyone,

I am a total beginner in FT and have been trying to run a cluster-based permutation test (between-subjects) on time-frequency data exported from BESA Connectivity. I used the function besa2fieldtrip on .tfc data, which according to this tutorial https://www.fieldtriptoolbox.org/getting_started/besa/#reading-in-data-files-from-besa should produce output similar to ft_freqanalysis. I did have to do some tweaking to get the 2 power spectra to be 4-D matrices with the following dimord: subj_chan_freq_time. I defined my configuration using this tutorial https://www.fieldtriptoolbox.org/tutorial/cluster_permutation_freq/#permutation-test​, leaving almost all the settings as-is.

When I run ft_freqstatistics, I get the following readout:

Error using findcluster (line 66)
invalid dimension of spatdimneighbstructmat

Error in clusterstat (line 214)
  posclusobs = findcluster(tmp, connmat, cfg.minnbchan);

Error in ft_statistics_montecarlo (line 363)
  [stat, cfg] = clusterstat(cfg, statrand, statobs);

Error in ft_freqstatistics (line 193)
  [stat, cfg] = statmethod(cfg, dat, design);

I turned on debugging, and the error happens on this line:
if ~ismatrix(spatdimneighbstructmat) || ~all(size(spatdimneighbstructmat)==spatdimlength)
  ft_error('invalid dimension of spatdimneighbstructmat');
end

It seems that findcluster wants the size of my spatdimneighbstructmat to be 1 (size assigned to spatdimlength earlier in the function), but it is a 129*129 matrix (EGI 129 channel net). I find this odd, since the function documentation states:
"The neighbourhood structure for the first dimension is specified using spatdimneighbstructmat, which is a 2D (N1xN1) matrix. Each row and each column corresponds to a channel (combination) along the first dimension and along that row/column, elements with "1" define the neighbouring channel(s) (combinations)."

From that description, it seems that my spatdimneighbstructmat is correct, so I have trouble interpreting this error or figuring out what I should change.

All that said, I will say that I am still unsure what the "data" parameter in ft_prepare_neighbours should be. At the moment, I am putting the channel configuration in there, but this may be wrong.


Does anyone have experience with BESA data and/or defining neighbour structure for EGI nets, and wouldn't mind having a look at my data/configuration? Thank you very much in advance!


All the best,

Valentina


Valentina Jelinčić, M.Sc.
PhD student | Research Group Health Psychology | KU Leuven
Tiensestraat 102, room 02.86
3000 Leuven, Belgium
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220307/6f451843/attachment.htm>


More information about the fieldtrip mailing list