[FieldTrip] fieldtrip Digest, Vol 57, Issue 4

Marlies Vissers marliesvissers at gmail.com
Tue Aug 18 13:16:36 CEST 2015


Dear Eric, Jan-Mathijs, Arjan, and Jorn,



Thanks for your input on my questions. Jan-Mathijs’ reading of my post was
correct: with the connectivity matrix I indeed intended to refer to the
boolean matrix that defines the neighbour-structure of the channels.



The analysis I plan to run is a cross-subject brain-behavior correlation
(so over subjects) over my channel*time*frequency space, which should
subsequently be cluster-corrected. Thanks Arjan for pointing out that the
function I was using has been renamed!



My problem was that I obtained strange cluster shapes with non-neighbouring
electrodes only, while minnbchan was set to 2.

It might be important to mention again that I imported my data to Fieldtrip
for the permutation test, after running time-frequency composition with
custom Matlab routines. I structured my data such that the format matches
the format of data that was fully preprocessed and decomposed in Fieldtrip
(at least I tried to).



Jorn’s advice on how to run the low-level function channelconnectivity was
helpful. When doing so (inputting the data structure as it was passed by
ft_statistics_montecarlo), I noted that the boolean connectivity matrix
representing the channel-neighbours did not resemble the spatial
characteristics of the electrodes in my data. Furthermore, I noticed that
the channel field in my output (stat.cfg.channel) displayed a different
channel order than the one I constructed using ft_read_sens, which properly
fits the organization of my data.



I tried to solve this issue by manually hardcoding the correct
channellabels in the private function channelconnectivity. This seems to
work: my clusters now consist of neighbouring channels, and the channel
order in my output is similar to my input as well.



I am not sure whether my solution is valid, so I copied my edits below
(line18-25 in the original channelconnectivty function). I commented out
the line ‘chans = cfg.channel’, and hardcoded the channel locations
instead. If one of you sees something that is absolutely not intended to
happen, knows what might have gone wrong, or has any other advice or
comments, please let me know!



Thanks in advance,

Marlies



Edited code from the function channelconnectivity (orignal line
chans=cfg.channel is now commented out)

