<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi Kelly,
<div class=""><br class="">
</div>
<div class="">Well, obviously ‘chan_freq_time’ as a dimord is not appropriate to do an inferential statistical test. You need a ‘rpt’ (or ‘subj’) dimension in your data.</div>
<div class=""><br class="">
</div>
<div class="">As long as this has not been sorted out, it is no use to call ft_clusterplot.</div>
<div class=""><br class="">
</div>
<div class="">The best current practice is to input into ft_freqstatistics a cell-array of structures (so ft_freqgrandaverage should not be used). </div>
<div class="">An alternative would be to use ft_appendfreq</div>
<div class=""><br class="">
</div>
<div class="">The following pseudo-code should get you on track. If not, please consult the fieldtrip-wiki for similar examples </div>
<div class=""><br class="">
</div>
<div class="">Nsubj = <the number of subjects></div>
<div class="">for k = 1:Nsubj</div>
<div class="">  load(<data for subject k in condition 1>);</div>
<div class="">  S1{k} = data;</div>
<div class="">  load(<data for subject k in condition 2>);</div>
<div class="">  S2{k} = data;</div>
<div class="">end</div>
<div class=""><br class="">
</div>
<div class="">cfg = [];</div>
<div class="">cfg ….</div>
<div class="">cfg.design = [ones(1,Nsubj) ones(1,Nsubj)*2;1:Nsubj 1:Nsubj];</div>
<div class="">cfg.ivar = 1;</div>
<div class="">cfg.uvar = 2;</div>
<div class="">cfg.statistic = ‘depsamplesT’;</div>
<div class="">stat = ft_freqstatistics(cfg, S1{:}, S2{:});</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Best,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">J.M.Schoffelen<br class="">
Senior Researcher, VIDI-fellow<br class="">
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands<br class="">
</div>
<div class=""><br class="">
</div>
<div>
<blockquote type="cite" class="">
<div class="">On 10 Jan 2017, at 15:36, Murphy, Kelly (Research Student) <<a href="mailto:murphyk5@aston.ac.uk" class="">murphyk5@aston.ac.uk</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; direction: ltr; font-family: Tahoma; font-size: 10pt;" class="">
Many thanks for your reply Jan-Mathijs,
<div class=""><br class="">
</div>
<div class="">Indeed for both structures, '.dimord' reads 'chan_freq_time'.  I can now get ft_freqstatistics to run sensibly but only when I add code so design(2,:)  to show 18 and 28 (i.e. group 1 n=8, group 2 n=8).  However, when I try to run ft_clusterplot
 I get the following error message, <span style="font-size: 10pt;" class="">when stat.stat has the same chan_freq_time dimensions as ft_freqanalysis and ft_freqstatistics outputs (204x48x76).  This</span><span style="font-size: 10pt;" class=""> leads me to
 believe you are correct in pointing out that I have made a mistake in formatting my variables along the line:</span></div>
<div class=""><br class="">
</div>
<div class="">
<div class="">"Error using ft_clusterplot (line 144)</div>
<div class="">this only works if either frequency or time is a singleton dimension" </div>
<div class=""><br class="">
</div>
<div class="">Your help so far has been very valuable; but I am still unsure as to where I have gone wrong.</div>
<div class=""><br class="">
</div>
<div class="">Thank you</div>
<div class=""><br class="">
</div>
<div class="">Kelly</div>
<div class=""><br class="">
</div>
<div class="">
<blockquote type="cite" class="" style="font-family: 'Times New Roman'; font-size: 16px;">
<div class="">
<div class="" style="direction: ltr; font-family: Tahoma; font-size: 10pt;">
<div class=""><font color="#000080" size="1" class="">PhD candidate</font></div>
<div class="">
<div class="" style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; margin: 0px;">
<font face="Calibri,sans-serif" class=""><font face="Arial,sans-serif" color="#000080" size="1" class="">Department of Psychology</font></font></div>
<div class="" style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; margin: 0px;">
<font face="Calibri,sans-serif" class=""><font face="Arial,sans-serif" color="#000080" size="1" class="">Aston University</font></font></div>
<div class="" style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; margin: 0px;">
<font face="Calibri,sans-serif" class=""><font face="Arial,sans-serif" color="#000080" size="1" class="">Birmingham B4 7ET</font></font></div>
<div class="" style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; margin: 0px;">
<font face="Calibri,sans-serif" class=""><font face="Arial,sans-serif" color="#000080" size="1" class="">United Kingdom</font></font></div>
</div>
</div>
</div>
</blockquote>
</div>
<div class="">
<div class="">
<div class="" style="direction: ltr; font-family: Tahoma; font-size: 10pt;">
<div class="">
<div class="" style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; margin: 0px;">
<font face="Calibri,sans-serif" class=""><font face="Arial,sans-serif" color="#000080" size="1" class=""><br class="">
</font></font></div>
</div>
</div>
</div>
</div>
<div class="">
<div class="">
<div class="" style="direction: ltr; font-family: Tahoma; font-size: 10pt;">
<div class="">
<div class="" style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; margin: 0px;">
<font face="Calibri,sans-serif" class=""><font face="Arial,sans-serif" color="#000080" size="1" class=""><br class="">
</font></font></div>
</div>
</div>
</div>
</div>
<div style="font-family: 'Times New Roman'; font-size: 16px;" class="">
<hr tabindex="-1" class="">
<div id="divRpF241591" style="direction: ltr;" class=""><font face="Tahoma" size="2" class=""><b class="">From:</b><span class="Apple-converted-space"> </span><a href="mailto:fieldtrip-bounces@science.ru.nl" class="">fieldtrip-bounces@science.ru.nl</a> [<a href="mailto:fieldtrip-bounces@science.ru.nl" class="">fieldtrip-bounces@science.ru.nl</a>]
 on behalf of Schoffelen, J.M. (Jan Mathijs) [<a href="mailto:jan.schoffelen@donders.ru.nl" class="">jan.schoffelen@donders.ru.nl</a>]<br class="">
