<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<p><span style="font-size:11pt"><span style="line-height:normal"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:"Times New Roman",serif">Dear Fieldtrip-Community,</span></span></span></span></span></p>

<p><span style="font-size:11pt"><span style="line-height:normal"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:"Times New Roman",serif">I am new in this field and have a question regarding the time-frequency smoothing parameters prior to the cluster-based permutation tests. Since my tf representations are rather pixelated, I was considering using a 2D Gaussian kernel for smoothing. However, depending on whether I use the smoothing parameters (see script below) I acquire clusters or not. I was under the impression - please correct me if I am wrong - that smoothing the representations should not interfere with the data as such. I would very much appreciate your help,</span></span></span></span></span></p>

<p><span style="font-size:11pt"><span style="line-height:normal"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:"Times New Roman",serif">Best wishes,</span></span></span></span></span></p>

<p><span style="font-size:11pt"><span style="line-height:normal"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:"Times New Roman",serif">Marlen</span></span></span></span></span></p>
</div>

<div> </div>

<div>
<div>tests = {{'Cue' 'Random'} {'Expected' 'Random' }  {'Cue' 'Expected'}}; <br/>
 </div>

<div>for icond = 1:numel(tests)<br/>
    <br/>
    tmp1 = load([ftpath 'avgfreq_eeg_tf_' tests{icond}{1} '_alpha&beta.mat']);<br/>
    tmp2 = load([ftpath 'avgfreq_eeg_tf_' tests{icond}{2} '_alpha&beta.mat']);<br/>
    avg1 = tmp1.avg;<br/>
    avg2 = tmp2.avg;<br/>
    <br/>
    % frequency baseline correction<br/>
    cfg                 = [];<br/>
    cfg.baselinetype    = 'db';<br/>
    cfg.baseline        = [-1 -0.7];<br/>
    bslavg1             = ft_freqbaseline(cfg, avg1);<br/>
    bslavg2             = ft_freqbaseline(cfg, avg2);<br/>
    <br/>
<br/>
    % smooth TFRs on the group level to account for inter-subject variation<br/>
     for isub = 1:size(bslavg1.powspctrm, 1)<br/>
        for ichan = 1:size(bslavg1.powspctrm, 2)<br/>
            bslavg1.powspctrm(isub,ichan,:,:) = imgaussfilt(squeeze(bslavg1.powspctrm(isub,ichan,:,:)), [1 2]);<br/>
             bslavg2.powspctrm(isub,ichan,:,:) = imgaussfilt(squeeze(bslavg2.powspctrm(isub,ichan,:,:)), [1 2]);<br/>
       end<br/>
     end</div>

<div><br/>
    % prepare neighbourhood for cluster-based t-test<br/>
    cfg                 = [];<br/>
    cfg.method          = 'triangulation';<br/>
    cfg.layout          = 'acticap-64ch-standard2.mat';<br/>
    neighbours          = ft_prepare_neighbours(cfg);<br/>
   <br/>
    <br/>
    % set up cluster-based t-test<br/>
    cfg                  = [];<br/>
    cfg.channels         = 'all';<br/>
    cfg.method           = 'montecarlo';<br/>
    cfg.statistic        = 'ft_statfun_depsamplesT'; <br/>
    cfg.correctm         = 'cluster';<br/>
    cfg.clusteralpha     = 0.05;<br/>
    cfg.tail             = 0;<br/>
    cfg.clustertail      = 0;     <br/>
    cfg.alpha            = 0.025;<br/>
    cfg.clusterstatistic = 'maxsum';<br/>
    cfg.clusterthreshold = 'nonparametric_common';<br/>
    cfg.numrandomization = 1000; <br/>
    cfg.neighbours       = neighbours;<br/>
    %cfg.minnbchan        = 2; % macdab - minimal neighbouring channels<br/>
    cfg.frequency        = [2 40];<br/>
    cfg.latency          = [-0.7 2];<br/>
    <br/>
    % set up design matrix<br/>
    cfg.design  = [1:numel(subs) 1:numel(subs); ones(1, numel(subs)) 2*ones(1, numel(subs))];<br/>
    cfg.uvar    = 1;<br/>
    cfg.ivar    = 2;<br/>
    <br/>
    % run t-test and save data<br/>
    stat = ft_freqstatistics(cfg, bslavg1, bslavg2);<br/>
    save([ftpath 'ttest_db_smooth12__eeg_tf_' tests{icond}{1} '-' tests{icond}{2} '_alpha&beta.mat'], 'stat');<br/>
    <br/>
    % draw plot<br/>
    cfg                 = [];<br/>
    cfg.channel         = 'all';<br/>
    cfg.parameter       = 'stat';<br/>
    cfg.maskparameter   = 'mask';<br/>
    cfg.maskstyle       = 'outline';<br/>
    cfg.maskalpha       = 0.25;<br/>
    cfg.colorbar        = 'yes';<br/>
    cfg.marker         = 'on';<br/>
    cfg.colormap        = (brewermap(256, '*YlGnBu'));<br/>
    cfg.zlim            = [-2 2];<br/>
    cfg.xlim            = [-0.7 2];<br/>
    cfg.layout          = 'acticap-64ch-standard2.mat';<br/>
    figure<br/>
    ft_multiplotTFR(cfg, stat);<br/>
    title(['alpha&beta t-test ' tests{icond}{1} '-' tests{icond}{2}]);<br/>
<br/>
end </div>
</div></div></body></html>