[FieldTrip] ft_clusterplot error?

Jac Billington J.Billington at leeds.ac.uk
Tue Jan 22 15:00:41 CET 2019


Hi Stephen,


Thanks again for the reply and reassurance. ft_neighbourplot is looking fine.


I didn't expect the t-stats to look exactly the same but I'd have thought the occipital difference might have been more prominent in the t-stat. That said, my hypothesis is a central-parietal difference so perhaps I shouldn't worry about it! I'll double check the means and variance.


Thanks for your help.


Jac



Hi Jac,

To my eyes all looks fine to me!

- Your stat output seems to fit your raw difference rather well, I would
say! Why do you think otherwise? Sure, the t-stats are not the same as
absolute differences, but that's to be expected - the general topography
looks rather similar. If you don't trust the calculation you can perhaps
just do a MATLAB ttest on one electrode and compare that to the
freqstatistics output.
- Yes, you seem to be plotting the average over time ([5 5] in the plot)
and frequency ([10 10] in the plot). As I said earlier, I can't track the
clusterplot at the point (it also has no parameters in the image). Without
the code that you use, I can't see if anything else is going on.
- The significant cluster/electrodes you see in the clusterplot seems to
correspond to that blue central blog on the stats left of it in the same
image file just fine.
- You can check your neighbours with ft_neighbourplot

Since you are probably doing your statistics on average time and freq, the
only dimension that your cluster extends to is 'space', i.e. electrodes, so
for now you don't need to use clusterplot, but just highlight the
electrodes in ft_topoplotXX based on your stats. This is just to not make
it more confusing than it is - clusters that span time/freq/space are just
very hard to plot.

Cheers,
Stephen


Dr Jac Billington
Lecturer in Cognitive Neuroscience
School of Psychology, Rm G.06A
University of Leeds
Leeds, LS2 9JT
Tel: +44(0)113 343 6686

Jac Billington<http://medhealth.leeds.ac.uk/profile/1300/983/jac_billington>
CoNi Lab<http://www.leeds.ac.uk/coni/index.html>

________________________________
From: Jac Billington
Sent: 21 January 2019 12:51:26
To: fieldtrip at science.ru.nl
Subject: Re: ft_clusterplot error?


Dear Stephen,


Thank you for the useful reply, I've been doing some trouble shooting and it seems the output of  ft_freqstatistics doesn't seem to be reflecting my raw data. See "stat_discrepency.jpg" in dropbox link.


This plots condition 1 and 2 and the raw difference (as per your suggestion data_diff.powspctrm = data1.powspctrm - data2.powspctrm). I then plot stat.stat and the clusterplot output, clusterplot is representing my stat output.


In general I want to look at all channels, time 4-6seconds, for frequencies 8-12.  The latter 2 parameters I want averaged.


I noticed that the T-stat plot (of stat.stat) reports only one time and frequency. I presumed this was the average for display purposes (- double checked by plotting only that time and frequency in "stat_discrepency_onetimefreq.jpg" and it is different).


