<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"\@SimSun";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:black;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1483811327;
mso-list-type:hybrid;
mso-list-template-ids:1141158924 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-text:"%1\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'>I believe that according to this code, the essential difference will be the smoothness of the spectral density estimates, which will result from the fact that PSD is essentially an average of FFTs of a number windowed, overlapping segments. So the only difference will depend on:<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><span style='mso-list:Ignore'>1)<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span dir=LTR></span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'>Number of segments used in average by the FFT and Pwelch functions in this code (more segments = smoother estimate/less fine detail (or “noise”) depending on how much data you have<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><span style='mso-list:Ignore'>2)<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span dir=LTR></span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'>The window used in Pwelch (I think the default is hanning window). Windows will also basically just smooth the psd estimate. So fft relies on averaging a number of windows only, while Pwelch both averages a number of (overlapping) segments, and windows the segments.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'>I can’t tell immediately from the code the default number of segments used in the 2 methods here, but it is probably documented, or discussed previously.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'>Best,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'>Jason<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> eeglablist-bounces@sccn.ucsd.edu [mailto:eeglablist-bounces@sccn.ucsd.edu] <b>On Behalf Of </b>Makoto Miyakoshi<br><b>Sent:</b> Wednesday, April 15, 2015 8:08 PM<br><b>To:</b> Erickson; Arnaud Delorme<br><b>Cc:</b> EEGLAB List<br><b>Subject:</b> Re: [Eeglablist] Default Overlap in Spectopo / std_spec and PSD vs. FFT<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Dear Erick,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Yes I remember I was overwhelmed. It's not still clear to me; not even clear to me if there is a problem. Let me assume that there is no problem and give you the following explanation.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>> whether I should be using the FFT or PSD<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>std_spec can use matlab FFT. You can find it in std_spec() line 319.<o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><div><p class=MsoNormal><span style='color:#990000'>else % fft mode</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> if oritrials == 1 || strcmpi(g.continuous, 'on')</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> X = bsxfun(@times, X, hamming(size(X,2))');</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> end;</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> if all([ EEG.trials ] == 1) && ~isempty(boundaries), disp('Warning: fft does not take into account boundaries in continuous data'); end;</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> tmp = fft(X, g.nfft, 2);</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> f = linspace(0, EEG(1).srate/2, floor(size(tmp,2)/2));</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> f = f(2:end); % remove DC (match the output of PSD)</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> tmp = tmp(:,2:floor(size(tmp,2)/2),:);</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> X = tmp.*conj(tmp);</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> if strcmpi(g.logtrials, 'on'), X = 10*log10(X); end;</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> if strcmpi(g.savetrials, 'off'), X = mean(X,3); end;</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> if strcmpi(g.logtrials, 'off'), X = 10*log10(X); end;</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'>end;</span><o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>PSD uses pwelch. spectopo() line 898<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><div><p class=MsoNormal><span style='color:#990000'>if usepwelch</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> [tmpspec,freqs] = pwelch(matsel(tmpdata,frames,0,1,e),...</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#990000'> winlength,g.overlap,fftlength,srate);</span><o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='color:black'>It's up to you whether you want to use FFT or PSD. The difference of the results from the two methods should derive from the difference from matlab FFT vs. pwelch (apart from windowing & overlapping issue...) Am I wrong, experts?</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='color:black'>Makoto</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Mon, Apr 13, 2015 at 5:07 PM, Erickson <<a href="mailto:ericksonb.eng@gmail.com" target="_blank">ericksonb.eng@gmail.com</a>> wrote:<o:p></o:p></p><div><p class=MsoNormal>Hi all,<o:p></o:p></p><div><p class=MsoNormal>When using Spectopo, I was confused about the overlap used by default. I did some digging and developed a summary that I think may be useful to others, as well as some questions for the listserv.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>There are two functions one could use to extract power spectra information.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>One is Spectopo, which by default calculates the Power Spectral Density (PSD). When no "overlap" value is given, the default is [0] in timepoints. This could be confusing, since the default of the underlying function pwelch() is 50% overlap. However, this is only when pwelch is called directly. Overlap must be manually specified when called from spectopo(). Spectopo() is the function called when using plot->channel spectra and maps.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>The other is std_spec(). When called with the "PSD" option, std_spec() calls spectopo with no overlap value. (it will always default to [0] and there is no way to specify an overlap.) I am not aware of where this std_spec() function is called in the GUI. Can anyone comment on this? Is it only available from the "Study" function? <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>std_spec() can also be called in FFT mode, in which case it defaults - on continuous data only - to 1s epochs with .5s overlap. These variables can be set by two options specifying the epoch length and epoch "recurrence".<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>This general information was previously covered (<a href="http://sccn.ucsd.edu/pipermail/eeglablist/2013/006174.html" target="_blank">http://sccn.ucsd.edu/pipermail/eeglablist/2013/006174.html</a>) but the discussion was difficult to follow. Correction of any errors I've made is appreciated.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Technical concerns aside, more opaque is the difference between these two options - Power Spectral Density vs. FFT.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>In a previous topic I posted, PSD and FFT have been described as both essentially equivalent and different by various experts, and the discussion was left unresolved: see <a href="http://sccn.ucsd.edu/pipermail/eeglablist/2014/008224.html" target="_blank">http://sccn.ucsd.edu/pipermail/eeglablist/2014/008224.html</a><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I am confused, when reporting mean power values across time periods, whether I should be using the FFT or PSD options and what the essential differences between these frequency domain transformation methods are. I think this is a quite essential topic as band power within a time window is a core method for reporting condition differences in EEG. Would anyone comment on the contrast between PSD and FFT and in which situations either should be reported / analyzed?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Best,<o:p></o:p></p></div><div><p class=MsoNormal>Brian Erickson<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Creativity Research Laboratory<o:p></o:p></p></div><div><p class=MsoNormal>Applied Brain and Cognitive Sciences Program<o:p></o:p></p></div><div><p class=MsoNormal>Drexel University, Department of Psychology<o:p></o:p></p></div><div><p class=MsoNormal>College of Arts and Sciences<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div></div><p class=MsoNormal><br>_______________________________________________<br>Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" target="_blank">http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br>To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu" target="_blank">eeglablist-unsubscribe@sccn.ucsd.edu</a><br>For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu" target="_blank">eeglablist-request@sccn.ucsd.edu</a><o:p></o:p></p></div><p class=MsoNormal><br><br clear=all><o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>-- <o:p></o:p></p><div><div><p class=MsoNormal>Makoto Miyakoshi<br>Swartz Center for Computational Neuroscience<br>Institute for Neural Computation, University of California San Diego<o:p></o:p></p></div></div></div></div></div></body></html>