<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Chris,
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I do have 80 trials and I also have 1 more which is the average .</div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
One more question ,please.</div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
So my coherence estimates for that just 1 trial (which is the average) and just only 6 tapers used, will still be wrong ??</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>Well, it is not so common to use the coherence coefficient on averages, just like it is not so common to compute a spectrum of an ERP, but in the end it depends what YOU like to infer from the computed metric. If it’s about quantifying the consistency
of the phase difference of ongoing or induced neural rhythmic activity, then spectral transformation of the average does not make much sense.</div>
<div><br class="">
</div>
<div>Best wishes,</div>
<div>Jan-Mathijs</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Thank you very much</div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Kind regards,</div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Chris</div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Sent from<span class="Apple-converted-space"> </span><a href="https://urldefense.com/v3/__https://go.microsoft.com/fwlink/?LinkId=550986__;!!HJOPV4FYYWzcc1jazlU!sDkHaXDSv8v8C8b4zn8AlSZ41337Lw-VuT9s0KyzOsWLQIwyA-yFlsbnpZndzQmA0VU8K6fX$" style="color: blue; text-decoration: underline;" class="">Mail</a><span class="Apple-converted-space"> </span>for
Windows 10</div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="border-style: solid none none; border-top-width: 1pt; border-top-color: rgb(225, 225, 225); padding: 3pt 0in 0in;" class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif; border: none; padding: 0in;" class="">
<b class="">From:<span class="Apple-converted-space"> </span></b><a href="mailto:jan.schoffelen@donders.ru.nl" style="color: blue; text-decoration: underline;" class="">Schoffelen, J.M. (Jan Mathijs)</a><br class="">
<b class="">Sent:<span class="Apple-converted-space"> </span></b>Thursday, April 29, 2021 10:43 AM<br class="">
<b class="">To:<span class="Apple-converted-space"> </span></b><a href="mailto:fieldtrip@science.ru.nl" style="color: blue; text-decoration: underline;" class="">FieldTrip discussion list</a><br class="">
<b class="">Subject:<span class="Apple-converted-space"> </span></b>Re: [FieldTrip] Question about frequency analysis</div>
</div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Hi Chris,<span class="Apple-converted-space"> </span><o:p class=""></o:p></div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I notice that you only have a single trial in your data. In Fieldtrip, the unit-of-observation that goes into the coherence computation is the so-called ‘rpttap’ dimension, which is the number of trials times the number of tapers applied. If this number is
1, then the coherence will be 1, by mathematical definition. <o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
When the trial length is 0.7 seconds, the specification of tapsmofrq leads to 6 Slepian tapers to be applied (i.e. 2*0.7*5-1), thus to a rpttap of 6 times the number of trials. This brings down the coherence values (but will no doubt still lead to quite biased
estimates, because your input just contains a single trial). With only a 0.2 s window selected, the number of tapers will be 1: (2*0.2*5-1), and thus coherence will indeed trivially go to 1 all over the place. I don’t know what happens in the 0.5 s case, though,
provided your reported all-ones in this case are indeed observed in this situation as well.<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Long story short, you should increase the number of trials in your computation, or ramp up the smoothing parameter (the latter makes you lose spectral resolution, so probably that’s undesired).<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Best wishes,<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Jan-Mathijs<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<br class="">
<br class="">
<o:p class=""></o:p></div>
<blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="">
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
On 29 Apr 2021, at 09:24, Christodoylos Karittevlis <<a href="mailto:christodoylos_k@hotmail.com" style="color: blue; text-decoration: underline;" class="">christodoylos_k@hotmail.com</a>> wrote:<o:p class=""></o:p></div>
</div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div class="">
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Dear Fieldtrip Community,<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I am using the function ft_freqanalysis to calculate power spectrum and cross spectrum and after that I calculate the Magnitude Squared Coherence.<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
The trials are defined to start from -0.200s up to +0.500s .<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
When I use the function ft_freqanalysis on the whole trial it works fine , Coherence gives values from 0 to 1.<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
But when I try to use it only for the prestimulus period (e.g -0.2s – 0s ) or only to the poststimulus period (e.g 0 : 0.5s) , I think it does not work correctly because the Magnitude Squared Coherence is equal to 1 for all the pairs of channels .<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Do you know if I can calculate the power spectrum and cross spectrum only for prestimulus period or only to the poststimulus period ?<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
This is the script that I am using :<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">cfg = [];</span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">cfg.output = 'powandcsd';</span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">cfg.method = 'mtmfft';</span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">cfg.foilim = [5 100];</span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">cfg.pad ='nextpow2';</span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">cfg.tapsmofrq = 5;</span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">cfg.keeptrials = 'yes';</span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">cfg.trials = [1] ;<span class="apple-converted-space"> </span></span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">freq = ft_freqanalysis(cfg, data );</span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
data have the structured as the output of ft_preprocessing.<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
When I want to select only the prestimulus or post stimulus period I am using :<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">cfg = [];<span class="apple-converted-space"> </span></span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">cfg.latency = [-0.2 0] ;<span class="apple-converted-space"> </span></span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">data_pre = ft_selectdata(cfg,data) ;</span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class=""> </span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">% select only the post stimulus period 0:0.2</span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">cfg = [] ;<span class="apple-converted-space"> </span></span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">cfg.latency = [0 0.5];</span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(68, 114, 196);" class="">data_post = ft_selectdata(cfg,data) ;</span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Thank you in advance!<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Kind regards,<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Chris<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Sent from<span class="apple-converted-space"> </span><a href="https://urldefense.com/v3/__https:/go.microsoft.com/fwlink/?LinkId=550986__;!!HJOPV4FYYWzcc1jazlU!qTYweIa9rVq5IOMpogVpem_hxn63jpoEOR2mm9J786hT9C72LMok_ZxRD46-sN2WZAUbq-_B$" style="color: blue; text-decoration: underline;" class="">Mail</a><span class="apple-converted-space"> </span>for
Windows 10<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""></o:p></div>
</div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10.5pt; font-family: Helvetica, sans-serif;" class="">_______________________________________________<br class="">
fieldtrip mailing list<br class="">
</span><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="color: blue; text-decoration: underline;" class=""><span style="font-size: 10.5pt; font-family: Helvetica, sans-serif;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</span></a><span style="font-size: 10.5pt; font-family: Helvetica, sans-serif;" class=""><br class="">
</span><a href="https://urldefense.com/v3/__https:/doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!qTYweIa9rVq5IOMpogVpem_hxn63jpoEOR2mm9J786hT9C72LMok_ZxRD46-sN2WZE6-sjJY$" style="color: blue; text-decoration: underline;" class=""><span style="font-size: 10.5pt; font-family: Helvetica, sans-serif;" class="">https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!qTYweIa9rVq5IOMpogVpem_hxn63jpoEOR2mm9J786hT9C72LMok_ZxRD46-sN2WZE6-sjJY$</span></a><o:p class=""></o:p></div>
</div>
</blockquote>
</div>
</div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">fieldtrip
mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="color: blue; text-decoration: underline; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: 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-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!sDkHaXDSv8v8C8b4zn8AlSZ41337Lw-VuT9s0KyzOsWLQIwyA-yFlsbnpZndzQmA0X-2lNnB$" style="color: blue; text-decoration: underline; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: 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-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!sDkHaXDSv8v8C8b4zn8AlSZ41337Lw-VuT9s0KyzOsWLQIwyA-yFlsbnpZndzQmA0X-2lNnB$</a><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""></span></blockquote>
</div>
<br class="">
</div>
</body>
</html>