17

How does one quantify how "white" some noise is? Are there any statistical measures, or any other measures (FFTs for example) that can quantify how close to white noise a particular sample is?

Kitchi
  • 721
  • 2
  • 8
  • 18
  • 3
    Are you interested in suggestions on how to compare different noise sources/signals or are you looking for a "industry standard" metric that applies to the amount of "color" in a noise source? I am not aware of a general metric that applies, but you can compare the amount of coloration by looking at the noise power distribution in an FFT or PSD (flatter = whiter) or you can compare autocorrelation fucitons (narrower = flatter). – user2718 Jan 29 '13 at 13:44
  • If I understand you correctly you are looking for an automatic black box calculator of 'whiteness', correct? – Spacey Jan 29 '13 at 15:31
  • 1
    +1 for computing the Power Spectral Density of the source. For the record, I would like to add that white noise can't be sampled in practice, as its PSD is flat in -∞ < f < ∞. – Serge Jan 29 '13 at 21:04
  • @Mohammad - Not necessarily a black box to calculate. I'm just curious if there's a mathematical estimator of whiteness. – Kitchi Jan 30 '13 at 06:21
  • 1
    @BruceZenone - For a real sample of data, as Serge pointed out, the PSD will never be completely flat, no? But I'm still guessing that the flatter it is, the closer it comes to being "true" white noise. – Kitchi Jan 30 '13 at 06:22
  • @Serge You should make PSD into an answer. I think everyone here agrees that that's the way to go. – Phonon Jan 30 '13 at 08:07
  • @Kitchi I agree with the other comments (yours as well). It seems like we are working on an estimate of whiteness. How you pick apart the PSD and crunch out a number to represent "whiteness" will affect the value of such an estimate. The "best" estimation algorithm may be application specific. – user2718 Jan 31 '13 at 14:43
  • @Serge - Calculate the PSD and then crunch the PSD values to come up with a measure of flatnetss. I assume we want a single number as the final "whiteness" measure. – user2718 Jan 31 '13 at 14:48
  • Peter, Can you please cite source [15] from the screenshot you have made from the book? Thanks, Hanan. – Hanan Shteingart Aug 30 '13 at 21:26
  • @HananShteingart: Unfortunately, that part of the reference list doesn't appear to be part of the preview... – Peter K. Aug 30 '13 at 22:21
  • (years later) see https://en.wikipedia.org/wiki/Spectral_flatness – denis Oct 07 '16 at 11:25

3 Answers3

14

You could form a statistical test, based on the autocorrelation of the potentially-white sequence. The Digital Signal Processing Handbook suggests the following.

enter image description here

This may be implemented in scilab as below.

Running this function over two noise sequences: a white noise one, and a lightly filtered white noise one, then the following plot results. Script for generation of each realization of the noise sequences is at the end.

enter image description here

The mean of the statistic for the white noise is 9.79; the mean of the statistic for the filtered noise is 343.3.

Looking at a chi-squared table for 10 degrees of freedom, we get:

enter image description here

and we see that there is no significance level at which 9.79 (in the table) that the white noise isn't white. We also see that the value of 343.3 is very likely to be non-white (comparing it to the 23.2093 value in the $p=0.01$ significance column).


function R = whiteness_test(x,m)
    N = length(x);
    XC = xcorr(x);
    len = length(XC);
    lags = len/2+1 + [1:m];
    R = N*sum(XC(lags).^2)/XC(len/2+1).^2;
 endfunction

