<div dir="ltr"><div>Hi Jac,</div><div><br></div><div>
<div>To my eyes all looks fine to me!</div><div><br></div>

</div><div>- 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.<br></div><div>- 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.<br></div><div>- 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.<br></div><div>- You can check your neighbours with ft_neighbourplot</div><div></div><div></div><div><br> </div><div>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. <br></div><div><br></div><div>Cheers,</div><div>Stephen<br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, 21 Jan 2019 at 14:35, Jac Billington <<a href="mailto:J.Billington@leeds.ac.uk">J.Billington@leeds.ac.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div id="gmail-m_-8386321505271612644divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<div id="gmail-m_-8386321505271612644divtagdefaultwrapper" 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:0px;margin-bottom:0px">Dear Stephen,</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">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:0px;margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><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:0px;margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><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:0px;margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><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:0px;margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span>I think my design matrix is correct (following
<a href="http://www.fieldtriptoolbox.org/tutorial/cluster_permutation_timelock/" class="gmail-m_-8386321505271612644OWAAutoLink" id="gmail-m_-8386321505271612644LPlnk220108" target="_blank">
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:0px;margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span>The only other issue I can think of is in the parameter:</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span><span>        cfg.neighbours       = ft_prepare_neighbours(cfg_neighb, elec);</span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span>I create 'elec' by using <span>ft_read_sens</span> to read the preprocessing output from EEGlab.</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><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="gmail-m_-8386321505271612644OWAAutoLink" id="gmail-m_-8386321505271612644LPlnk137825" target="_blank"></a><br>
<p></p>
<p style="margin-top:0px;margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span><a href="https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0" class="gmail-m_-8386321505271612644OWAAutoLink" id="gmail-m_-8386321505271612644LPlnk495425" target="_blank">https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0</a></span></p>
<div id="gmail-m_-8386321505271612644LPBorder_GT_15480739252670.8938326113797403" style="margin-bottom:20px;overflow:auto;width:100%;text-indent:0px">
<table id="gmail-m_-8386321505271612644LPContainer_15480739252600.5933951556764678" 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="gmail-m_-8386321505271612644ImageCell_15480739252620.10286152176141006" colspan="1" style="width:250px;display:table-cell;padding-right:20px">
<div id="gmail-m_-8386321505271612644LPImageContainer_15480739252620.3721998266096741" style="background-color:rgb(255,255,255);height:200px;margin:auto;display:table;width:200px">
<a id="gmail-m_-8386321505271612644LPImageAnchor_15480739252620.27295467828228925" href="https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0" style="display:table-cell;text-align:center" target="_blank"><img id="gmail-m_-8386321505271612644LPThumbnailImageID_15480739252630.465449905223261" style="display: inline-block; max-width: 250px; max-height: 250px; height: 200px; width: 200px; border-width: 0px; vertical-align: bottom;" src="https://www.dropbox.com/static/images/spectrum-icons/generated/content/content-folder_dropbox-large.png" width="200" height="200"></a></div>
</td>
<td id="gmail-m_-8386321505271612644TextCell_15480739252630.45911273105218275" colspan="2" style="vertical-align:top;padding:0px;display:table-cell">
<div id="gmail-m_-8386321505271612644LPRemovePreviewContainer_15480739252630.27757472407818573"></div>
<div id="gmail-m_-8386321505271612644LPTitle_15480739252630.6446782183033298" style="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="gmail-m_-8386321505271612644LPUrlAnchor_15480739252640.5550262244154163" href="https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0" style="text-decoration:none" target="_blank">fieldtrip</a></div>
<div id="gmail-m_-8386321505271612644LPMetadata_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">
<a href="http://www.dropbox.com" target="_blank">www.dropbox.com</a></div>
<div id="gmail-m_-8386321505271612644LPDescription_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:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px"></p>
<font size="2"><span style="font-size:11pt">FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>><br>
Subject: Re: [FieldTrip] ft_clusterplot error?<br>
Message-ID:<br>
        <CAFrxm=<a href="mailto:zMQuaKsyyBxOewfS5GgBYDMrXoUpHMk674WYFWXSfA%2Bw@mail.gmail.com" target="_blank">zMQuaKsyyBxOewfS5GgBYDMrXoUpHMk674WYFWXSfA+w@mail.gmail.com</a>><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="gmail-m_-8386321505271612644Signature">
<div id="gmail-m_-8386321505271612644divtagdefaultwrapper" 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="gmail-m_-8386321505271612644BodyFragment"><font size="2">
<div class="gmail-m_-8386321505271612644PlainText"><br>
</div>
</font></div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-8386321505271612644divRplyFwdMsg" 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> <a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a><br>
<b>Subject:</b> ft_clusterplot error?</font>
<div> </div>
</div>
<div dir="ltr">
<div id="gmail-m_-8386321505271612644x_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:0px;margin-bottom:0px">Dear experts,</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">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:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">An example output is located in dropbox here:
<a href="https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0" class="gmail-m_-8386321505271612644x_OWAAutoLink" id="gmail-m_-8386321505271612644LPlnk961654" target="_blank">
https://www.dropbox.com/sh/64m3xpgco2uavky/AADT6-rXEdylVzHN1lY-q7SNa?dl=0</a></p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">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:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">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:0px;margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><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:0px;margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span>Thank you in advance. Jac</span><br>
</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px"></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>
</div>

_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote></div>