% check whether to use channels in the cfg or data

  if nargin < 2 && isfield(cfg, 'channel')

    %chans = cfg.channel;

     chans ={

    'Fp1'

    'AF7'

    'AF3'

    'F1'

    'F3'

    'F5'

    'F7'

    'FT7'

    'FC5'

    'FC3'

    'FC1'

    'C1'

    'C3'

    'C5'

    'T7'

    'TP7'

    'CP5'

    'CP3'

    'CP1'

    'P1'

    'P3'

    'P5'

    'P7'

    'P9'

    'PO7'

    'PO3'

    'O1'

    'Iz'

    'Oz'

    'POz'

    'Pz'

    'CPz'

    'Fpz'

    'Fp2'

    'AF8'

    'AF4'

    'AFz'

    'Fz'

    'F2'

    'F4'

    'F6'

    'F8'

    'FT8'

    'FC6'

    'FC4'

    'FC2'

    'FCz'

    'Cz'

    'C2'

    'C4'

    'C6'

    'T8'

    'TP8'

    'CP6'

    'CP4'

    'CP2'

    'P2'

    'P4'

    'P6'

    'P8'

    'P10'

    'PO8'

    'PO4'

    'O2'};

  elseif nargin == 2

    chans = data.label;

  else

    error('either the cfg needs to have both cfg.channel and
cfg.neighbours, or a second (data) input argument needs to be specified');

  end



On 5 August 2015 at 16:45, Arjen Stolk <a.stolk8 at gmail.com> wrote:

> And to briefly chime in on point 1, i believe that statfun has changed its
> name to correlationT some time ago.
> Yours, Arjen
>
>
>
> On Aug 5, 2015, at 6:11 AM, Schoffelen, J.M. (Jan Mathijs) <
> jan.schoffelen at donders.ru.nl> wrote:
>
> Hi Eric,
>
> Allow me to chime in to avoid any confusion from your side regarding point
> 2). I think that Marlies refers to a boolean spatial adjacency matrix that
> defines whether channels are neighbours, or not. In the code, this is
> referred to as a matrix named ‘connectivity’, which may not be the most
> obvious denomination. At some point in time we have made some low-level
> changes in the FieldTrip code, concerning the treatment of the spatial
> dimension for the clustering, which allows to treat spatial clustering
> along edges along a triangulated mesh (e.g. dipole locations defined on the
> cortical sheet) in the same way as spatial clustering on an extracranial
> channel array. Channel clustering is now a ‘special case’ where the
> cfg.neighbours structure array is converted into the boolean adjancency
> matrix, by the low-level channelconnectivity function, which is in
> fieldtrip/private.
>
> Best,
> Jan-Mathijs
>
> On Aug 5, 2015, at 2:54 PM, Maris, E.G.G. (Eric) <e.maris at donders.ru.nl>
> wrote:
>
> Dear Marlies,
>
> I did not go through all details of your correspondence with Jorn, but let
> me add a few remarks from a birds-eye perspective.
>
> 1. Your statfun is intersubjcorr, which evaluates the correlation over
> subjects between a neuronal and a behavioural variable, with the neuronal
> variable typically being high-dimensional, and thereby creating a multiple
> comparisons problem. Btw, I don’t like the name *inter*subjcorr, because
> the correlation is * over* subjects and not between (=inter).
> 2. I’m puzzled by where the connectivity matrix comes from, because your
> analysis does not involve between-channel quantities. In fact, from the
> perspective of the neuronal data, it is a typical univariate analysis in
> which every channel is treated separately. The only between-aspect in your
> study involves the relation between the (high-dimensional) neuronal
> variable and the (one-dimensional) behavioral variable.
> 3. Fieldtrip has no cluster-based statistics implemented that clusters
> channel-pairs, except for the trivial case in which you select a single
> reference channel for which you evaluate the coupling with all other
> channels (as in Maris, Schoffelen & Fries, 2007).
>
> best,
> Eric
>
>
>
>
> *From: *Marlies Vissers <marliesvissers at gmail.com>
> *Subject: **Re: [FieldTrip] Effect of cfg.minnbchan*
> *Date: *4 Aug 2015 16:38:57 CEST
> *To: *FieldTrip discussion list <fieldtrip at science.ru.nl>
> *Reply-To: *FieldTrip discussion list <fieldtrip at science.ru.nl>
>
>
> Dear Jörn,
>
>
> Thanks for your reply and suggestion! My neighbourhood-definitions look
> fine according to ft_neighbourplot.
> However, I am not sure whether the connectivity matrix in my output
> (stat.cfg.connectivity) is correct. For example, I inspected which channels
> are defined as neighbours of C5 in the connectivity matrix. Here, I assumed
> the channel order in this matrix resembles the channel order defined by the
> function ‘ft_read_sens’, as stored in the field elec.label.
> Using this particular organization of electrodes, the pattern of spatially
> neighbouring channels matches the strange spatial distribution of one of my
> resulting clusters.
> E.g., C5 seems to neighbour FC4 and Cz (among others). This pattern
> matches my strange result, where a cluster consisting of FC4, Cz, and C5,
> survived cluster correction with minnbchan set to 2.
>
>
> I am currently trying to establish whether my cfg.connectivity matrix is
> indeed the problem, and where this problem arises. One thing I suspect
> might be the cause is that the call to ‘channelconnectivity’ by
> ‘ft_statistics_montecarlo’ to construct the spatial neighbour structure,
> goes wrong. When I try to apply ‘channelconnectivity’ on my cfg structure
> directly (but not when running ft_freqstatistics), I get the following error
>  *‘Undefined function 'channelconnectivity' for input arguments of type
> 'struct'’*.
> If channelconnectivity was not properly run, it could be that the
> electrode ordering as defined by ft_read_sens is not adjusted to the order
> used by cfg.neighbours before construction of the connectivity matrix.
> However, when I just run ft_freqstatistics, I do not get an error that
> suggests any problems with ‘channelconnectivity’, so I am not entirely sure
> whether this error also occurs when running the analysis as a whole.
>
>
> Could you (or anyone else) give me any advice on how to make sure that the
> definition of neighbours in the connectivity matrix is constructed using
> the properly reordered vector with channel indices (the variable sel2 in
> channelconnectivity if I’m correct)?
>
>
> Thanks in advance!
>
>
> Best,
> Marlies
>
> On 3 August 2015 at 09:37, Jörn M. Horschig <jorn at artinis.com> wrote:
>
>> Dear Marlies,
>>
>> if I am not mistaken, the minnbchan option checks indeed if every
>> channels in a  cluster has at least the specified amount of channels in it
>> and removes it otherwise. The code is documented as follows:
>>     % For every (time,frequency)-element, it is calculated how many
>> significant
>>     % neighbours .this channel has If a significant channel has less than
>> minnbchan
>>     % significant neighbours, then this channel is removed from onoff.
>>
>> If something went wrong is hard to tell – it also depends on how the
>> neighbor structure looks like. If you do not have C3 or C1, then C5 can
>> indeed be defined as a neighbor of Cz, and if you do not have FC2, then Cz
>> could be called a neighbor of FC4. You can check how neighbors are defined
>> by using ft_neighbourplot. That’s the first check I’d do.
>>
>> Best,
>> Jörn
>>
>>
>> *--*
>>
>> *Jörn M. Horschig, PhD*, Software Engineer
>> Artinis Medical Systems <http://www.artinis.com/>  |  +31 481 350 980
>>
>> *From:* fieldtrip-bounces at science.ru.nl [mailto:
>> fieldtrip-bounces at science.ru.nl] *On Behalf Of *Marlies Vissers
>> *Sent:* Friday, July 31, 2015 3:27 PM
>> *To:* fieldtrip, donders <fieldtrip at donders.ru.nl>
>> *Subject:* [FieldTrip] Effect of cfg.minnbchan
>>
>> Dear Fieldtrippers.
>>
>> I have a question about the effect of the tuning parameter cfg.minnbchan
>> when performing cluster based permutation testing, since the spatial
>> characteristics of my clusters differ from what I expected to find given
>> the settings I used.
>>
>> I am running cross-subject correlations (n=31) between a behavioral
>> variable and a subj*channel*time*frequency matrix with power data
>> (preprocessed using EEGlab and decomposed outside of Fieldtrip), using
>> ft_freqstatistics with the function 'ft_statfun_intersubcorr'. Since I'd
>> like to avoid finding clusters with difficult-to-interpret shapes, I set
>> cfg.minnbchan to 2.
>>
>> My concern however, is that the resulting clusters do not always exist of
>> neighbouring electrodes. For example, one of the resulting clusters is
>> located at channels C5, Cz & FC4 (EEG, 64 electrodes), which are connected
>> through the other dimensions (time & frequency). In one of Eric Maris'
>> previous replies to an older post about cfg.minnbchan, I read that the
>> parameter cfg.minnbchan only concerns spatial (not time/freq) neighbours.
>> Does this mean that any cluster without spatially neighbouring electrodes
>> should have been rejected when minnbchan is set to 2?
>>
>> I would be very grateful if someone could let me know whether setting
>> cfg.minnbchan to 2 can -in principle- still yield clusters with
>> spatially-non-adjacent electrodes, or whether this result is likely due to
>> an error in my code. If the latter, I'd very much appreciate advice on
>> checks I could perform to detect the potential error.
>>
>> The code I used to run this analysis is pasted below.
>>
>> Thanks in advance!
>>
>> Best,
>> Marlies
>>
>> Marlies Vissers
>> PhD student
>>
>> University of Amsterdam | Department Brain and Cognition | Cognition and
>> Plasticity Laboratory
>> Weesperplein 4 | 1018 XA Amsterdam | 020 - 525 67 24 | M.E.Vissers at uva.nl
>>
>> ---
>>
>> % Import the electrode labels from an EEGlab set
>> elec = ft_read_sens('template_64.set','fileformat','eeglab_set');
>>
>> % Create matrix with TF data
>> freqData.freq = frex;                                        % Frequenies
>> of TF matrix
>> freqData.time = tx(TF_idx(1):TF_idx(2))./1000;  % Time samples in TF
>> matrix
>> freqData.dimord = 'subj_chan_freq_time';
>> freqData.label = elec.label;
>> freqData.powspctrm = tempTF;                       % tempTF is matrix
>> with subj*channels*freq*time
>>
>> % Create matrix with behavioral data, make sure the sizes match
>> behav.freq = frex;
>> behav.time =  tx(TF_idx(1):TF_idx(2))./1000;
>> behav.dimord = 'subj_chan_freq_time';              % Trick FT: there is
>> just behavioral data in this matrix
>> behav.label = elec.label;
>> behav.powspctrm = repmat(accEffect,[1
>> size(freqData.powspctrm,2),size(freqData.powspctrm,3),size(freqData.powspctrm,4)]);
>> % accEffect is 1*subj array
>>
>> % Set configuration for perm test
>> % Create cfg and insert parameters
>> cfg = [];
>> cfg.latency                = [0 1.250];
>> cfg.frequency            = [2 30];
>> cfg.channel               ='all';
>> cfg.method               = 'montecarlo';
>> cfg.statistic              = 'ft_statfun_intersubcorr';
>> cfg.type                   = ft_getopt(cfg, 'type', 'Spearman');
>> cfg.correctm            = 'cluster';
>> cfg.clusteralpha       = 0.05;
>> cfg.clusterstatistic    = 'maxsum';
>> cfg.minnbchan         = 2;
>> cfg.tail                    = 0;
>> cfg.clustertail           = 0;
>> cfg.alpha                 = 0.025;
>> cfg.numrandomization = 1000;
>>
>> % prepare_neighbours determines what sensors may form clusters: load
>> Biosemi 64 channel cap
>> cfg.template              =  [fieldtripdir thisSlash 'template' thisSlash
>> 'neighbours' thisSlash 'biosemi64_neighb.mat'];
>> cfg.layout                  =  [fieldtripdir thisSlash 'template'
>> thisSlash 'layout' thisSlash 'biosemi64.lay'];
>> cfg_neighb.method    =   'template';
>> cfg.neighbours          =   ft_prepare_neighbours(cfg_neighb,freqData);
>>
>> % Create design mat
>> subj = 31;
>> design = zeros(2,2*subj);
>> for i = 1:subj
>>   design(2,i) = i;
>> end
>> for i = 1:subj
>>   design(2,subj+i) = i;
>> end
>> design(1,1:subj) = 1;
>> design(1,subj+1:2*subj) = 2;
>> cfg.design       = design;
>> cfg.ivar = 1;
>> cfg.uvar = 2;
>>
>> % Run stats
>> [stat] = ft_freqstatistics(cfg,freqData,behav);
>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150818/cf99998b/attachment-0002.html>


More information about the fieldtrip mailing list