<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;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
Dear Fellow fieldtrip users,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
I hope that you don't mind me emailing you directly enquiring about the procedures of using ft_statfun_correlationT. I have been reading the fieldtrip forum but seems to still don't quite understand fully on how to get the function to run properly. I currently
 have power spectrum values (2047 frequency points) from 15 electrode channels (which will give a powspctrm size of 15x2047) and I would like to see whether any of the frequency bands (alpha, delta, beta, gamma values) do correlate to behavioral measures such
 as distress, etc. As it had suggested in the forum </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
<a href="http://mailman.science.ru.nl/pipermail/fieldtrip/2015-February/008950.html" target="_blank" title="http://mailman.science.ru.nl/pipermail/fieldtrip/2015-February/008950.html
Ctrl+Click or tap to follow the link">http://mailman.science.ru.nl/pipermail/fieldtrip/2015-February/008950.html</a></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
I should create a dummy variable with equal size to powspctrm and fill them with my behavioural value (eg 'distress' lets call it D which is essentially D*ones(15,2047)). </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
I have created a design matrix as follow :</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.design           = [1*ones(1,36) 2*ones(1,36); 1:36 1:36];</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
as I have 36 replications </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
Here is the script that I have put together.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
%% Conditions</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
%C1 - actual powerspectrum values of 15 electrodes</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
%C2 - distress values</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
C_1 = {TIN1{2} TIN1{4} TIN1{5} TIN1{6} TIN1{7} TIN1{8} TIN1{9} TIN1{10} TIN1{11} TIN2{2} TIN2{4} TIN2{5} TIN2{6} TIN2{7} TIN2{8} TIN2{9} TIN2{10} TIN2{11} TIN3{2} TIN3{4} TIN3{5} TIN3{6} TIN3{7} TIN3{8} TIN3{9} TIN3{10} TIN3{11} TIN4{2} TIN4{4} TIN4{5} TIN4{6}
 TIN4{7} TIN4{8} TIN4{9} TIN4{10} TIN4{11}};</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
C_2 = {TFI1{1} TFI1{2} TFI1{3} TFI1{4} TFI1{5} TFI1{6} TFI1{7} TFI1{8} TFI1{9}  TFI2{1} TFI2{2} TFI2{3} TFI2{4} TFI2{5} TFI2{6} TFI2{7} TFI2{8} TFI2{9} TFI3{1} TFI3{2} TFI1{3} TFI3{4} TFI3{5} TFI3{6} TFI3{7} TFI3{8} TFI3{9} TFI4{1} TFI4{2} TFI4{3} TFI4{4} TFI4{5}
 TFI4{6} TFI4{7} TFI4{8} TFI4{9}};</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
 </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg = [];</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.layout = 'MEG.lay';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
lay = ft_prepare_layout(cfg);</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
 </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
 </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
%% Performing cluster statistics</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg                  = [];</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.frequency        = [8 12];</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.channel          = 'all';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.avgovertime      = 'no';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.avgoverfreq      = 'yes';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.avgoverchan      = 'no';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.statistic        = 'ft_statfun_correlationT';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.numrandomization = 1000;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.correctm         = 'cluster';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.method           = 'montecarlo';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.clusteralpha     = 0.05;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.clusterstatistic = 'maxsum';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.minnbchan        = 1;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.tail             = 0;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.clustertail      = 0;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.alpha            = 0.05;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg_neighb.layout    = lay;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg_neighb.method    = 'triangulation';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.neighbours       = ft_prepare_neighbours(cfg_neighb);</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.uvar             = 1;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.ivar             = 1;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.computecritval = 'yes';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.design           = [1*ones(1,36) 2*ones(1,36); 1:36 1:36];</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
stat                 = ft_freqstatistics(cfg, C_1{:}, C_2{:});</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
%% Plotting significant clusters</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg                  = [];</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.alpha            = 0.05;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.parameter        = 'stat';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
cfg.layout           =lay;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
ft_clusterplot(cfg, stat);</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
I would like to thank you guys for your kind help and assistance. </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
Kind Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 14pt; margin-bottom: 14pt;">
Ronny</div>
<br>
<p></p>
</div>
</body>
</html>