<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Arial,Helvetica,sans-serif'>
<p>Hey Tineke,</p>
<p>Thank you very much ! It's all clear now. I was stuck with the list of statistics described in the "help" of freqstatistics and I did not even though of browsing the ft_statfun_XXX functions. I'm gonna try this right away. </p>
<p>Have a nice day,</p>
<p> </p>
<p>Laetitia Lalla</p>
<p style="margin-bottom: 0in; line-height: 100%;">PhD student in Neurosciences</p>
<p style="margin-bottom: 0in; line-height: 100%;">INMED, Marseille, France</p>
<p> </p>
<p>On 01-04-2016 12:03, Snijders, T.M. (Tineke) wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div style="direction: ltr; font-family: Helvetica; color: #000000; font-size: 10pt;"><span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"><span style="font-size: 10pt;"><span style="color: black; font-family: Helvetica;"><span>Hi Laetitia,<br /><br /> Indeed, as 'coh' doesn't have the trial information anymore after ft_connectivityanalysis, you can't use it as input for ft_freqstatistics if you only have one subject. <br /><br /> Indeed, giving 'cohspctrm' as parameter with your freq data doesn't work as 'cohspctrm' is not in your freq data. The cfg.parameter specifies what data to use for the randomization, so that parameter should be in the data you give as input.<br /><br /> You can use the freq data as input for freq_statistics, but then you have to change your cfg.statistic. This is the statistical function that is called after shuffling your trials - in your case after shuffling your trials the coherence has to be computed and the difference between conditions calculated. As far as I know, if you set your cfg.statistic to 'diff_itc', it will compute the difference in the inter-trial coherence between two conditions (looking at the phase consistency over trials).<br /><br /> Best,<br /> Tineke<br /><br /></span></span></span></span>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px;"><hr />
<div id="divRpF777069" style="direction: ltr;"><span style="color: #000000; font-family: Tahoma; font-size: small;"><strong>From:</strong> laetitia.lalla@inserm.fr [laetitia.lalla@inserm.fr]<br /><strong>Sent:</strong> Thursday, March 31, 2016 3:22 PM<br /><strong>To:</strong> FieldTrip discussion list<br /><strong>Cc:</strong> Snijders, T.M. (Tineke)<br /><strong>Subject:</strong> Re: [FieldTrip] Question about coherence statistics<br /></span></div>
<div> </div>
<div>
<p>Dear Tineke,</p>
<p>thank you very much for your fast answer ! I'm not sure I understand what you mean though...  Maybe i did not express myself correctly. I do have individual trial data : I have 26 observations for condition 1 and 26 observations for condition 2.</p>
<p>They appear :</p>
<p>- In my structure "data" (output of ft_preprocessing) : data.trial is a cell {1 x nbtrials} (in my case : {1, 26})</p>
<p>- in my structure "freq" (output of ft_freqanalysis) : freq.powspctrm is a matrix of dimension : nbtrials X nbchannel X nbfreq (in my case 26x2x25)</p>
<p>But I don't have this information anymore in the structure "coh" (output of ft_connectivityanalysis) : coh.cospctrm is a matrix of dimension nbchannelcmb x nbfreq (in my case 1x25) since the coherence is calculated by averaging over trials...</p>
<p> </p>
<p>You may mean I should give the "freq" structures as inputs to the fonction ft_freqstatistics ?</p>
<p>I just tried that : I created a structure data_all by concatenated data1.trial and data2.trial (and every other appropriate attribute). I took the Time Frequency Representation with ft_freqanalysis (with keeptrials='yes') to obtain a structure TFR_all (following this tutorial : <a> http://www.fieldtriptoolbox.org/tutorial/natmeg/statistics</a> This is actually how I did the statistics for the Power).</p>
<p>But then, if I give this as an input to ft_freqstatistics, like this :</p>
<p>cfg = [];<br /> cfg.statistic = 'diff';<br /> cfg.parameter='cohspctrm';<br /> cfg.design= [ones(1,nbtrial)) 2*ones(1, nbtrial))]; %same nb of trials for both condition<br /> cfg.method    = 'montecarlo';<br />         cfg.numrandomization  = 1000;<br />         cfg.ivar      = 1;<br />         cfg.alpha=0.05;<br />         cfg.tail=0;<br />         cfg.correcttail='alpha';<br /> >> stat=ft_freqstatistics(cfg, FR_alltrials);</p>
<p>I have the following error :</p>
<p>Error using getdimord (line 15)<br /> field "cohspctrm" not present in data</p>
<p>which makes a lot of sense, since I did not gave coherence as an input... I gave Frequency representations.. I was hoping that maybe the function would calculate the coherence itself for the statistics ? ^^ But it's clearly not the way to go.</p>
<p> </p>
<p>Could you be a bit more explicit about what you meant ?</p>
<p> </p>
<p>Thanks a lot.</p>
<p>Best,</p>
<p style="margin-bottom: 0in; line-height: 100%;">Laetitia Lalla</p>
<p style="margin-bottom: 0in; line-height: 100%;">PhD student in Neurosciences</p>
<p style="margin-bottom: 0in; line-height: 100%;">INMED, Marseille, France</p>
<p> </p>
<p> </p>
<p>On 31-03-2016 13:47, Snijders, T.M. (Tineke) wrote:</p>
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">
<div style="direction: ltr; font-family: Helvetica; color: #000000; font-size: 10pt;"><span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"><span style="font-size: 10pt;"><span style="color: black; font-family: Helvetica;"><span>Hi Laetitia,<br /><br /> If you only have one subject you do need individual trial data, otherwise you can't do statistics like this.<br /> You need multiple observations (either subjects or trials).<br /><br /> Best,<br /> Tineke<br /><br /></span></span></span></span>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px;"><hr />
<div id="divRpF533353" style="direction: ltr;"><span style="color: #000000; font-family: Tahoma; font-size: small;"><strong>From:</strong> fieldtrip-bounces@science.ru.nl [fieldtrip-bounces@science.ru.nl] on behalf of laetitia.lalla@inserm.fr [laetitia.lalla@inserm.fr]<br /><strong>Sent:</strong> Thursday, March 31, 2016 1:11 PM<br /><strong>To:</strong> fieldtrip@science.ru.nl<br /><strong>Subject:</strong> [FieldTrip] Question about coherence statistics<br /></span></div>
<div> </div>
<div>
<p style="margin-bottom: 0in; line-height: 100%;">Dear FielTrip community,</p>
<p style="margin-bottom: 0in; line-height: 100%;">Sorry to bother you again...</p>
<p style="margin-bottom: 0in; line-height: 100%;">I have a question about the statistical testing to assess coherence differences and the related paper by E Maris, JM Schoffelen and P Fries (Journal of Neuroscience Methods, 2007)</p>
<p style="margin-bottom: 0in; line-height: 100%;">I believe I am exactly in the framework described in this paper, but I guess there is still some crucial information that I don't understand...</p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p style="margin-bottom: 0in; line-height: 100%;">This is my story :</p>
<p style="margin-bottom: 0in; line-height: 100%;">- It's a single-subject study</p>
<p style="margin-bottom: 0in; line-height: 100%;">- I want to compare two sets of trials observed in different conditions.</p>
<p style="margin-bottom: 0in; line-height: 100%;">- The 2 sets of trials are exactly the same size, so my coherence estimate won't be biased by the "unequal sample size problem".</p>
<p style="margin-bottom: 0in; line-height: 100%;">- I just want to compare for 1 channel pair, for 1 frequency bin [6Hz 10Hz], so I guess the Multiple Comparison problem won't affect my analysis too much (either in the spatial or the spectral dimension).</p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p style="margin-bottom: 0in; line-height: 100%;">Based on the paper, I could refer myself to the point "2.7.1. A non parametric satistical test for a single signal pair and a single frequency bin".</p>
<p style="margin-bottom: 0in; line-height: 100%;">- Since my interest is in the coherence difference for a single signal pair, I can choose [|C1(f)|-|C2(f)|] as a test statistic.</p>
<p style="margin-bottom: 0in; line-height: 100%;">- And I can perform the montecarlo simulation.</p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p style="margin-bottom: 0in; line-height: 100%;">My question is the following : How can I implement the nonparametric test of the coherence difference between my 2 conditions with the fieldtrip functions ?</p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p style="margin-bottom: 0in; line-height: 100%;">This is what I did :</p>
<p style="margin-bottom: 0in; line-height: 100%;">1) Extract and preprocess the signal from my condition 1.</p>
<p style="margin-bottom: 0in; line-height: 100%;">2) freq1= ft_freqanalysis(cfg, signal1) (with cfg.method='mtmfft', cfg.output='powandcsd') →</p>
<p style="margin-bottom: 0in; line-height: 100%;">3) coh1= ft_connectivityanalysis(cfg, freq1)</p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p style="margin-bottom: 0in; line-height: 100%;">I did the same thing for the other condition → coh2.</p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p style="margin-bottom: 0in; line-height: 100%;">And then for the statistics :</p>
<p style="margin-bottom: 0in; line-height: 100%;">cfg = [];</p>
<p style="margin-bottom: 0in; line-height: 100%;">cfg.statistic = 'diff'; (% because the statistic test than I chose is the difference [|C1(f)|-|C2(f)|])</p>
<p style="margin-bottom: 0in; line-height: 100%;">cfg.parameter='cohspctrm';</p>
<p style="margin-bottom: 0in; line-height: 100%;">cfg.method = 'montecarlo';</p>
<p style="margin-bottom: 0in; line-height: 100%;">cfg.numrandomization = 1000;</p>
<p style="margin-bottom: 0in; line-height: 100%;">cfg.ivar = 1;</p>
<p style="margin-bottom: 0in; line-height: 100%;">cfg.alpha=0.05;</p>
<p style="margin-bottom: 0in; line-height: 100%;">cfg.tail=0;</p>
<p style="margin-bottom: 0in; line-height: 100%;">cfg.correcttail='alpha';</p>
<p style="margin-bottom: 0in; line-height: 100%;">stat=ft_freqstatistics(cfg, coh1, coh2);</p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p style="margin-bottom: 0in; line-height: 100%;">And it gives me the following error :</p>
<p style="margin-bottom: 0in; line-height: 100%;">Error using ft_checkconfig (line 153)</p>
<p style="margin-bottom: 0in; line-height: 100%;">The field cfg.design is required.</p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p style="margin-bottom: 0in; line-height: 100%;">Here, I really don't understand why I'm asked for the design matrix... When doing the statistics for the Power, I understood that the design matrix was telling which trial belonged to the condition 1 and which trial belonged to the condition 2. But here, it doesn't make any sense because my coherence was calculated by averaging on the trials...</p>
<p style="margin-bottom: 0in; line-height: 100%;">Does the design matrix mean something differently here ? Or maybe I forgot one parameter to put in the cfg ?</p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p style="margin-bottom: 0in; line-height: 100%;">Any help will be appreciated !</p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p style="margin-bottom: 0in; line-height: 100%;">Thanks a lot for your time,</p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p style="margin-bottom: 0in; line-height: 100%;">Laetitia Lalla</p>
<p style="margin-bottom: 0in; line-height: 100%;">PhD student in Neurosciences</p>
<p style="margin-bottom: 0in; line-height: 100%;">INMED, Marseille, France</p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p style="margin-bottom: 0in; line-height: 100%;"> </p>
<p> </p>
<div> </div>
</div>
</div>
</div>
<br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace;">_______________________________________________<br /> fieldtrip mailing list<br /><a>fieldtrip@donders.ru.nl</a><br /><a>http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div>
</blockquote>
<p> </p>
<div> </div>
</div>
</div>
</div>
<!-- html ignored --><br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">_______________________________________________<br /> fieldtrip mailing list<br /><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br /><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div>
</blockquote>
<p> </p>
<div> </div>
</body></html>