[Eeglablist] Alpha asymmetry spectral analysis

Tarik S Bel-Bahar tarikbelbahar at gmail.com
Wed Nov 10 21:06:25 PST 2010

Greetings Ross,

I had similar questions a while back, and hopefully the below helps.
Good luck with articulating your data analysis path!
You may also want to consider other types of asymmetries, other
spectral bands, ratios between bands, and source
estimation, if your data is dense enough.

Cheers, Tarik


First off, read through all of the eeglab documentation, with some
focus on importing data
and on having eeglab detect or import events.

Next, make sure that you are saving the events inside or with your raw
EEG file, so as to make
sure there is some way for that eeglab can detect them, or that you
can use the extra epochs tool on later.
If you have no "events", try to make sure that your file has segment
start events or markers saved into it.
There are other options depending on the system you are using. Eeglab
should be able to read any extra event information in your eeg files.

Next, search in the EEGLAB list archives for terms with alpha
asymmetry. You can download them all to one folder, and then search
for the text string of interest across the whole archives. I think
it's the archives are also searchable online. [there is some alpha
asymmetry information there, with code suggestions].
You may also want to specifically contact a researcher who has
published an alpha asymmetry article with EEGLAB.
Also, see the eeglab help documentation about running spectopo and
similar time-frequency functions.
Within eeglab, why don't you take a look at some of the code below. Good luck!

[spec439 frq439] = spectopo (EEG.data, 250, 250, 'overlap', 125,
'winsize', 250,'plot', 'off', 'chanlocs', 'GSN129.sfp');
xlswrite('spec439.xls', spec439(:,1:256));
xlswrite('frq439.xls', frq439);


left= 24;
right = 25;
[spec_24 freqs ] = spectopo(EEG.data(right,:), 250, 250, 'plot', 'off')
[spec_25 freqs ] = spectopo(EEG.data(left,:), 250, 250, 'plot', 'off')
[tmp alpha_ind] = min( abs(freqs-8));
asymmetry1 = spec_24(alpha_ind) - spec_25(alpha_ind);
asymmetry2 = spec_25(alpha_ind) - spec_24(alpha_ind);
f439= fopen('439.xls', 'w+');
dlmwrite('439.xls', asymmetry1);

***I've also include a sample MATLAB non-EEGLAB function from John Allen below,
which he was kind enough to share when I had questions similar to yours.

function [fs,pwr] = geeg_block_fft(time_series,hz,win)
%GEEG_BLOCK_FFT - get power for multiple time series
%   Syntax: [fs,pwr] = geeg_block_fft(time_series,hz,win)
%   Input:
%       time_series - [nPoints x nSeries] time series
%       hz - sampling rate
%       win - window to apply (e.g. hamming(2048))
%   Output:
%       fs - frequencies
%       pwr - [nFFTPoints x nSeries] power at each frequency

[nPoints, nSeries] = size(time_series);

%% Windowing
% Check window size against block size
if (size(win,2) < nSeries)
    % repeat window to make matrix the same size as time_series
    win = repmat(win,1,nSeries);
% Apply window
time_series = time_series.*win;

%% Compute FFT, power
% Take fft
FFTX = fft(time_series);
% Calculate the number of unique points
NumUniquePts = ceil((nPoints+1)/2);
% FFT is symmetric, throw away second half
FFTX = FFTX(1:NumUniquePts,:);
% Take the magnitude of fft of x
MX = abs(FFTX);
% Scale the fft so that it is not a function of the length of x
MX = MX./nPoints;
% Take the square of the magnitude of fft of x.
pwr = MX.^2;
% Multiply by 2 because you threw out second half of FFTX above
pwr = pwr.*2;
% DC Component should be unique, i.e. undo multiply by 2.
pwr(1,:) = pwr(1,:)./2;
% Nyquist component should also be unique.
if ~rem(nPoints,2)
   % Here NFFT is even; therefore, Nyquist point is included.
   pwr(end,:) = pwr(end,:)./2;

%% Compute frequency vector
% This is an evenly spaced frequency vector with NumUniquePts points.
fs = (0:NumUniquePts-1)* hz / nPoints;


On Mon, Nov 8, 2010 at 7:00 PM, Ross Ávila <ross.avila at gmail.com> wrote:
> Hi everyone,
> I am a graduate student working on an alpha asymmetry study and I am
> struggling with the spectral analysis.
> I have collected 8 minutes of resting EEG divided into 8 60-second
> blocks.  Upon loading the data into EEGLAB, it recognizes a single
> 8-minute long epoch.  I'm just confused about what I need to do at
> this point, and there is no one at the University of South Florida
> that researches alpha asymmetry (they all do ERP studies here).  I
> have little to no experience in MATLAB (part of what appealed to me
> about the EEGLAB interface), so any help in the form of coding might
> need to be "dumbed" down and pretty basic.
> I am struggling specifically with the following questions:
> 1) Do I need to extract epochs? If so, how?
> 2) How do I actually get the alpha asymmetry?  I've read about using
> FFT, but don't know how to actually do this.  Also read about
> "windowing" but again do not understand exactly what this means.
> Any help would be immensely appreciated.
> Thank you,
> Ross
> --
> Ross T. Ávila
> Cognitive Neuropsychology Lab
> Doctoral Program in Clinical Psychology
> University of South Florida
> _______________________________________________
> 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

More information about the eeglablist mailing list