How to calculate absolute power for EEG from power spectra density? For example, I have power spectrum density calculated by pwelch

f = EEG.data;
f = f(2, :);
N = EEG.pnts;
Fs = EEG.srate;
NFFT = 2^nextpow2(N);
NOVERLAP = 0;
WINDOW = 512;
[spectra, freqs] = pwelch(x, WINDOW, NOVERLAP, NFFT,Fs);
deltaIdx = find(freqs&gt;1 &amp; freqs&lt;4);
deltaPower = mean(spectra(deltaIdx));


The code comes from EEGLab, and can be found here: https://sccn.ucsd.edu/pipermail/eeglablist/2014/008043.html

How should I calculate absolute power from it? What's the relationship between absolute power and power spectrum density?
I had to do some searching to be able to answer this question. As a matter of fact, a similar questions was once asked on Signal Processing. 

To make the explanation more laymen-like, I think the answer means the following:

With pwelch or an FFT analysis you can calculate the amplitude of sinusoids with particular frequencies (see this answer ). 
These amplitudes squared, result in the absolute power within these specific frequencies. The resulting power per frequency is the power spectral density (PSD). In neuroscience, people do not often work with individual frequencies but work with frequency bands, such as the alpha band (8-14 Hz). This can be calculated by taking the average or the integral.

The absolute power (W), you referred to, is the power of the entire signal. It thus does not make a distinction between the different frequencies. This can be calculated, by summing the power of each frequency (i.e. taking the integral of the signal). By summing, you have the total amount of power within the signal. 
The absolute power can be used to normalize the PSD, by dividing the PSD by the absolute power (as described in the answer on Signal Processing). 

Average vs integral

It seems that it is possible to calculate either the average or the integral of a frequency band. But when would you take the integral and when would you take the average? The average is an easy way of calculating how high the power is in a specific frequency band. This way, it does not matter how large the range of a frequency band is. The alpha band average will not be more inflated then the delta band (0-4 Hz) because of a bigger range. 

When you take the integral there will exist differences that are affected by the size of the frequency band, because you do not divide the sum by the amount of samples (i.e frequencies). However, it does allow you to normalize the PSD with the absolute power. Say, the integral of the alpha band results in 2W, the integral of the delta band results in 1W, and the absolute power of the entire spectrum equals 10W. Then we know that the alpha band plays a 20% part and the delta band a 10% part in the total signal. With mere averaging, this would not be possible because we 'neglect' the size of the range. 

I think it depends on what exactly you are after. I haven't work with the absolute power and am not familiar with it's user. Perhaps it has something to do with comparisons between exp. conditions (within frequency-bands, i.e. alpha vs alpha) or within exp. conditions (between frequency bands). If an actual expert could elaborate on why one method is beneficial over the other, that would be great.