<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;">
<p style="margin-top:0; margin-bottom:0">Dear Stephen,</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Thank you for the useful reply, I've been doing some trouble shooting and it seems the output of
<span>ft_freqstatistics doesn't seem to be reflecting my raw data. See "stat_discrepency.jpg" in dropbox link.</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>This plots condition 1 and 2 and the raw difference (as per your suggestion
<font size="2"><span style="font-size:11pt">data_diff.powspctrm = data1.powspctrm - data2.powspctrm</span></font>). I then plot stat.stat and the clusterplot output, clusterplot is representing my stat output.
<br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>In general I want to look at all channels, time 4-6seconds, for frequencies 8-12. The latter 2 parameters I want averaged.
<br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>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 "<span>stat_discrepency_onetimefreq</span>.jpg"
and it is different).</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>I think my design matrix is correct (following
<a href="http://www.fieldtriptoolbox.org/tutorial/cluster_permutation_timelock/" class="OWAAutoLink" id="LPlnk220108" previewremoved="true">
http://www.fieldtriptoolbox.org/tutorial/cluster_permutation_timelock/</a>). 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). <br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>The only other issue I can think of is in the parameter:</span></p>
<p style="margin-top:0; margin-bottom:0"><span><span> cfg.neighbours = ft_prepare_neighbours(cfg_neighb, elec);</span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>I create 'elec' by using <span>ft_read_sens</span> to read the preprocessing output from EEGlab.</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span></span></p>
<div> filenameA=strcat([det.subjects{s} '_postPreProICA_epoched_' det.epochs{1} '.set'])<br>
elec = ft_read_sens(filenameA)</div>
<div><br>
</div>
<div><br>
Again, I'd be grateful for any pointers. My computation of <span>ft_freqstatistics</span> has not changed from the original post.
<br>
</div>
<div><br>
</div>
<div>Thank you. Jac<br>
</div>
<a href="http://www.fieldtriptoolbox.org/tutorial/cluster_permutation_timelock/" class="OWAAutoLink" id="LPlnk137825" previewremoved="true"></a><br>
<p></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><a href="https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0" class="OWAAutoLink" id="LPlnk495425" previewremoved="true">https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0</a></span></p>
<div id="LPBorder_GT_15480739252670.8938326113797403" style="margin-bottom:20px; overflow:auto; width:100%; text-indent:0px">
<table id="LPContainer_15480739252600.5933951556764678" role="presentation" style="width:90%; background-color:rgb(255,255,255); overflow:auto; padding-top:20px; padding-bottom:20px; margin-top:20px; border-top:1px dotted rgb(200,200,200); border-bottom:1px dotted rgb(200,200,200)" cellspacing="0">
<tbody>
<tr style="border-spacing:0px" valign="top">
<td id="ImageCell_15480739252620.10286152176141006" colspan="1" style="width:250px; display:table-cell; padding-right:20px">
<div id="LPImageContainer_15480739252620.3721998266096741" style="background-color:rgb(255,255,255); height:200px; margin:auto; display:table; width:200px">
<a id="LPImageAnchor_15480739252620.27295467828228925" href="https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0" target="_blank" style="display:table-cell; text-align:center"><img id="LPThumbnailImageID_15480739252630.465449905223261" style="display:inline-block; max-width:250px; max-height:250px; height:200px; width:200px; border-width:0px; vertical-align:bottom" width="200" height="200" src="https://www.dropbox.com/static/images/spectrum-icons/generated/content/content-folder_dropbox-large.png"></a></div>
</td>
<td id="TextCell_15480739252630.45911273105218275" colspan="2" style="vertical-align: top; padding: 0px; display: table-cell; position: relative;">
<div id="LPRemovePreviewContainer_15480739252630.27757472407818573"></div>
<div id="LPTitle_15480739252630.6446782183033298" style="top:0px; color:rgb(95,188,162); font-weight:400; font-size:21px; font-family:"wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height:21px">
<a id="LPUrlAnchor_15480739252640.5550262244154163" href="https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0" target="_blank" style="text-decoration:none">fieldtrip</a></div>
<div id="LPMetadata_15480739252650.03730944220933219" style="margin:10px 0px 16px; color:rgb(102,102,102); font-weight:400; font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:14px">
www.dropbox.com</div>
<div id="LPDescription_15480739252660.1487034587158177" style="display:block; color:rgb(102,102,102); font-weight:400; font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:20px; max-height:100px; overflow:hidden">
Shared with Dropbox</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<p></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"></p>
<font size="2"><span style="font-size:11pt">FieldTrip discussion list <fieldtrip@science.ru.nl><br>
Subject: Re: [FieldTrip] ft_clusterplot error?<br>
Message-ID:<br>
<CAFrxm=zMQuaKsyyBxOewfS5GgBYDMrXoUpHMk674WYFWXSfA+w@mail.gmail.com><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi Jac,<br>
<br>
I would start by plotting your (t)stats, and for simplicity doing that with<br>
ft_singleplotER (cfg.param = 'stat') rather than ft_clusterplot.<br>
Then try plotting the power-difference. This should not be more than a<br>
subtraction of data_diff.powspctrm = data1.powspctrm - data2.powspctrm, .<br>
No reshaping should be needed.<br>
The problem is probably a mistake somewhere keeping track of<br>
dimensions/latencies etc. which is tricky with clusters.<br>
Also, make sure to clear your cfg before every function so you don't carry<br>
the cfg of a previous function into the next. That will also help<br>
readability and debugging.<br>
<br>
HTH,<br>
Stephen<br>
</span></font>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div class="BodyFragment"><font size="2">
<div class="PlainText"><br>
</div>
</font></div>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Jac Billington<br>
<b>Sent:</b> 18 January 2019 18:07:04<br>
<b>To:</b> fieldtrip@science.ru.nl<br>
<b>Subject:</b> ft_clusterplot error?</font>
<div> </div>
</div>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">Dear experts,</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">I've recently begun using fieldtrip and have been following tutorials well. however, I have perhaps run into a problem with ft_clusterplot.
<br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">An example output is located in dropbox here:
<a href="https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0" class="x_OWAAutoLink" id="LPlnk961654" previewremoved="true">
https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0</a></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom: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? <br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">I did have earlier errors ('<span> ft_error('unsupported dimord %s', dimord);</span>') but I realised this was because dimensions of my
<span>stat.raweffect (64 5 200) were in conflict with collapsing time and frequency when running
<span>ft_freqstatistics</span>. Reducing stat.raweefect to 64 1 solved this error, but I'm wondering if I have done something wrong.
<br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>My code is posted below and I'd happily be poited to some papers if I'm misunderstanding this. </span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>Thank you in advance. Jac</span><br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"></p>
<div> % load data (from ft_freqanalysis) <br>
load(filename1);<br>
con1= freqScaling<br>
load(filename2);<br>
con2=freqScaling;<br>
<br>
%%%% run the stats: <br>
cfg = [];<br>
cfg.channel = 'all';<br>
cfg.latency = [4 6];<br>
cfg.frequency = [8 12];<br>
cfg.method = 'montecarlo';<br>
cfg.statistic = 'ft_statfun_indepsamplesT';<br>
cfg.correctm = 'cluster';<br>
cfg.clusteralpha = 0.05;<br>
cfg.clusterstatistic = 'maxsum';<br>
cfg.minnbchan = 2;<br>
cfg.tail = 0;<br>
cfg.clustertail = 0;<br>
cfg.alpha = 0.025;<br>
cfg.numrandomization = 500; <br>
cfg.avgoverchan = 'no' <br>
cfg.avgovertime = 'yes' <br>
cfg.avgoverfreq = 'yes' <br>
% prepare_neighbours determines what sensors may form clusters<br>
cfg_neighb.method = 'distance';<br>
cfg.neighbours = ft_prepare_neighbours(cfg_neighb, elec);</div>
<div><br>
design = zeros(1,size(con1.powspctrm,1) + size(con2.powspctrm,1));<br>
design(1,1:size(con1.powspctrm,1)) = 1;<br>
design(1,(size(con1.powspctrm,1)+1):(size(con1.powspctrm,1)+ size(con2.powspctrm,1))) = 2;<br>
cfg.design = design;<br>
cfg.ivar = 1;<br>
<br>
<br>
[stat] = ft_freqstatistics(cfg, con1, con2);<br>
<br>
<br>
<br>
cfg=[]<br>
cfg.keeptrials = 'no'<br>
cfg.latency = [4 6];<br>
cfg.frequency = [8 12];<br>
con1 = ft_freqdescriptives(cfg, con1);<br>
con2 = ft_freqdescriptives(cfg, con2);<br>
<br>
%%%% resize powerspec to avoid dimord error. Collapse freq/ time<br>
con1rs=mean(con1.powspctrm,3) %%% collapse time dim<br>
con2rs=mean(con2.powspctrm,3) %%% collapse time dim<br>
con1rs=mean(con1rs,2) %%% collapse freq<br>
con2rs=mean(con2rs,2) <br>
stat.raweffect = con1rs-con2rs<br>
<br>
cfg.alpha = 0.025;<br>
cfg.zparam = 'raweffect';<br>
cfg.zlim = [-1 3];<br>
cfg.layout = 'biosemi64.lay';<br>
cfg.subplotsize = ([1 1]);<br>
ft_clusterplot(cfg, stat);</div>
<br>
<p></p>
<br>
</div>
</div>
</div>
</body>
</html>