[Eeglablist] Default Overlap in Spectopo / std_spec and PSD vs. FFT

Jason Palmer japalmer29 at gmail.com
Wed Apr 15 21:22:57 PDT 2015


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:

1)      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

2)      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.

 

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.

 

Best,

Jason

 

From: eeglablist-bounces at sccn.ucsd.edu [mailto:eeglablist-bounces at sccn.ucsd.edu] On Behalf Of Makoto Miyakoshi
Sent: Wednesday, April 15, 2015 8:08 PM
To: Erickson; Arnaud Delorme
Cc: EEGLAB List
Subject: Re: [Eeglablist] Default Overlap in Spectopo / std_spec and PSD vs. FFT

 

Dear Erick,

 

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.

 

> whether I should be using the FFT or PSD

 

std_spec can use matlab FFT. You can find it in std_spec() line 319.

 

else % fft mode

    if oritrials == 1 || strcmpi(g.continuous, 'on')

        X = bsxfun(@times, X, hamming(size(X,2))');

    end;

    if all([ EEG.trials ] == 1) && ~isempty(boundaries), disp('Warning: fft does not take into account boundaries in continuous data'); end;

    tmp   = fft(X, g.nfft, 2);

    f     = linspace(0, EEG(1).srate/2, floor(size(tmp,2)/2));

    f     = f(2:end); % remove DC (match the output of PSD)

    tmp   = tmp(:,2:floor(size(tmp,2)/2),:);

    X     = tmp.*conj(tmp);

    if strcmpi(g.logtrials, 'on'),  X = 10*log10(X); end;

    if strcmpi(g.savetrials, 'off'), X = mean(X,3); end;

    if strcmpi(g.logtrials, 'off'),  X = 10*log10(X); end;

end;

 

PSD uses pwelch. spectopo() line 898

 

if usepwelch

 [tmpspec,freqs] = pwelch(matsel(tmpdata,frames,0,1,e),...

                                         winlength,g.overlap,fftlength,srate);

 

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?

 

Makoto

 

On Mon, Apr 13, 2015 at 5:07 PM, Erickson <ericksonb.eng at gmail.com> wrote:

Hi all,

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.

 

There are two functions one could use to extract power spectra information.

 

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.

 

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? 

 

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".

 

This general information was previously covered (http://sccn.ucsd.edu/pipermail/eeglablist/2013/006174.html) but the discussion was difficult to follow. Correction of any errors I've made is appreciated.

 

Technical concerns aside, more opaque is the difference between these two options - Power Spectral Density vs. FFT.

 

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 http://sccn.ucsd.edu/pipermail/eeglablist/2014/008224.html

 

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?

 

Best,

Brian Erickson

 

Creativity Research Laboratory

Applied Brain and Cognitive Sciences Program

Drexel University, Department of Psychology

College of Arts and Sciences

 

 

 

 

 

 

 

 


_______________________________________________
Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu





 

-- 

Makoto Miyakoshi
Swartz Center for Computational Neuroscience
Institute for Neural Computation, University of California San Diego

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20150415/db9f51d1/attachment.html>


More information about the eeglablist mailing list