[FieldTrip] ft_clusterplot error?
Jac Billington
J.Billington at leeds.ac.uk
Mon Jan 21 13:51:26 CET 2019
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/20190121/a60ab1c9/attachment-0002.html>
More information about the fieldtrip
mailing list