[FieldTrip] Cluster-based permutation - invalid dimension

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Thu Mar 10 08:37:33 CET 2022


Hi Valentina,

Thanks for your quite extensive report. Good that you delved into the code to hunt for the cause of the problem yourself. What’s not clear from your description, is whether the data are consistent with the neighbour specification to begin with. Importantly, the data.label needs to overlap with the neighbours.label (and the entries in neighblabel). Only if this condition is fulfilled, FieldTrip will be able to create an channel adjacency matrix from the neighbours structure array. You describe that the adjacency matrix is in line with your expectations, i.e. 129x129, so it sounds as if all is good with respect to how the neighbours have been defined.

I don’t understand why findcluster wants ’spatdimneighbstructmat’ to be 1x1. This can only be the consequence of the fact that the size of the onoff variable (in findcluster) is not according to the expectations. It might be worthwile to look into the consistency of the input data that resulted from the besa2fieldtrip conversion.

Best wishes,
Jan-Mathijs


On 7 Mar 2022, at 11:43, Valentina Jelinčić via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

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<https://urldefense.com/v3/__https://www.fieldtriptoolbox.org/getting_started/besa/*reading-in-data-files-from-besa__;Iw!!HJOPV4FYYWzcc1jazlU!_UNNbfTgZEb7EhR4onWzNj91HtI8L0ICGdFK0ymLihNBDFzw_BQoywdnr8TzahzmFsNWb-nrxotaqa2ttdOltX2zSbAMxzn2vPZsCw$>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<https://urldefense.com/v3/__https://www.fieldtriptoolbox.org/tutorial/cluster_permutation_freq/*permutation-test__;Iw!!HJOPV4FYYWzcc1jazlU!_UNNbfTgZEb7EhR4onWzNj91HtI8L0ICGdFK0ymLihNBDFzw_BQoywdnr8TzahzmFsNWb-nrxotaqa2ttdOltX2zSbAMxzn0egYfmA$>​, 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
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!_UNNbfTgZEb7EhR4onWzNj91HtI8L0ICGdFK0ymLihNBDFzw_BQoywdnr8TzahzmFsNWb-nrxotaqa2ttdOltX2zSbAMxznL2SUpwg$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220310/f204dfcc/attachment.htm>


More information about the fieldtrip mailing list