X = rand(1,1000,'normal');
Y = filter(1,[1 -0.5],X)
R = [R; whiteness_test(X,10)];
R2 = [R2; whiteness_test(Y,10)];
Peter K.
  • 25,714
  • 9
  • 46
  • 91
  • im not a big statistican... But i have a concern regarding the general validity of the above metioned test for non gaussian white noise processes: As far as i understand white noise only means that there is no correlation in time and thus the autocorrelation is an impulse at 0 lag. White does not necessarily mean that the amplitudes are normally distributed, which is what the test assumes... Thus as far as i understand the test is valid for white gaussian noise (because the sum of squared gaussian distributions is Chi-squared) and not for general white noise? Am i right or is there anything wr – Fabian Jun 12 '17 at 09:21
  • @Fabian : Yes and no. You are correct in that the test assumes that the autocorrelation values are Gaussian. If the original noise is just about any distribution, then the central limit theorem means that the distribution of the autocorrelation estimates will be Gaussian. There are some pathological cases where the autocorrelation coefficients will not be Gaussian, but these are generally few and far between (and perhaps autocorrelation analysis isn't the best thing to be doing in those cases). – Peter K. Jun 12 '17 at 12:04
  • @PeterK.Wouldn't a "harder" test be to determine the flatness of the PSD? This way, no assumptions are made and the distribution of the noise samples is irrelevant. – Envidia Jun 12 '17 at 19:01
  • @Envidia : The two are equivalent, are they not? The PSD is just the DFT of the autocorrelation sequence. – Peter K. Jun 12 '17 at 19:10
  • @PeterK. In your example yes, they are essentially equivalent. However the procedure does assume i.i.d. where as generally, the samples can be distributed in any fashion. I do understand that the Central Limit theorem does come into play and is valid, hence why I use the term "harder". Maybe a better term would be "general". – Envidia Jun 12 '17 at 19:19
  • @Envidia : Doesn't the sequence not being i.i.d. mean that the sequence is non-stationary, so any frequency domain or autocorrelation estimate approach immediately goes out the window as the sequence is not wide-sense stationary? Not trying to be contrary, just trying to understand your point... – Peter K. Jun 12 '17 at 19:33
  • @PeterK.Do you mean "non-stationary" as "strict non-stationary"? If so, a process can fail to be strict-stationary but still be wide-sense stationary. There is nothing stopping the samples of a process to be distributed differently yet still adhering to being wide-sense stationary. My point is that the samples don't have to necessarily be i.i.d because the process can still be WSS; thus analyzing the flatness of the PSD is a more general test for noise "whiteness". Also, please be contrary if necessary, I am still learning. – Envidia Jun 12 '17 at 19:54
  • @PeterK. What does the Chi-squared table tell you? Why did you look at 10 degrees of freedom? The link is broken. – random_dsp_guy Aug 02 '18 at 16:48
  • @Seth What it gives is the chi-square value at various "percent belows". The higher the value, the larger the percentage of likely values are below it. Or, conversely, the higher the value, the less likely it is that the assumption being tested for is correct. Check out this tutorial and, if that doesn't help, feel free to ask a new question. Tag me here if you do; I may not see it otherwise. – Peter K. Aug 03 '18 at 11:57
  • @Seth PS: Fixed the link and updated the image. Thanks for that! – Peter K. Aug 03 '18 at 11:58
  • @PeterK. Here's my new question: https://dsp.stackexchange.com/questions/50972/why-use-chi2-test-to-determine-the-presence-of-white-noise/50979#50979 – random_dsp_guy Aug 03 '18 at 14:46
  • @Seth Thanks! The reason I used dof 10 was because I used $m=10$ as the number of lags to test over. YMMV. Why 10 lags? That really depends on the number of original datapoints you have. I thought that for 1000 original datapoints, 10 would be a good number of lags. – Peter K. Aug 03 '18 at 14:50
5

I would use the signal's autocorrelation properties or flatness of PSD to determine this. The autocorrelation of theoretical white noise is an impulse at lag 0. Furthermore, the PSD of the fourier transform of the autocorrelation function, the PSD of theoretical white noise is constant.

Either of these should give you a good idea of the whiteness of your noise.

Ethereal
  • 167
  • 1
  • 4
3

Whiteness is equivalent to independence.

You can look at the diehard https://en.wikipedia.org/wiki/Diehard_tests

Volume 2 of Knuth's Semi-numerical Algorithms has a section on random number generators and testing.

The problem with DFT based tests is that there is a little bit of spectral leakage the technique introduces some correlation, which, if you make your transforms "long" can typically be neglected.

There are tests for random bitstreams as well at NIST

lennon310
  • 3,590
  • 19
  • 24
  • 27