# How does averaging increase the Signal to Noise ratio?

When attempting to spot activities on an EEG waveform given a stimuli, it is recommended that several trials be taken and their average is done to increase the SNR.

Intuitively, since noise is not stationary or localized, averaging different trials will have a smearing effect on the noise.

But how exactly does it increase the SNR since the noise is still present (but averaged out)? Can we more rigorously define the effect of averaging on the SNR?

Intuitively this is true, because averaging a zero mean noise processes approximates its expectation value - which is zero. More rigorously:

If the signal $x$ that you want to observe (estimate, actually) is constant for all observations $y$ we can write the $n\text{th}$ observation as $$y_n = x + r_n$$ where $r_n$ is the noise which is different for every observation, of course. The SNR $\gamma_1$ of $y_n$ is $$\gamma_1=\frac{\operatorname{E}[|x|^2]}{\operatorname{E}[|r_n|^2]}$$ where $\operatorname{E}$ is the expectation operator. By averaging $N$ observations of $y_n$ we get $$\hat x = \frac{1}{N}\sum_{n=1}^N( x+r_n) = x + \frac{1}{N}\sum_{n=1}^N r_n$$ The SNR $\gamma_2$ of the averaged observations is $$\gamma_2=\frac{\operatorname{E}[|x|^2]}{\frac{1}{N^2}\operatorname{E}[|\sum_{n=1}^N r_n|^2]}$$ To simplify that expression, we assume that the noise sequences $r_n$ are uncorrelated (1). In that case, the expectation of the squared sum of $r_n$ is equal to the sum of the expectations of the squared $r_n$, i.e. $$\operatorname{E}\left[|\sum_{n=1}^N r_n|^2\right] = \sum_{n=1}^N \operatorname{E}\left[|r_n|^2\right]=N\operatorname{E}\left[|r_n|^2\right]$$ Inserting this in the expression for $\gamma_2$ yields $$\gamma_2=N \frac{\operatorname{E}[|x|^2]}{\operatorname{E}[|r_n|^2]}$$ Comparing the SNR $\gamma_1$ of the single observation and the SNR $\gamma_2$ of the averaged observation we see that averaging increases the SNR by a factor of $N$.

(1) This holds for a Gaussian noise process, for example. Right now I'm not sure for what classes of stochastic processes it holds. Comments on this are welcome.

• on (1): wouldn't the central limit theorem make the average of many non-gaussian random variables a gaussian variable on itself? – Florian Castellane Nov 19 '14 at 15:47
• @FlorianCastellane That's a good point. However, the expectation of the magnitude square of this Gaussian RV is unknown if the summands are correlated. – Deve Dec 1 '14 at 13:58

averaging only increases S/N if the "S" component of the items being averaged is correlated and the "N" component is not correlated.

when adding perfectly correlated values, then the overall "voltage" metrics are added and the values team up. so adding the same thing to itself $N$ times increases that value by a factor of $N$ and the power (the mean square) increases by a factor of $N^2$.

but when you add $N$ totally uncorrelated values together, the overall power metric adds to $N$ times bigger.

signal power goes up by $N^2$, noise power goes up by $N$, so the signal power to noise power ratio goes up by $\frac{N^2}{N} = N$.

in order to make this work, you must somehow synchronize your signal values so that they really do "team up". if you don't do that, your averaging won't help.

The above analysis's are correct if the signal is constant/DC; if the signal is varying but you know the shape you have to weight the samples. In this case you are trying for the amplitude of the waveform with slow edges but you know the shape; and you are trying to improve your signal to noise by looking at the edges as well as the "top"; actually in the case I have in mind the "top" was never reached. In this case the correct form of combining Gaussian contaminated samples is:

$\sum_{i=0}^n(S_i\cdot \frac{W_i}{N_i^2})$

Where $W_i$ is the pre-calculated relative value of the waveform at point j; typically you would make the sum of the weights one. The ratio $\frac{W_i}{N_i^2}$ is pre-calculated and $S_j$ is the sample value. As usual in signal in signal processing scaling is required but the formula is robust in calculating $(\frac{S}{N})^2$ As a matter of fact you can see that the formula is a weighted sum of the squares of the S/N across the samples. I deduced it via a symbolic algebra program a long time ago; if somebody wants I could reconstruct the proof. As I recall the proof wasn't enlightening and the result looked accidental. Sometime later I convinced myself that geometric vector space argument would work in an obvious manner but never wrote that down.