I think my design matrix is correct (following http://www.fieldtriptoolbox.org/tutorial/cluster_permutation_timelock/). I have 28 trials in con1 and 25 in con2, my design matrix is 1x53 reflecting the trials for the two conditions. I don't think I need to specify anything further until I move on to group analysis (this is just a single subject).




The only other issue I can think of is in the parameter:

        cfg.neighbours       = ft_prepare_neighbours(cfg_neighb, elec);


I create 'elec' by using ft_read_sens to read the preprocessing output from EEGlab.


        filenameA=strcat([det.subjects{s} '_postPreProICA_epoched_' det.epochs{1} '.set'])
        elec = ft_read_sens(filenameA)


Again, I'd be grateful for any pointers. My computation of ft_freqstatistics has not changed from the original post.

Thank you. Jac
<http://www.fieldtriptoolbox.org/tutorial/cluster_permutation_timelock/>


https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0

[https://www.dropbox.com/static/images/spectrum-icons/generated/content/content-folder_dropbox-large.png]<https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0>

fieldtrip<https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0>
www.dropbox.com
Shared with Dropbox






FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] ft_clusterplot error?
Message-ID:
        <CAFrxm=zMQuaKsyyBxOewfS5GgBYDMrXoUpHMk674WYFWXSfA+w at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi Jac,

I would start by plotting your (t)stats, and for simplicity doing that with
ft_singleplotER (cfg.param = 'stat') rather than ft_clusterplot.
Then try plotting the power-difference. This should not be more than a
subtraction of data_diff.powspctrm = data1.powspctrm - data2.powspctrm, .
No reshaping should be needed.
The problem is probably a mistake somewhere keeping track of
dimensions/latencies etc. which is tricky with clusters.
Also, make sure to clear your cfg before every function so you don't carry
the cfg of a previous function into the next. That will also help
readability and debugging.

HTH,
Stephen

________________________________
From: Jac Billington
Sent: 18 January 2019 18:07:04
To: fieldtrip at science.ru.nl
Subject: ft_clusterplot error?


Dear experts,


I've recently begun  using fieldtrip and have been following tutorials well. however, I have perhaps run into a problem with ft_clusterplot.


An example output is located in dropbox here: https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0


My negative cluster labels don't seem to be located in a cluster per se, or in regions with a greater raw effect. This seems at odds with tutorial examples and papers. Apologies if I'm missing something, but can this be correct?


I did have earlier errors ('  ft_error('unsupported dimord %s', dimord);') but I realised this was because dimensions of my stat.raweffect (64 5 200) were in conflict with collapsing time and frequency when running ft_freqstatistics. Reducing stat.raweefect to 64 1 solved this error, but I'm wondering if I have done something wrong.


My code is posted below and I'd happily be poited to some papers if I'm misunderstanding this.


Thank you in advance. Jac



  % load data  (from ft_freqanalysis)
        load(filename1);
        con1= freqScaling
        load(filename2);
        con2=freqScaling;

        %%%% run the stats:
        cfg = [];
        cfg.channel          =  'all';
        cfg.latency          = [4 6];
        cfg.frequency        = [8 12];
        cfg.method           = 'montecarlo';
        cfg.statistic        = 'ft_statfun_indepsamplesT';
        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 = 500;
        cfg.avgoverchan = 'no'
        cfg.avgovertime = 'yes'
        cfg.avgoverfreq = 'yes'
        % prepare_neighbours determines what sensors may form clusters
        cfg_neighb.method    = 'distance';
        cfg.neighbours       = ft_prepare_neighbours(cfg_neighb, elec);

        design = zeros(1,size(con1.powspctrm,1) + size(con2.powspctrm,1));
        design(1,1:size(con1.powspctrm,1)) = 1;
        design(1,(size(con1.powspctrm,1)+1):(size(con1.powspctrm,1)+ size(con2.powspctrm,1))) = 2;
        cfg.design           = design;
        cfg.ivar             = 1;


        [stat] = ft_freqstatistics(cfg, con1, con2);



       cfg=[]
       cfg.keeptrials    = 'no'
       cfg.latency          = [4 6];
       cfg.frequency        = [8 12];
       con1 = ft_freqdescriptives(cfg, con1);
       con2  = ft_freqdescriptives(cfg, con2);

       %%%% resize powerspec to avoid dimord error. Collapse freq/ time
       con1rs=mean(con1.powspctrm,3)   %%% collapse time dim
       con2rs=mean(con2.powspctrm,3)   %%% collapse time dim
       con1rs=mean(con1rs,2)   %%% collapse freq
       con2rs=mean(con2rs,2)
       stat.raweffect = con1rs-con2rs

       cfg.alpha  = 0.025;
       cfg.zparam = 'raweffect';
       cfg.zlim   = [-1 3];
        cfg.layout = 'biosemi64.lay';
       cfg.subplotsize = ([1 1]);
        ft_clusterplot(cfg, stat);


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190122/1d19e4eb/attachment-0002.html>


More information about the fieldtrip mailing list