# [Eeglablist] Erratum: how to calculate absolute power using spectopo()

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Fri Feb 6 20:29:40 PST 2015

```Dear past recipients of this code (and eeglablist),

Sorry I told you a wrong way of calculating absolute power using
spectopo(). Please accept my sincere apologies. If you are using the old
code I sent you before, please replace it with the correct one.

Thank you Jerry Zhu for pointing it out!

Makoto

Correct
%%%%%%%%%%%%%%%%%%%
% for your epoched data, channel 2
[spectra,freqs] = spectopo(EEG.data(2,:,:), 0, EEG.srate);

% delta=1-4, theta=4-8, alpha=8-13, beta=13-30, gamma=30-80
deltaIdx = find(freqs>1 & freqs<4);
thetaIdx = find(freqs>4 & freqs<8);
alphaIdx = find(freqs>8 & freqs<13);
betaIdx  = find(freqs>13 & freqs<30);
gammaIdx = find(freqs>30 & freqs<80);

% compute absolute power
deltaPower = mean(10.^(spectra(deltaIdx)/10));
thetaPower = mean(10.^(spectra(thetaIdx)/10));
alphaPower = mean(10.^(spectra(alphaIdx)/10));
betaPower  = mean(10.^(spectra(betaIdx)/10));
gammaPower = mean(10.^(spectra(gammaIdx)/10));
%%%%%%%%%%%%%%%%%

Incorrect:
%%%%%%%%%%%%%%%%%%%
% compute absolute power
deltaPower = 10^(mean(spectra(deltaIdx))/10);
thetaPower = 10^(mean(spectra(thetaIdx))/10);
alphaPower = 10^(mean(spectra(alphaIdx))/10);
betaPower  = 10^(mean(spectra(betaIdx))/10);
gammaPower = 10^(mean(spectra(gammaIdx))/10);
%%%%%%%%%%%%%%%%%

--
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/20150206/9a834f5f/attachment.html>
```