<b class="">Sent:</b><span class="Apple-converted-space"> </span>10 January 2017 13:40<br class="">
<b class="">To:</b><span class="Apple-converted-space"> </span>FieldTrip discussion list<br class="">
<b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [FieldTrip] ft_freqstatistics on grandaveraged TFR data<br class="">
</font><br class="">
</div>
<div class=""></div>
<div class="">Hi Kelly,
<div class="">It could be that you made a small mistake in formatting the input data to ft_freqstatistics (T_LLL and T_LLH). You may want to check whether these data structures have a ‘dimord’ which reads ‘rpt_chan_freq(_time)' or ‘subj_chan_freq(_time)’.</div>
<div class=""><br class="">
</div>
<div class="">Best,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<br class="">
<div class="">
<div class="" style="word-wrap: break-word;">J.M.Schoffelen<br class="">
Senior Researcher, VIDI-fellow<br class="">
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands<br class="">
<br class="">
<br class="">
</div>
</div>
</div>
<div class=""><br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On 09 Jan 2017, at 22:44, Murphy, Kelly (Research Student) <<a href="mailto:murphyk5@aston.ac.uk" class="" target="_blank">murphyk5@aston.ac.uk</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="" style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; direction: ltr; font-family: Tahoma; font-size: 10pt;">
Hello Fieldtrippers,
<div class=""><br class="">
</div>
<div class="">I am trying to use a monte carlo permutation test using ft_freqstatistics on grandaveraged data over 8 participants for two independent conditions but I am struggling to create the correct design matrix using the following code:</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">cfg = [];   cfg.method = 'montecarlo';    cfg.computestat = 'yes';  <span class="" style="font-size: 10pt;">cfg.statistic = 'indepsamplesT'; cfg.numrandomization = 500;   cfg.correctm = 'fdr';  </span><span class="" style="font-size: 10pt;">cfg.computecritval
 = 'yes'; cfg.alpha = 0.025; cfg.tail = 0; cfg.clustertail = 0;   </span><span class="" style="font-size: 10pt;">cfg.clusterstatistic = 'maxsum';    cfg.minnbchan = 2;    </span></div>
<div class=""><span class="" style="font-size: 10pt;">design = zeros(1,size(T_LLL.powspctrm,1) + size(T_LLH.powspctrm,1));</span></div>
<div class="">design(1,1:size(T_LLL.powspctrm,1)) = 1;</div>
<div class="">design(1,(size(T_LLL.powspctrm,1)+1):(size(T_LLL.powspctrm,1)+<span class="" style="font-size: 10pt;">size(T_LLH.powspctrm,1))) = 2;</span></div>
<div class=""><span class="" style="font-size: 10pt;">cfg.design           = design;</span></div>
<div class="">cfg.ivar             = 1;</div>
<div class="">[stat] = ft_freqstatistics(cfg, T_LLL, T_LLH); </div>
</div>
<div class=""><br class="">
</div>
<div class="">I am left with the following error message:</div>
<div class="">"<span class="" style="font-size: 10pt;">Error using ft_freqstatistics (line 174)</span></div>
<div class="">the length of the design matrix (1) does not match the number of observations</div>
<div class="">in the data (2)"</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">I am struggling to see what errors I am making and I have tried my best to adhere to the guidelines outlined on the Fieldtrip tutorials, so if anyone with a keen eye can offer any help it would be most appreciated!</div>
<div class=""><br class="">
</div>
<div class="">Many thanks</div>
<div class=""><br class="">
</div>
<div class="">Kelly</div>
<div class=""><br class="">
</div>
<div class=""><font color="#000080" class=""><br class="">
</font></div>
<div class=""><font color="#000080" size="1" class="">PhD candidate</font></div>
<div class="">
<div class="" style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; margin: 0px;">
<font face="Calibri,sans-serif" class=""><font face="Arial,sans-serif" color="#000080" size="1" class="">Department of Psychology</font></font></div>
<div class="" style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; margin: 0px;">
<font face="Calibri,sans-serif" class=""><font face="Arial,sans-serif" color="#000080" size="1" class="">Aston University</font></font></div>
<div class="" style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; margin: 0px;">
<font face="Calibri,sans-serif" class=""><font face="Arial,sans-serif" color="#000080" size="1" class="">Birmingham B4 7ET</font></font></div>
<div class="" style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; margin: 0px;">
<font face="Calibri,sans-serif" class=""><font face="Arial,sans-serif" color="#000080" size="1" class="">United Kingdom</font></font></div>
</div>
<div class=""><br class="">
</div>
</div>
<span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; float: none; display: inline !important;">_______________________________________________</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
<span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; float: none; display: inline !important;">fieldtrip
 mailing list</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
<a href="mailto:fieldtrip@donders.ru.nl" class="" target="_blank" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">fieldtrip@donders.ru.nl</a><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="" target="_blank" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<br class="">
</div>
<br class="">
</div>
</div>
</div>
</div>
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="mailto:fieldtrip@donders.ru.nl" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">fieldtrip@donders.ru.nl</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<br class="">
<br class="">
</div>
</div>
<br class="">
</body>
</html>